aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rust/check-rustc
diff options
context:
space:
mode:
Diffstat (limited to 'testing/rust/check-rustc')
-rwxr-xr-xtesting/rust/check-rustc28
1 files changed, 13 insertions, 15 deletions
diff --git a/testing/rust/check-rustc b/testing/rust/check-rustc
index 015730dc0e..867666e503 100755
--- a/testing/rust/check-rustc
+++ b/testing/rust/check-rustc
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: set ts=4:
set -eu
RUSTC="$1"
@@ -21,17 +22,12 @@ fail() {
failed=$(( failed + 1 ))
}
-# Checks if the given file is a statically linked binary.
-is_static() {
- ! readelf -l "$1" | grep -Fq INTERP \
- && ! readelf -d "$1" | grep -Fq NEEDED
-}
-
assert_dynamic() {
- test -f "$1" && ! is_static "$1" || {
- fail "$1 is not a dynamic executable!"
- readelf -ld "$1"
- }
+ readelf -l "$1" | grep -Fqw INTERP \
+ && readelf -d "$1" | grep -Fqw NEEDED || {
+ fail "$1 is not a dynamic executable!"
+ readelf -ld "$1"
+ }
}
assert_ok() {
@@ -39,17 +35,19 @@ assert_ok() {
}
assert_pie() {
- readelf -d "$1" | grep FLAGS_1 | grep -q PIE || {
+ readelf -d "$1" | grep -Fw FLAGS_1 | grep -Fqw PIE || {
fail "$1 is not a PIE executable!"
readelf -d "$1"
}
}
assert_static() {
- test -f "$1" && is_static "$1" || {
- fail "$1 is not a static executable!"
- readelf -ld "$1"
- }
+ test -f "$1" \
+ && ! readelf -l "$1" | grep -Fqw INTERP \
+ && ! readelf -d "$1" | grep -Fqw NEEDED || {
+ fail "$1 is not a static executable!"
+ readelf -ld "$1"
+ }
}