3 # Builds and runs tests for a particular target passed as an argument to this
10 # If we're going to run tests inside of a qemu image, then we don't need any of
11 # the scripts below. Instead, download the image, prepare a filesystem which has
12 # the current state of this repository, and then run the image.
14 # It's assume that all images, when run with two disks, will run the `run.sh`
15 # script from the second which we place inside.
16 if [ "$QEMU" != "" ]; then
17 tmpdir
=/tmp
/qemu-img-creation
20 if [ -z "${QEMU#*.gz}" ]; then
21 # image is .gz : download and uncompress it
22 qemufile
=$
(echo ${QEMU%.gz} |
sed 's/\//__/g')
23 if [ ! -f $tmpdir/$qemufile ]; then
24 curl https
://s3-us-west-1.amazonaws.com
/rust-lang-ci
2/libc
/$QEMU | \
25 gunzip
-d > $tmpdir/$qemufile
28 # plain qcow2 image: just download it
29 qemufile
=$
(echo ${QEMU} |
sed 's/\//__/g')
30 if [ ! -f $tmpdir/$qemufile ]; then
31 curl https
://s3-us-west-1.amazonaws.com
/rust-lang-ci
2/libc
/$QEMU \
36 # Create a mount a fresh new filesystem image that we'll later pass to QEMU.
37 # This will have a `run.sh` script will which use the artifacts inside to run
39 rm -f $tmpdir/libc-test.img
42 # Do the standard rigamarole of cross-compiling an executable and then the
43 # script to run just executes the binary.
45 --manifest-path libc-test
/Cargo.toml \
48 rm $CARGO_TARGET_DIR/$TARGET/debug
/main-
*.d
49 cp $CARGO_TARGET_DIR/$TARGET/debug
/main-
* $tmpdir/mount
/libc-test
50 echo 'exec $1/libc-test' > $tmpdir/mount
/run.sh
54 --root $tmpdir/mount \
55 --size-in-blocks 100000 \
58 # Pass -snapshot to prevent tampering with the disk images, this helps when
59 # running this script in development. The two drives are then passed next,
60 # first is the OS and second is the one we just made. Next the network is
61 # configured to work (I'm not entirely sure how), and then finally we turn off
62 # graphics and redirect the serial console output to out.log.
66 -drive if=virtio
,file=$tmpdir/$qemufile \
67 -drive if=virtio
,file=$tmpdir/libc-test.img \
68 -net nic
,model
=virtio \
71 -vga none
2>&1 |
tee $CARGO_TARGET_DIR/out.log
72 exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
75 # FIXME: x86_64-unknown-linux-gnux32 fail to compile wihout --release
76 # See https://github.com/rust-lang/rust/issues/45417
78 if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then
82 cargo
test $opt --no-default-features --manifest-path libc-test
/Cargo.toml
--target $TARGET
83 exec cargo
test $opt --manifest-path libc-test
/Cargo.toml
--target $TARGET