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.amazonaws.com
/rust-lang-ci
/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.amazonaws.com
/rust-lang-ci
/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 # If we have a cross compiler, then we just do the standard rigamarole of
43 # cross-compiling an executable and then the script to run just executes the
46 # If we don't have a cross-compiler, however, then we need to do some crazy
47 # acrobatics to get this to work. Generate all.{c,rs} on the host which will
48 # be compiled inside QEMU. Do this here because compiling syntex_syntax in
49 # QEMU would time out basically everywhere.
50 if [ "$CAN_CROSS" = "1" ]; then
51 cargo build
--manifest-path libc-test
/Cargo.toml
--target $TARGET
52 cp $CARGO_TARGET_DIR/$TARGET/debug
/libc-test
$tmpdir/mount
/
53 echo 'exec $1/libc-test' > $tmpdir/mount
/run.sh
55 rm -rf $tmpdir/generated
56 mkdir
-p $tmpdir/generated
57 cargo build
--manifest-path libc-test
/generate-files
/Cargo.toml
58 (cd libc-test
&& TARGET
=$TARGET OUT_DIR
=$tmpdir/generated SKIP_COMPILE
=1 \
59 $CARGO_TARGET_DIR/debug
/generate-files
)
61 # Copy this folder into the mounted image, the `run.sh` entry point, and
62 # overwrite the standard libc-test Cargo.toml with the overlay one which will
63 # assume the all.{c,rs} test files have already been generated
64 mkdir
$tmpdir/mount
/libc
65 cp -r Cargo.
* libc-test src ci
$tmpdir/mount
/libc
/
66 ln -s libc-test
/target
$tmpdir/mount
/libc
/target
67 cp ci
/run-qemu.sh
$tmpdir/mount
/run.sh
68 echo $TARGET |
tee -a $tmpdir/mount
/TARGET
69 cp $tmpdir/generated
/* $tmpdir/mount
/libc
/libc-test
70 cp libc-test
/run-generated-Cargo.toml
$tmpdir/mount
/libc
/libc-test
/Cargo.toml
75 --root $tmpdir/mount \
76 --size-in-blocks 100000 \
79 # Pass -snapshot to prevent tampering with the disk images, this helps when
80 # running this script in development. The two drives are then passed next,
81 # first is the OS and second is the one we just made. Next the network is
82 # configured to work (I'm not entirely sure how), and then finally we turn off
83 # graphics and redirect the serial console output to out.log.
87 -drive if=virtio
,file=$tmpdir/$qemufile \
88 -drive if=virtio
,file=$tmpdir/libc-test.img \
89 -net nic
,model
=virtio \
92 -vga none
2>&1 |
tee $CARGO_TARGET_DIR/out.log
93 exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
98 cargo rustc
--manifest-path libc-test
/Cargo.toml
--target $TARGET -- \
99 -C link-args
=-mios-simulator-version-min=7.0
103 cargo build
--manifest-path libc-test
/Cargo.toml
--target $TARGET
108 # Android emulator for x86_64 does not work on travis (missing hardware
109 # acceleration). Tests are run on case *). See ci/android-sysimage.sh for
110 # informations about how tests are run.
111 arm-linux-androideabi | aarch64-linux-android | i686-linux-android
)
112 # set SHELL so android can detect a 64bits system, see
113 # http://stackoverflow.com/a/41789144
114 # https://issues.jenkins-ci.org/browse/JENKINS-26930?focusedCommentId=230791&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230791
115 export SHELL
=/bin
/dash
116 arch
=$
(echo $TARGET | cut
-d- -f1)
118 if emulator
-accel-check; then
121 emulator @
$arch -no-window $accel &
123 adb push
$CARGO_TARGET_DIR/$TARGET/debug
/libc-test
/data
/local
/tmp
/libc-test
124 adb shell
/data
/local
/tmp
/libc-test
2>&1 |
tee /tmp
/out
125 grep "^PASSED .* tests" /tmp
/out
129 rustc
-O .
/ci
/ios
/deploy_and_run_on_ios_simulator.rs
130 .
/deploy_and_run_on_ios_simulator
$CARGO_TARGET_DIR/$TARGET/debug
/libc-test
134 rustc
-O .
/ci
/ios
/deploy_and_run_on_ios_simulator.rs
135 .
/deploy_and_run_on_ios_simulator
$CARGO_TARGET_DIR/$TARGET/debug
/libc-test
138 arm-unknown-linux-gnueabihf
)
139 qemu-arm
-L /usr
/arm-linux-gnueabihf
$CARGO_TARGET_DIR/$TARGET/debug
/libc-test
142 mips-unknown-linux-gnu
)
143 qemu-mips
-L /usr
/mips-linux-gnu
$CARGO_TARGET_DIR/$TARGET/debug
/libc-test
146 mips64-unknown-linux-gnuabi64
)
147 qemu-mips64
-L /usr
/mips64-linux-gnuabi64
$CARGO_TARGET_DIR/$TARGET/debug
/libc-test
150 mips-unknown-linux-musl
)
151 qemu-mips
-L /toolchain
/staging_dir
/toolchain-mips_34kc_gcc-5.3
.0_musl-1.1
.15 \
152 $CARGO_TARGET_DIR/$TARGET/debug
/libc-test
155 mipsel-unknown-linux-musl
)
156 qemu-mipsel
-L /toolchain
$CARGO_TARGET_DIR/$TARGET/debug
/libc-test
159 powerpc-unknown-linux-gnu
)
160 qemu-ppc
-L /usr
/powerpc-linux-gnu
$CARGO_TARGET_DIR/$TARGET/debug
/libc-test
163 powerpc64-unknown-linux-gnu
)
164 qemu-ppc64
-L /usr
/powerpc64-linux-gnu
$CARGO_TARGET_DIR/$TARGET/debug
/libc-test
167 aarch64-unknown-linux-gnu
)
168 qemu-aarch64
-L /usr
/aarch64-linux-gnu
/ $CARGO_TARGET_DIR/$TARGET/debug
/libc-test
171 s390x-unknown-linux-gnu
)
172 # TODO: in theory we should execute this, but qemu segfaults immediately :(
173 # qemu-s390x -L /usr/s390x-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/libc-test
177 rumprun-bake hw_virtio
/tmp
/libc-test.img
$CARGO_TARGET_DIR/$TARGET/debug
/libc-test
178 qemu-system-x86_64
-nographic -vga none
-m 64 \
179 -kernel /tmp
/libc-test.img
2>&1 |
tee /tmp
/out
&
181 grep "^PASSED .* tests" /tmp
/out
185 $CARGO_TARGET_DIR/$TARGET/debug
/libc-test