@@ -16,104 +16,126 @@ target="$1"
16
16
# It's assume that all images, when run with two disks, will run the `run.sh`
17
17
# script from the second which we place inside.
18
18
if [ " $QEMU " != " " ]; then
19
- tmpdir=/tmp/qemu-img-creation
20
- mkdir -p " ${tmpdir} "
19
+ tmpdir=/tmp/qemu-img-creation
20
+ mkdir -p " ${tmpdir} "
21
21
22
- if [ -z " ${QEMU#* .gz} " ]; then
23
- # image is .gz : download and uncompress it
24
- qemufile=" $( echo " ${QEMU% .gz} " | sed ' s/\//__/g' ) "
25
- if [ ! -f " ${tmpdir} /${qemufile} " ]; then
26
- curl --retry 5 " ${mirrors_url} /${QEMU} " | \
27
- gunzip -d > " ${tmpdir} /${qemufile} "
22
+ if [ -z " ${QEMU#* .gz} " ]; then
23
+ # image is .gz : download and uncompress it
24
+ qemufile=" $( echo " ${QEMU% .gz} " | sed ' s/\//__/g' ) "
25
+ if [ ! -f " ${tmpdir} /${qemufile} " ]; then
26
+ curl --retry 5 " ${mirrors_url} /${QEMU} " |
27
+ gunzip -d > " ${tmpdir} /${qemufile} "
28
+ fi
29
+ elif [ -z " ${QEMU#* .xz} " ]; then
30
+ # image is .xz : download and uncompress it
31
+ qemufile=" $( echo " ${QEMU% .xz} " | sed ' s/\//__/g' ) "
32
+ if [ ! -f " ${tmpdir} /${qemufile} " ]; then
33
+ curl --retry 5 " ${mirrors_url} /${QEMU} " |
34
+ unxz > " ${tmpdir} /${qemufile} "
35
+ fi
36
+ else
37
+ # plain qcow2 image: just download it
38
+ qemufile=" $( echo " ${QEMU} " | sed ' s/\//__/g' ) "
39
+ if [ ! -f " ${tmpdir} /${qemufile} " ]; then
40
+ curl --retry 5 " ${mirrors_url} /${QEMU} " >
41
+ " ${tmpdir} /${qemufile} "
42
+ fi
28
43
fi
29
- elif [ -z " ${QEMU#* .xz} " ]; then
30
- # image is .xz : download and uncompress it
31
- qemufile=" $( echo " ${QEMU% .xz} " | sed ' s/\//__/g' ) "
32
- if [ ! -f " ${tmpdir} /${qemufile} " ]; then
33
- curl --retry 5 " ${mirrors_url} /${QEMU} " | \
34
- unxz > " ${tmpdir} /${qemufile} "
35
- fi
36
- else
37
- # plain qcow2 image: just download it
38
- qemufile=" $( echo " ${QEMU} " | sed ' s/\//__/g' ) "
39
- if [ ! -f " ${tmpdir} /${qemufile} " ]; then
40
- curl --retry 5 " ${mirrors_url} /${QEMU} " \
41
- > " ${tmpdir} /${qemufile} "
42
- fi
43
- fi
44
44
45
- # Create a mount a fresh new filesystem image that we'll later pass to QEMU.
46
- # This will have a `run.sh` script will which use the artifacts inside to run
47
- # on the host.
48
- rm -f " ${tmpdir} /libc-test.img"
49
- mkdir " ${tmpdir} /mount"
45
+ # Create a mount a fresh new filesystem image that we'll later pass to QEMU.
46
+ # This will have a `run.sh` script will which use the artifacts inside to run
47
+ # on the host.
48
+ rm -f " ${tmpdir} /libc-test.img"
49
+ mkdir " ${tmpdir} /mount"
50
50
51
- # Do the standard rigamarole of cross-compiling an executable and then the
52
- # script to run just executes the binary.
53
- cargo build \
54
- --manifest-path libc-test/Cargo.toml \
55
- --target " $target " \
56
- --test main ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
57
- rm " ${CARGO_TARGET_DIR} /${target} " /debug/main-* .d
58
- cp " ${CARGO_TARGET_DIR} /${target} " /debug/main-* " ${tmpdir} " /mount/libc-test
59
- # shellcheck disable=SC2016
60
- echo ' exec $1/libc-test' > " ${tmpdir} /mount/run.sh"
51
+ # Do the standard rigamarole of cross-compiling an executable and then the
52
+ # script to run just executes the binary.
53
+ cargo build \
54
+ --manifest-path libc-test/Cargo.toml \
55
+ --target " $target " \
56
+ --test main ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
57
+ rm " ${CARGO_TARGET_DIR} /${target} " /debug/main-* .d
58
+ cp " ${CARGO_TARGET_DIR} /${target} " /debug/main-* " ${tmpdir} " /mount/libc-test
59
+ # shellcheck disable=SC2016
60
+ echo ' exec $1/libc-test' > " ${tmpdir} /mount/run.sh"
61
61
62
- du -sh " ${tmpdir} /mount"
63
- genext2fs \
64
- --root " ${tmpdir} /mount" \
65
- --size-in-blocks 100000 \
66
- " ${tmpdir} /libc-test.img"
62
+ du -sh " ${tmpdir} /mount"
63
+ genext2fs \
64
+ --root " ${tmpdir} /mount" \
65
+ --size-in-blocks 100000 \
66
+ " ${tmpdir} /libc-test.img"
67
67
68
- # Pass -snapshot to prevent tampering with the disk images, this helps when
69
- # running this script in development. The two drives are then passed next,
70
- # first is the OS and second is the one we just made. Next the network is
71
- # configured to work (I'm not entirely sure how), and then finally we turn off
72
- # graphics and redirect the serial console output to out.log.
73
- qemu-system-x86_64 \
74
- -m 1024 \
75
- -snapshot \
76
- -drive if=virtio,file=" ${tmpdir} /${qemufile} " \
77
- -drive if=virtio,file=" ${tmpdir} /libc-test.img" \
78
- -net nic,model=virtio \
79
- -net user \
80
- -nographic \
81
- -vga none 2>&1 | tee " ${CARGO_TARGET_DIR} /out.log"
82
- exec grep -E " ^(PASSED)|(test result: ok)" " ${CARGO_TARGET_DIR} /out.log"
68
+ # Pass -snapshot to prevent tampering with the disk images, this helps when
69
+ # running this script in development. The two drives are then passed next,
70
+ # first is the OS and second is the one we just made. Next the network is
71
+ # configured to work (I'm not entirely sure how), and then finally we turn off
72
+ # graphics and redirect the serial console output to out.log.
73
+ qemu-system-x86_64 \
74
+ -m 1024 \
75
+ -snapshot \
76
+ -drive if=virtio,file=" ${tmpdir} /${qemufile} " \
77
+ -drive if=virtio,file=" ${tmpdir} /libc-test.img" \
78
+ -net nic,model=virtio \
79
+ -net user \
80
+ -nographic \
81
+ -vga none 2>&1 | tee " ${CARGO_TARGET_DIR} /out.log"
82
+ exec grep -E " ^(PASSED)|(test result: ok)" " ${CARGO_TARGET_DIR} /out.log"
83
83
fi
84
84
85
85
if [ " $target " = " s390x-unknown-linux-gnu" ]; then
86
- # FIXME: s390x-unknown-linux-gnu often fails to test due to timeout,
87
- # so we retry this N times.
88
- N=5
89
- n=0
90
- passed=0
91
- until [ $n -ge $N ]
92
- do
93
- if [ " $passed " = " 0" ]; then
94
- if cargo test --no-default-features --manifest-path libc-test/Cargo.toml --target " $target " ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" } ; then
95
- passed=$(( passed+ 1 ))
96
- continue
97
- fi
98
- elif [ " $passed " = " 1" ]; then
99
- if cargo test --manifest-path libc-test/Cargo.toml --target " $target " ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" } ; then
100
- passed=$(( passed+ 1 ))
101
- continue
102
- fi
103
- elif [ " $passed " = " 2" ]; then
104
- if cargo test --features extra_traits --manifest-path libc-test/Cargo.toml --target " $target " ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" } ; then
105
- break
106
- fi
107
- fi
108
- n=$(( n+ 1 ))
109
- sleep 1
110
- done
86
+ # FIXME: s390x-unknown-linux-gnu often fails to test due to timeout,
87
+ # so we retry this N times.
88
+ N=5
89
+ n=0
90
+ passed=0
91
+ until [ $n -ge $N ]; do
92
+ if [ " $passed " = " 0" ]; then
93
+ if cargo test \
94
+ --no-default-features \
95
+ --manifest-path libc-test/Cargo.toml \
96
+ --target " $target " \
97
+ ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
98
+ then
99
+ passed=$(( passed+ 1 ))
100
+ continue
101
+ fi
102
+ elif [ " $passed " = " 1" ]; then
103
+ if cargo test \
104
+ --manifest-path libc-test/Cargo.toml \
105
+ --target " $target " \
106
+ ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
107
+ then
108
+ passed=$(( passed+ 1 ))
109
+ continue
110
+ fi
111
+ elif [ " $passed " = " 2" ]; then
112
+ if cargo test \
113
+ --features extra_traits \
114
+ --manifest-path libc-test/Cargo.toml \
115
+ --target " $target " \
116
+ ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
117
+ then
118
+ break
119
+ fi
120
+ fi
121
+ n=$(( n+ 1 ))
122
+ sleep 1
123
+ done
111
124
else
112
- cargo test --no-default-features --manifest-path libc-test/Cargo.toml \
113
- --target " $target " ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
125
+ cargo test \
126
+ --no-default-features \
127
+ --manifest-path libc-test/Cargo.toml \
128
+ --target " $target " \
129
+ ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
114
130
115
- cargo test --manifest-path libc-test/Cargo.toml --target " $target " ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
131
+ cargo test \
132
+ --manifest-path libc-test/Cargo.toml \
133
+ --target " $target " \
134
+ ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
116
135
117
- RUST_BACKTRACE=1 cargo test --features extra_traits --manifest-path libc-test/Cargo.toml \
118
- --target " $target " ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
136
+ RUST_BACKTRACE=1 cargo test \
137
+ --features extra_traits \
138
+ --manifest-path libc-test/Cargo.toml \
139
+ --target " $target " \
140
+ ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
119
141
fi
0 commit comments