On 25 August 2017 at 10:33, Fam Zheng <f...@redhat.com> wrote: > On Fri, 08/25 10:10, Peter Maydell wrote: >> The problem is that we don't have a good framework for building >> guest binaries to run under TCG. We should sort out one of those >> so that it's easy for a new test to say "this is the .c file, >> build it with an ARM gcc [eg using our docker stuff], then >> run it with this QEMU command". When we have that it should >> be straightforward to convert the 'make test' tests to use >> that, and they can be run under 'make check'. > > This seems straigtforward to do with docker. Could you elaborate a concrete > example of one of the "this is the .c file, ..." test so I can try translate > it > to a Makefile rule using our docker images?
tests/tcg/hello-i386.c is probably a good place to start. It wants to be built with an i386 compiler like so: i386-linux-gcc -nostdlib -Wall -O2 -g -fno-strict-aliasing -static -o hello-i386 hello-i386.c and then run with qemu-i386 ./hello-i386 which should print "Hello World". There's also a hello-arm which you can build with arm-linux-gnueabihf-gcc -Wall -g -O2 -marm -c -o hello-arm.o hello-arm.c arm-linux-gnueabihf-ld -o hello-arm hello-arm.o and run with qemu-arm ./hello-arm to print "Hello World". (You can probably compile and link in one step, but for some reason tests/tcg/Makefile is doing it with two steps.) thanks -- PMM