2
2
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
# SPDX-License-Identifier: Apache-2.0 OR MIT
4
4
5
- # Deliberately not enabling this, since we expect a failure currently and are failing based on 'grep' later
6
- # set -eu
5
+ set -eu
7
6
8
7
# Test for platform
9
8
PLATFORM=$( uname -sp)
10
- if [[ $PLATFORM == " Linux x86_64" ]]; then
9
+ if [[ $PLATFORM == " Linux x86_64" ]]
10
+ then
11
11
TARGET=" x86_64-unknown-linux-gnu"
12
- elif [[ $PLATFORM == " Darwin i386" ]]; then
12
+ elif [[ $PLATFORM == " Darwin i386" ]]
13
+ then
13
14
TARGET=" x86_64-apple-darwin"
14
15
else
15
16
echo
@@ -27,40 +28,24 @@ echo "Starting RMC codegen for the Rust standard library..."
27
28
echo
28
29
29
30
cd /tmp
30
- if [ -d StdLibTest ]; then rm -rf StdLibTest; fi
31
- cargo new StdLibTest
32
- cd StdLibTest
31
+ if [ -d std_lib_test ]
32
+ then
33
+ rm -rf std_lib_test
34
+ fi
35
+ cargo new std_lib_test --lib
36
+ cd std_lib_test
33
37
34
38
# Check that we have the nighly toolchain, which is required for -Z build-std
35
39
if ! rustup toolchain list | grep -q nightly; then
36
40
echo " Installing nightly toolchain"
37
41
rustup toolchain install nightly
38
42
fi
39
43
40
- STD_LIB_LOG=" /tmp/StdLibTest/log.txt"
41
-
42
44
echo " Starting cargo build with RMC"
43
45
export RUSTC_LOG=error
44
46
export RUSTFLAGS=$( ${SCRIPT_DIR} /rmc-rustc --rmc-flags)
45
47
export RUSTC=$( ${SCRIPT_DIR} /rmc-rustc --rmc-path)
46
- cargo +nightly build -Z build-std --target $TARGET 2>&1 \
47
- | tee $STD_LIB_LOG
48
-
49
- # For now, we expect a linker error, but no modules should fail with a compiler
50
- # panic.
51
- #
52
- # With https://github.com/model-checking/rmc/issues/109, this check can be
53
- # removed to just allow the success of the previous line to determine the
54
- # success of this script (with no $STD_LIB_LOG needed)
55
-
56
- # TODO: this check is insufficient if the failure is before codegen
57
- # https://github.com/model-checking/rmc/issues/375
58
- if grep -q " error: internal compiler error: unexpected panic" $STD_LIB_LOG ; then
59
- echo
60
- echo " Panic on building standard library"
61
- echo
62
- exit 1
63
- fi
48
+ cargo +nightly build -Z build-std --lib --target $TARGET
64
49
65
50
echo
66
51
echo " Finished RMC codegen for the Rust standard library successfully..."
0 commit comments