aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rust/check-rustc
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-04-12 03:03:35 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-04-12 14:14:01 +0200
commite6ca0848df365e43b19ecff2cca63e2ac4aebc76 (patch)
treee9d434dff3e084f98e0733c0c77e2e50d53b10ee /testing/rust/check-rustc
parente2345d3156f0f713623ab9265a931e780b2e9958 (diff)
downloadaports-e6ca0848df365e43b19ecff2cca63e2ac4aebc76.tar.bz2
aports-e6ca0848df365e43b19ecff2cca63e2ac4aebc76.tar.xz
testing/rust: fix multiple issues with static/dynamic linking
Diffstat (limited to 'testing/rust/check-rustc')
-rwxr-xr-xtesting/rust/check-rustc20
1 files changed, 20 insertions, 0 deletions
diff --git a/testing/rust/check-rustc b/testing/rust/check-rustc
index 867666e503..3a375005f2 100755
--- a/testing/rust/check-rustc
+++ b/testing/rust/check-rustc
@@ -34,6 +34,12 @@ assert_ok() {
"$1" || fail "$1 exited with status $?"
}
+assert_panic() {
+ local status=0
+ "$1" || status=$? && [ "$status" = 101 ] \
+ || fail "$1 exited with status $status, but expected 101"
+}
+
assert_pie() {
readelf -d "$1" | grep -Fw FLAGS_1 | grep -Fqw PIE || {
fail "$1 is not a PIE executable!"
@@ -83,4 +89,18 @@ assert_static hello_world
assert_pie hello_world
rm -f hello_world
+
+cat >> panic.rs <<-EOF
+ fn main() {
+ panic!("This should panic");
+ }
+EOF
+
+_rustc -C target-feature=-crt-static panic.rs
+assert_panic ./panic
+
+_rustc -C target-feature=+crt-static panic.rs
+assert_panic ./panic
+
+
[ "$failed" -eq 0 ] || die "$failed assertion(s) has failed"