3fc58c8fb6
These are needed to get OCaml 5 to work.
325 lines
10 KiB
Diff
325 lines
10 KiB
Diff
From d968c4858847388e515bc1ef84ff4479c18a414d Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Thu, 22 Jun 2023 10:44:10 +0100
|
|
Subject: [PATCH 12/15] tests: Replace $SRCDIR with $abs_top_srcdir
|
|
|
|
functions.sh defines $abs_top_srcdir so there's no need to use $SRCDIR
|
|
in any test scripts.
|
|
---
|
|
tests/test-cc-cpp.sh | 9 ++-------
|
|
tests/test-cc-ocaml.sh | 9 ++-------
|
|
tests/test-cc.sh | 9 ++-------
|
|
tests/test-python-exception.sh | 12 +++++-------
|
|
tests/test-python-export-list.sh | 8 +++-----
|
|
tests/test-python-export-name.sh | 8 +++-----
|
|
tests/test-python-thread-model.sh | 13 +++++--------
|
|
tests/test-read-password-interactive.sh | 2 +-
|
|
tests/test-read-password.sh | 2 +-
|
|
tests/test-shebang-cc-ocaml.sh | 3 +--
|
|
tests/test-shebang-cc.sh | 5 ++---
|
|
tests/test-shebang-perl.sh | 4 ++--
|
|
tests/test-shebang-python.sh | 4 ++--
|
|
13 files changed, 31 insertions(+), 57 deletions(-)
|
|
|
|
diff --git a/tests/test-cc-cpp.sh b/tests/test-cc-cpp.sh
|
|
index 9a4c16242..7c7bf6353 100755
|
|
--- a/tests/test-cc-cpp.sh
|
|
+++ b/tests/test-cc-cpp.sh
|
|
@@ -37,12 +37,7 @@ source ./functions.sh
|
|
set -e
|
|
set -x
|
|
|
|
-if test "$SRCDIR" = ""; then
|
|
- echo "$0: \$SRCDIR is not set"
|
|
- exit 1
|
|
-fi
|
|
-
|
|
-script=$SRCDIR/test-cc-cpp.cpp
|
|
+script=$abs_top_srcdir/tests/test-cc-cpp.cpp
|
|
if test ! -f "$script"; then
|
|
echo "$0: could not locate test-cc-cpp.cpp"
|
|
exit 1
|
|
@@ -59,6 +54,6 @@ rm -f $out
|
|
|
|
nbdkit -U - cc $script \
|
|
CC="$CXX" \
|
|
- EXTRA_CFLAGS="-I$SRCDIR/../include" \
|
|
+ EXTRA_CFLAGS="-I$abs_top_srcdir/include" \
|
|
--run 'nbdinfo --size $uri' > $out
|
|
test "$(cat $out)" -eq $((100 * 1024 * 1024))
|
|
diff --git a/tests/test-cc-ocaml.sh b/tests/test-cc-ocaml.sh
|
|
index fc1335591..db7d252cf 100755
|
|
--- a/tests/test-cc-ocaml.sh
|
|
+++ b/tests/test-cc-ocaml.sh
|
|
@@ -37,12 +37,7 @@ source ./functions.sh
|
|
set -e
|
|
set -x
|
|
|
|
-if test "$SRCDIR" = ""; then
|
|
- echo "$0: \$SRCDIR is not set"
|
|
- exit 1
|
|
-fi
|
|
-
|
|
-script=$SRCDIR/test_ocaml_plugin.ml
|
|
+script=$abs_top_srcdir/tests/test_ocaml_plugin.ml
|
|
if test ! -f "$script"; then
|
|
echo "$0: could not locate test_ocaml_plugin.ml"
|
|
exit 1
|
|
@@ -61,6 +56,6 @@ cleanup_fn rm -f $out
|
|
rm -f $out
|
|
|
|
nbdkit -v -U - cc $script a=1 b=2 c=3 d=4 \
|
|
- CC="$OCAMLOPT" CFLAGS="-output-obj -runtime-variant _pic -I $SRCDIR/../plugins/ocaml -I +unix unix.cmxa -I +threads threads.cmxa NBDKit.cmx -cclib -lnbdkitocaml" \
|
|
+ CC="$OCAMLOPT" CFLAGS="-output-obj -runtime-variant _pic -I $abs_top_srcdir/plugins/ocaml -I +unix unix.cmxa -I +threads threads.cmxa NBDKit.cmx -cclib -lnbdkitocaml" \
|
|
--run 'nbdinfo --size $uri' > $out
|
|
test "$(cat $out)" -eq $((512 * 2048))
|
|
diff --git a/tests/test-cc.sh b/tests/test-cc.sh
|
|
index 2a719d314..5214327bd 100755
|
|
--- a/tests/test-cc.sh
|
|
+++ b/tests/test-cc.sh
|
|
@@ -37,12 +37,7 @@ source ./functions.sh
|
|
set -e
|
|
set -x
|
|
|
|
-if test "$SRCDIR" = ""; then
|
|
- echo "$0: \$SRCDIR is not set"
|
|
- exit 1
|
|
-fi
|
|
-
|
|
-script=$SRCDIR/cc-shebang.c
|
|
+script=$abs_top_srcdir/tests/cc-shebang.c
|
|
if test ! -f "$script"; then
|
|
echo "$0: could not locate cc-shebang.c"
|
|
exit 1
|
|
@@ -57,6 +52,6 @@ cleanup_fn rm -f $out
|
|
rm -f $out
|
|
|
|
nbdkit -U - cc $script \
|
|
- EXTRA_CFLAGS="-I$SRCDIR/../include" \
|
|
+ EXTRA_CFLAGS="-I$abs_top_srcdir/include" \
|
|
--run 'nbdinfo --size $uri' > $out
|
|
test "$(cat $out)" -eq $((100 * 1024 * 1024))
|
|
diff --git a/tests/test-python-exception.sh b/tests/test-python-exception.sh
|
|
index a9fb146a6..54c29e66e 100755
|
|
--- a/tests/test-python-exception.sh
|
|
+++ b/tests/test-python-exception.sh
|
|
@@ -34,23 +34,21 @@ source ./functions.sh
|
|
set -e
|
|
set -x
|
|
|
|
-if test ! -d "$SRCDIR"; then
|
|
- echo "$0: could not locate python-exception.py"
|
|
- exit 1
|
|
-fi
|
|
-
|
|
skip_if_valgrind "because Python code leaks memory"
|
|
|
|
+script=$abs_top_srcdir/tests/python-exception.py
|
|
+test -f "$script"
|
|
+
|
|
output=test-python-exception.out
|
|
rm -f $output
|
|
cleanup_fn rm -f $output
|
|
|
|
-nbdkit -f -v python $SRCDIR/python-exception.py test=simple > $output 2>&1 ||:
|
|
+nbdkit -f -v python $script test=simple > $output 2>&1 ||:
|
|
cat $output
|
|
|
|
grep 'this is the test string' $output
|
|
|
|
-nbdkit -f -v python $SRCDIR/python-exception.py test=traceback > $output 2>&1 ||:
|
|
+nbdkit -f -v python $script test=traceback > $output 2>&1 ||:
|
|
cat $output
|
|
|
|
grep 'raise_error1' $output
|
|
diff --git a/tests/test-python-export-list.sh b/tests/test-python-export-list.sh
|
|
index 49ca62e49..08774b9f3 100755
|
|
--- a/tests/test-python-export-list.sh
|
|
+++ b/tests/test-python-export-list.sh
|
|
@@ -34,10 +34,8 @@ source ./functions.sh
|
|
set -e
|
|
set -x
|
|
|
|
-if test ! -d "$SRCDIR"; then
|
|
- echo "$0: could not locate python-export-list.py"
|
|
- exit 1
|
|
-fi
|
|
+script=$abs_top_srcdir/tests/python-export-list.py
|
|
+test -f "$script"
|
|
|
|
skip_if_valgrind "because Python code leaks memory"
|
|
requires_nbdinfo
|
|
@@ -52,7 +50,7 @@ files="$pid $sock $out"
|
|
rm -f $files
|
|
cleanup_fn rm -f $files
|
|
|
|
-start_nbdkit -P $pid -U $sock python $SRCDIR/python-export-list.py
|
|
+start_nbdkit -P $pid -U $sock python $script
|
|
|
|
nbdinfo --list --json nbd+unix://\?socket=$sock > $out
|
|
cat $out
|
|
diff --git a/tests/test-python-export-name.sh b/tests/test-python-export-name.sh
|
|
index 99f292d2a..7680ae1e0 100755
|
|
--- a/tests/test-python-export-name.sh
|
|
+++ b/tests/test-python-export-name.sh
|
|
@@ -34,10 +34,8 @@ source ./functions.sh
|
|
set -e
|
|
set -x
|
|
|
|
-if test ! -d "$SRCDIR"; then
|
|
- echo "$0: could not locate python-export-name.py"
|
|
- exit 1
|
|
-fi
|
|
+script=$abs_top_srcdir/tests/python-export-name.py
|
|
+test -f "$script"
|
|
|
|
skip_if_valgrind "because Python code leaks memory"
|
|
requires nbdsh --version
|
|
@@ -48,7 +46,7 @@ files="$pid $sock"
|
|
rm -f $files
|
|
cleanup_fn rm -f $files
|
|
|
|
-start_nbdkit -P $pid -U $sock python $SRCDIR/python-export-name.py
|
|
+start_nbdkit -P $pid -U $sock python $script
|
|
|
|
# Try to read back various export names from the plugin.
|
|
for e in "" "test" "/" "//" " " "/ " "?" "テスト" "-n" '\\' $'\n' "%%" \
|
|
diff --git a/tests/test-python-thread-model.sh b/tests/test-python-thread-model.sh
|
|
index 69b3d5c76..a0dea2386 100755
|
|
--- a/tests/test-python-thread-model.sh
|
|
+++ b/tests/test-python-thread-model.sh
|
|
@@ -34,22 +34,19 @@ source ./functions.sh
|
|
set -e
|
|
set -x
|
|
|
|
-SCRIPT="$SRCDIR/python-thread-model.py"
|
|
-if ! test -d "$SRCDIR" || ! test -f "$SCRIPT"; then
|
|
- echo "$0: could not locate python-thread-model.py"
|
|
- exit 1
|
|
-fi
|
|
+script="$abs_top_srcdir/tests/python-thread-model.py"
|
|
+test -f "$script"
|
|
|
|
skip_if_valgrind "because Python code leaks memory"
|
|
requires nbdsh --version
|
|
|
|
# Check the plugin is loadable.
|
|
-nbdkit python $SCRIPT --dump-plugin
|
|
+nbdkit python $script --dump-plugin
|
|
|
|
# This test only works on modern Linux (with pipe2, accept4 etc) where
|
|
# we are able to issue parallel requests. Other platforms have more
|
|
# restrictive thread models.
|
|
-requires sh -c "nbdkit python $SCRIPT --dump-plugin |
|
|
+requires sh -c "nbdkit python $script --dump-plugin |
|
|
grep '^thread_model=parallel'"
|
|
|
|
pid=test-python-thread-model.pid
|
|
@@ -58,7 +55,7 @@ files="$out $pid $sock"
|
|
rm -f $files
|
|
cleanup_fn rm -f $files
|
|
|
|
-start_nbdkit -P $pid -U $sock python $SCRIPT
|
|
+start_nbdkit -P $pid -U $sock python $script
|
|
|
|
export sock
|
|
nbdsh -c '
|
|
diff --git a/tests/test-read-password-interactive.sh b/tests/test-read-password-interactive.sh
|
|
index 7af48492b..ee345872e 100755
|
|
--- a/tests/test-read-password-interactive.sh
|
|
+++ b/tests/test-read-password-interactive.sh
|
|
@@ -36,7 +36,7 @@ set -x
|
|
|
|
# This is an executable C script using nbdkit-cc-plugin.
|
|
requires_plugin cc
|
|
-plugin=$SRCDIR/test-read-password-plugin.c
|
|
+plugin=$abs_top_srcdir/tests/test-read-password-plugin.c
|
|
requires test -x $plugin
|
|
|
|
# expect on macOS does not work for unclear reasons, skip it.
|
|
diff --git a/tests/test-read-password.sh b/tests/test-read-password.sh
|
|
index 234162bc3..d0033dceb 100755
|
|
--- a/tests/test-read-password.sh
|
|
+++ b/tests/test-read-password.sh
|
|
@@ -36,7 +36,7 @@ set -x
|
|
|
|
# This is an executable C script using nbdkit-cc-plugin.
|
|
requires_plugin cc
|
|
-plugin=$SRCDIR/test-read-password-plugin.c
|
|
+plugin=$abs_top_srcdir/tests/test-read-password-plugin.c
|
|
requires test -x $plugin
|
|
|
|
# Since we are matching on error messages.
|
|
diff --git a/tests/test-shebang-cc-ocaml.sh b/tests/test-shebang-cc-ocaml.sh
|
|
index 41e2f3db5..9eebcf07c 100755
|
|
--- a/tests/test-shebang-cc-ocaml.sh
|
|
+++ b/tests/test-shebang-cc-ocaml.sh
|
|
@@ -32,8 +32,7 @@
|
|
|
|
source ./functions.sh
|
|
|
|
-script=$SRCDIR/cc_shebang.ml
|
|
-
|
|
+script=$abs_top_srcdir/tests/cc_shebang.ml
|
|
if test ! -f "$script"; then
|
|
echo "$0: could not locate cc_shebang.ml"
|
|
exit 1
|
|
diff --git a/tests/test-shebang-cc.sh b/tests/test-shebang-cc.sh
|
|
index 6ae75abed..a5e557648 100755
|
|
--- a/tests/test-shebang-cc.sh
|
|
+++ b/tests/test-shebang-cc.sh
|
|
@@ -35,8 +35,7 @@
|
|
|
|
source ./functions.sh
|
|
|
|
-script=$SRCDIR/cc-shebang.c
|
|
-
|
|
+script=$abs_top_srcdir/tests/cc-shebang.c
|
|
if test ! -f "$script"; then
|
|
echo "$0: could not locate cc-shebang.c"
|
|
exit 1
|
|
@@ -46,7 +45,7 @@ requires_plugin cc
|
|
requires guestfish --version
|
|
|
|
$script -fv -U - \
|
|
- EXTRA_CFLAGS="-I$SRCDIR/../include" \
|
|
+ EXTRA_CFLAGS="-I$abs_top_srcdir/include" \
|
|
--run '
|
|
guestfish \
|
|
add "" protocol:nbd server:unix:$unixsocket : \
|
|
diff --git a/tests/test-shebang-perl.sh b/tests/test-shebang-perl.sh
|
|
index 5f35d75b4..65bb7a403 100755
|
|
--- a/tests/test-shebang-perl.sh
|
|
+++ b/tests/test-shebang-perl.sh
|
|
@@ -34,9 +34,9 @@ source ./functions.sh
|
|
|
|
pidfile=shebang-perl.pid
|
|
sock=$(mktemp -u /tmp/nbdkit-test-sock.XXXXXX)
|
|
-script=$SRCDIR/shebang.pl
|
|
+script=$abs_top_srcdir/tests/shebang.pl
|
|
|
|
-if test ! -d "$SRCDIR"; then
|
|
+if test ! -f "$script"; then
|
|
echo "$0: could not locate shebang.pl"
|
|
exit 1
|
|
fi
|
|
diff --git a/tests/test-shebang-python.sh b/tests/test-shebang-python.sh
|
|
index fb851de94..8674f2fa1 100755
|
|
--- a/tests/test-shebang-python.sh
|
|
+++ b/tests/test-shebang-python.sh
|
|
@@ -34,9 +34,9 @@ source ./functions.sh
|
|
|
|
pidfile=shebang-python.pid
|
|
sock=$(mktemp -u /tmp/nbdkit-test-sock.XXXXXX)
|
|
-script=$SRCDIR/shebang.py
|
|
+script=$abs_top_srcdir/tests/shebang.py
|
|
|
|
-if test ! -d "$SRCDIR"; then
|
|
+if test ! -f "$script"; then
|
|
echo "$0: could not locate shebang.py"
|
|
exit 1
|
|
fi
|
|
--
|
|
2.41.0
|
|
|