Skip to content

Commit 2f06a79

Browse files
committed
Run CI tests using cargo
This works by specifying a "runner" for actually executing the binary. This doesn't apply to the Android or NetBSD runs because there isn't a simple binary that just runs the executable.
1 parent 362134d commit 2f06a79

File tree

1 file changed

+26
-27
lines changed

1 file changed

+26
-27
lines changed

ci/run.sh

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ case "$TARGET" in
9090
fi
9191
emulator @$arch -no-window $accel &
9292
adb wait-for-device
93+
# TODO: replace these steps with a single program so that it can be used as a runner for cargo test
9394
adb push $CARGO_TARGET_DIR/$TARGET/debug/main-* /data/local/tmp/main
9495
adb shell /data/local/tmp/main 2>&1 | tee /tmp/out
9596
grep "^PASSED .* tests" /tmp/out
@@ -100,65 +101,64 @@ case "$TARGET" in
100101

101102
i386-apple-ios)
102103
rustc -O ./ci/ios/deploy_and_run_on_ios_simulator.rs
103-
./deploy_and_run_on_ios_simulator $CARGO_TARGET_DIR/$TARGET/debug/main-*
104-
./deploy_and_run_on_ios_simulator $CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
104+
export CARGO_TARGET_I386_APPLE_IOS_RUNNER="./deploy_and_run_on_ios_simulator"
105+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
105106
;;
106107

107108
x86_64-apple-ios)
108109
rustc -O ./ci/ios/deploy_and_run_on_ios_simulator.rs
109-
./deploy_and_run_on_ios_simulator $CARGO_TARGET_DIR/$TARGET/debug/main-*
110-
./deploy_and_run_on_ios_simulator $CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
110+
export CARGO_TARGET_X86_64_APPLE_IOS_RUNNER="./deploy_and_run_on_ios_simulator"
111+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
111112
;;
112113

113114
arm-unknown-linux-gnueabihf)
114-
qemu-arm -L /usr/arm-linux-gnueabihf $CARGO_TARGET_DIR/$TARGET/debug/main-*
115-
qemu-arm -L /usr/arm-linux-gnueabihf $CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
115+
export CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf"
116+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
116117
;;
117118

118119
mips-unknown-linux-gnu)
119-
qemu-mips -L /usr/mips-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/main-*
120-
qemu-mips -L /usr/mips-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
120+
export CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu"
121+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
121122
;;
122123

123124
mips64-unknown-linux-gnuabi64)
124-
qemu-mips64 -L /usr/mips64-linux-gnuabi64 $CARGO_TARGET_DIR/$TARGET/debug/main-*
125-
qemu-mips64 -L /usr/mips64-linux-gnuabi64 $CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
125+
export CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64"
126+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
126127
;;
127128

128129
mips-unknown-linux-musl)
129-
qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15 \
130-
$CARGO_TARGET_DIR/$TARGET/debug/main-*
131-
qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15 \
132-
$CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
130+
export CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15"
131+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
133132
;;
134133

135134
mipsel-unknown-linux-musl)
136-
qemu-mipsel -L /toolchain $CARGO_TARGET_DIR/$TARGET/debug/main-*
137-
qemu-mipsel -L /toolchain $CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
138-
;;
135+
export CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain"
136+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
137+
;;
139138

140139
powerpc-unknown-linux-gnu)
141-
qemu-ppc -L /usr/powerpc-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/main-*
142-
qemu-ppc -L /usr/powerpc-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
140+
export CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc -L /usr/powerpc-linux-gnu"
141+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
143142
;;
144143

145144
powerpc64-unknown-linux-gnu)
146-
qemu-ppc64 -L /usr/powerpc64-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/main-*
147-
qemu-ppc64 -L /usr/powerpc64-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
145+
export CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu"
146+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
148147
;;
149148

150149
aarch64-unknown-linux-gnu)
151-
qemu-aarch64 -L /usr/aarch64-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/main-*
152-
qemu-aarch64 -L /usr/aarch64-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
150+
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu"
151+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
153152
;;
154153

155154
s390x-unknown-linux-gnu)
156155
# TODO: in theory we should execute this, but qemu segfaults immediately :(
157-
# qemu-s390x -L /usr/s390x-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/main-*
158-
# qemu-s390x -L /usr/s390x-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
156+
#export CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /usr/s390x-linux-gnu"
157+
#cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
159158
;;
160159

161160
*-rumprun-netbsd)
161+
# TODO: replace these steps with a single program so that it can be used as a runner for cargo test
162162
rumprun-bake hw_virtio /tmp/libc-test.img $CARGO_TARGET_DIR/$TARGET/debug/main-*
163163
qemu-system-x86_64 -nographic -vga none -m 64 \
164164
-kernel /tmp/libc-test.img 2>&1 | tee /tmp/out &
@@ -172,7 +172,6 @@ case "$TARGET" in
172172
;;
173173

174174
*)
175-
$CARGO_TARGET_DIR/$TARGET/debug/main-*
176-
$CARGO_TARGET_DIR/$TARGET/debug/linux_fcntl-*
175+
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
177176
;;
178177
esac

0 commit comments

Comments
 (0)