Skip to content

Commit b3f376d

Browse files
celinvaltedinski
authored andcommitted
Fix std lib regression script (rust-lang#109 and rust-lang#375) (rust-lang#593)
Create a target library instead of a binary.
1 parent e65792d commit b3f376d

File tree

1 file changed

+12
-27
lines changed

1 file changed

+12
-27
lines changed

scripts/std-lib-regression.sh

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
# SPDX-License-Identifier: Apache-2.0 OR MIT
44

5-
# Deliberately not enabling this, since we expect a failure currently and are failing based on 'grep' later
6-
#set -eu
5+
set -eu
76

87
# Test for platform
98
PLATFORM=$(uname -sp)
10-
if [[ $PLATFORM == "Linux x86_64" ]]; then
9+
if [[ $PLATFORM == "Linux x86_64" ]]
10+
then
1111
TARGET="x86_64-unknown-linux-gnu"
12-
elif [[ $PLATFORM == "Darwin i386" ]]; then
12+
elif [[ $PLATFORM == "Darwin i386" ]]
13+
then
1314
TARGET="x86_64-apple-darwin"
1415
else
1516
echo
@@ -27,40 +28,24 @@ echo "Starting RMC codegen for the Rust standard library..."
2728
echo
2829

2930
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
3337

3438
# Check that we have the nighly toolchain, which is required for -Z build-std
3539
if ! rustup toolchain list | grep -q nightly; then
3640
echo "Installing nightly toolchain"
3741
rustup toolchain install nightly
3842
fi
3943

40-
STD_LIB_LOG="/tmp/StdLibTest/log.txt"
41-
4244
echo "Starting cargo build with RMC"
4345
export RUSTC_LOG=error
4446
export RUSTFLAGS=$(${SCRIPT_DIR}/rmc-rustc --rmc-flags)
4547
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
6449

6550
echo
6651
echo "Finished RMC codegen for the Rust standard library successfully..."

0 commit comments

Comments
 (0)