Skip to content

Commit ea0e4ee

Browse files
committed
Use workspaces in this repo
Also cache on appveyor to speed up builds.
1 parent 9497f19 commit ea0e4ee

File tree

9 files changed

+43
-160
lines changed

9 files changed

+43
-160
lines changed

libc-test/Cargo.lock renamed to Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ other common platform libraries.
1616
[features]
1717
default = ["use_std"]
1818
use_std = []
19+
20+
[workspace]
21+
members = ["libc-test", "libc-test/generate-files"]

appveyor.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ build: false
1919
test_script:
2020
- cargo test
2121
- cargo run --manifest-path libc-test/Cargo.toml
22+
23+
cache:
24+
- target
25+
- C:\Users\appveyor\.cargo\registry

ci/docker/i686-unknown-linux-musl/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
1818
make CROSS_COMPILE= install -j4 && \
1919
cd .. && \
2020
rm -rf musl-1.1.15
21-
ENV PATH=$PATH:/musl-i686/bin:/rust/bin
21+
ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
22+
CC_i686_unknown_linux_musl=musl-gcc

ci/docker/x86_64-unknown-freebsd/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ USER root
33

44
RUN apt-get update
55
RUN apt-get install -y --no-install-recommends \
6-
qemu qemu-kvm kmod cpu-checker
6+
qemu genext2fs
77

88
ENTRYPOINT ["sh"]
99

ci/docker/x86_64-unknown-openbsd/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FROM ubuntu:16.10
22

33
RUN apt-get update
44
RUN apt-get install -y --no-install-recommends \
5-
gcc libc6-dev qemu qemu-kvm curl ca-certificates kmod cpu-checker
5+
gcc libc6-dev qemu curl ca-certificates \
6+
genext2fs
67
ENV PATH=$PATH:/rust/bin \
78
QEMU=2016-09-07/openbsd-6.0-without-pkgs.qcow2

ci/run-docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ run() {
77
echo $1
88
docker build -t libc ci/docker/$1
99
docker run \
10+
--rm \
1011
-v `rustc --print sysroot`:/rust:ro \
1112
-v `pwd`:/checkout:ro \
1213
-e CARGO_TARGET_DIR=/tmp/target \

ci/run.sh

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ if [ "$QEMU" != "" ]; then
3737
# This will have a `run.sh` script will which use the artifacts inside to run
3838
# on the host.
3939
rm -f $tmpdir/libc-test.img
40-
dd if=/dev/null of=$tmpdir/libc-test.img bs=1M seek=50
41-
mkfs.ext2 -F $tmpdir/libc-test.img
42-
rm -rf $tmpdir/mount
4340
mkdir $tmpdir/mount
44-
mount -t ext2 -o loop $tmpdir/libc-test.img $tmpdir/mount
4541

4642
# If we have a cross compiler, then we just do the standard rigamarole of
4743
# cross-compiling an executable and then the script to run just executes the
@@ -53,14 +49,14 @@ if [ "$QEMU" != "" ]; then
5349
# QEMU would time out basically everywhere.
5450
if [ "$CAN_CROSS" = "1" ]; then
5551
cargo build --manifest-path libc-test/Cargo.toml --target $TARGET
56-
cp $CARGO_TARGET_DIR/$TARGET/debug/libc-test $tmpdir/mount/
52+
cp target/$TARGET/debug/libc-test $tmpdir/mount/
5753
echo 'exec $1/libc-test' > $tmpdir/mount/run.sh
5854
else
5955
rm -rf $tmpdir/generated
6056
mkdir -p $tmpdir/generated
6157
cargo build --manifest-path libc-test/generate-files/Cargo.toml
6258
(cd libc-test && TARGET=$TARGET OUT_DIR=$tmpdir/generated SKIP_COMPILE=1 \
63-
$CARGO_TARGET_DIR/debug/generate-files)
59+
../target/debug/generate-files)
6460

6561
# Copy this folder into the mounted image, the `run.sh` entry point, and
6662
# overwrite the standard libc-test Cargo.toml with the overlay one which will
@@ -74,31 +70,27 @@ if [ "$QEMU" != "" ]; then
7470
cp libc-test/run-generated-Cargo.toml $tmpdir/mount/libc/libc-test/Cargo.toml
7571
fi
7672

77-
umount $tmpdir/mount
78-
79-
# If we can use kvm, prefer that, otherwise just fall back to user-space
80-
# emulation.
81-
if kvm-ok; then
82-
program=kvm
83-
else
84-
program=qemu-system-x86_64
85-
fi
73+
du -sh $tmpdir/mount
74+
genext2fs \
75+
--root $tmpdir/mount \
76+
--size-in-blocks 100000 \
77+
$tmpdir/libc-test.img
8678

