summaryrefslogtreecommitdiff
path: root/tests/tst-verbose-runner.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tst-verbose-runner.sh')
-rwxr-xr-xtests/tst-verbose-runner.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/tst-verbose-runner.sh b/tests/tst-verbose-runner.sh
new file mode 100755
index 0000000..e1362e4
--- /dev/null
+++ b/tests/tst-verbose-runner.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+set -eu
+
+: "${CPU_AS:?}" "${CPU_LD:?}" "${TEST_SRCDIR:?}"
+
+TMP=${TMPDIR:-/tmp}/libmcpu-verbose-$$
+mkdir -p "$TMP"
+trap 'rm -rf "$TMP"' EXIT HUP INT TERM
+
+src="$TEST_SRCDIR/fixtures/radd-pi.s"
+
+# Production default is quiet: successful assembly and linking write no
+# developer summary unless -v/--verbose is requested.
+out=`"$CPU_AS" -o "$TMP/main.o" "$src"`
+[ -z "$out" ]
+
+out=`"$CPU_LD" --stack-size=512 --no-heap -o "$TMP/main" "$TMP/main.o"`
+[ -z "$out" ]
+
+# Both spellings enable the existing developer summaries without changing
+# their content or the generated object/executable semantics.
+out=`"$CPU_AS" -v -o "$TMP/main-v.o" "$src"`
+case "$out" in
+ "MELF ET_REL: "*" -> $TMP/main-v.o") ;;
+ *) echo "unexpected mcpu-as -v output: $out" >&2; exit 1 ;;
+esac
+
+out=`"$CPU_AS" --verbose -o "$TMP/main-long.o" "$src"`
+case "$out" in
+ "MELF ET_REL: "*" -> $TMP/main-long.o") ;;
+ *) echo "unexpected mcpu-as --verbose output: $out" >&2; exit 1 ;;
+esac
+
+out=`"$CPU_LD" -v --stack-size=512 --no-heap \
+ -o "$TMP/main-v" "$TMP/main-v.o"`
+case "$out" in
+ "MELF ABI1 ET_EXEC: "*" -> $TMP/main-v") ;;
+ *) echo "unexpected mcpu-ld -v output: $out" >&2; exit 1 ;;
+esac
+
+out=`"$CPU_LD" --verbose --dynamic --stack-size=512 --no-heap \
+ -o "$TMP/main-dyn" "$TMP/main-long.o"`
+case "$out" in
+ "MELF ABI3 ET_EXEC: "*" -> $TMP/main-dyn") ;;
+ *) echo "unexpected mcpu-ld --verbose dynamic output: $out" >&2; exit 1 ;;
+esac
+
+out=`"$CPU_LD" -v -r -o "$TMP/main-partial.o" "$TMP/main-v.o"`
+case "$out" in
+ "MELF ET_REL partial link: "*" -> $TMP/main-partial.o") ;;
+ *) echo "unexpected mcpu-ld -v -r output: $out" >&2; exit 1 ;;
+esac
+
+cat > "$TMP/shared.s" <<'EOS'
+.global shared_value
+.text
+shared_value:
+ RET
+EOS
+"$CPU_AS" -o "$TMP/shared.o" "$TMP/shared.s"
+out=`"$CPU_LD" --verbose --shared --soname=libverbose.so.1 \
+ -o "$TMP/libverbose.so" "$TMP/shared.o"`
+case "$out" in
+ "MELF ABI3 ET_DYN: "*" -> $TMP/libverbose.so") ;;
+ *) echo "unexpected mcpu-ld --verbose shared output: $out" >&2; exit 1 ;;
+esac
+
+exit 0