8779
# Pass -snapshot to prevent tampering with the disk images, this helps when
8880
# running this script in development. The two drives are then passed next,
8981
# first is the OS and second is the one we just made. Next the network is
9082
# configured to work (I'm not entirely sure how), and then finally we turn off
9183
# graphics and redirect the serial console output to out.log.
92-
$program \
84+
qemu-system-x86_64 \
9385
-m 1024 \
9486
-snapshot \
9587
-drive if=virtio,file=$tmpdir/$qemufile \
9688
-drive if=virtio,file=$tmpdir/libc-test.img \
9789
-net nic,model=virtio \
9890
-net user \
9991
-nographic \
100-
-vga none 2>&1 | tee $CARGO_TARGET_DIR/out.log
101-
exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
92+
-vga none 2>&1 | tee target/out.log
93+
exec grep "^PASSED .* tests" target/out.log
10294
fi
10395

10496
case "$TARGET" in
@@ -116,49 +108,53 @@ case "$TARGET" in
116108
arm-linux-androideabi)
117109
emulator @arm-21 -no-window &
118110
adb wait-for-device
119-
adb push $CARGO_TARGET_DIR/$TARGET/debug/libc-test /data/libc-test
111+
adb push target/$TARGET/debug/libc-test /data/libc-test
120112
adb shell /data/libc-test 2>&1 | tee /tmp/out
121113
grep "^PASSED .* tests" /tmp/out
122114
;;
123115

124116
arm-unknown-linux-gnueabihf)
125-
qemu-arm -L /usr/arm-linux-gnueabihf $CARGO_TARGET_DIR/$TARGET/debug/libc-test
117+
qemu-arm -L /usr/arm-linux-gnueabihf target/$TARGET/debug/libc-test
126118
;;
127119

128120
mips-unknown-linux-gnu)
129-
qemu-mips -L /usr/mips-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test
121+
qemu-mips -L /usr/mips-linux-gnu target/$TARGET/debug/libc-test
130122
;;
131123

132124
mips-unknown-linux-musl)
133125
qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15 \
134-
$CARGO_TARGET_DIR/$TARGET/debug/libc-test
126+
target/$TARGET/debug/libc-test
135127
;;
136128

137129
mipsel-unknown-linux-musl)
138-
qemu-mipsel -L /toolchain $CARGO_TARGET_DIR/$TARGET/debug/libc-test
130+
qemu-mipsel -L /toolchain target/$TARGET/debug/libc-test
139131
;;
140132

141133
powerpc-unknown-linux-gnu)
142-
qemu-ppc -L /usr/powerpc-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test
134+
qemu-ppc -L /usr/powerpc-linux-gnu target/$TARGET/debug/libc-test
143135
;;
144136

145137
powerpc64-unknown-linux-gnu)
146-
qemu-ppc64 -L /usr/powerpc64-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test
138+
qemu-ppc64 -L /usr/powerpc64-linux-gnu target/$TARGET/debug/libc-test
147139
;;
148140

149141
aarch64-unknown-linux-gnu)
150-
qemu-aarch64 -L /usr/aarch64-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/libc-test
142+
qemu-aarch64 -L /usr/aarch64-linux-gnu/ target/$TARGET/debug/libc-test
151143
;;
152144

153145
*-rumprun-netbsd)
154-
rumprun-bake hw_virtio /tmp/libc-test.img $CARGO_TARGET_DIR/$TARGET/debug/libc-test
146+
rumprun-bake hw_virtio /tmp/libc-test.img target/$TARGET/debug/libc-test
155147
qemu-system-x86_64 -nographic -vga none -m 64 \
156148
-kernel /tmp/libc-test.img 2>&1 | tee /tmp/out &
157149
sleep 5
158150
grep "^PASSED .* tests" /tmp/out
159151
;;
160152

161153
*)
162-
$CARGO_TARGET_DIR/$TARGET/debug/libc-test
154+
if [ "$CARGO_TARGET_DIR" == "" ]; then
155+
target/$TARGET/debug/libc-test
156+
else
157+
$CARGO_TARGET_DIR/$TARGET/debug/libc-test
158+
fi
163159
;;
164160
esac

libc-test/generate-files/Cargo.lock

Lines changed: 0 additions & 123 deletions
This file was deleted.

0 commit comments

Comments
 (0)