summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-11-13 09:24:34 -0300
committerEuAndreh <eu@euandre.org>2023-11-13 09:24:34 -0300
commitd0ac6ed36f42dca602e8b06375481eb1e31c368a (patch)
tree8fa6504e2daa36ba3553f980540f90776cb0ef7e
parenttests/assert-*.sh: Allow tests to run independently from "all" and from each ... (diff)
downloadpapod-d0ac6ed36f42dca602e8b06375481eb1e31c368a.tar.gz
papod-d0ac6ed36f42dca602e8b06375481eb1e31c368a.tar.xz
tests/assert-*.sh: Reuse rebuilt assets for tests
-rw-r--r--Makefile1
-rwxr-xr-xtests/assert-clean.sh7
-rwxr-xr-xtests/assert-install.sh13
-rwxr-xr-xtests/assert-uninstall.sh8
4 files changed, 7 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index 9407e22..77ed6b4 100644
--- a/Makefile
+++ b/Makefile
@@ -108,6 +108,7 @@ $(tests.js-t):
check-t: $(tests.js-t)
+tests/assert-clean.sh tests/assert-install.sh tests/assert-uninstall.sh: all
assert-tests = \
tests/assert-clean.sh \
tests/assert-deps.sh \
diff --git a/tests/assert-clean.sh b/tests/assert-clean.sh
index a3ca350..540cea6 100755
--- a/tests/assert-clean.sh
+++ b/tests/assert-clean.sh
@@ -12,16 +12,13 @@ fi
R="$(mkdtemp)"
trap 'rm -rf "$R"' EXIT
-git clone -q --depth=1 file://"$PWD" "$R"
+cp -pR ./ "$R"
cd "$R"
{
- make
- make clean
-} 1>/dev/null 2>&1
+ make -s clean
-{
printf '%s: "clean" target deletes all derived assets...' \
"$(yellow "$0")"
diff --git a/tests/assert-install.sh b/tests/assert-install.sh
index b10c037..fd1e037 100755
--- a/tests/assert-install.sh
+++ b/tests/assert-install.sh
@@ -1,26 +1,19 @@
#!/bin/sh
set -eu
-if [ ! -e .git ]; then
- echo "Not in a Git repository, skipping \"$0\"." >&2
- exit
-fi
-
-
. tools/lib.sh
D="$(mkdtemp)"
R="$(mkdtemp)"
trap 'rm -rf "$D" "$R"' EXIT
-git clone -q --depth=1 file://"$PWD" "$R"
+cp -pR ./ "$R"
cd "$R"
-PATH="$D/usr/bin:$PATH"
-NODE_PATH="$D/usr/lib/node:$NODE_PATH"
-
{
+ PATH="$D/usr/bin:$PATH"
+ NODE_PATH="$D/usr/lib/node:$NODE_PATH"
make -s DESTDIR="$D" install
printf '%s: that the papo(3js) library is installed correctly...' \
diff --git a/tests/assert-uninstall.sh b/tests/assert-uninstall.sh
index 0f85a60..247d723 100755
--- a/tests/assert-uninstall.sh
+++ b/tests/assert-uninstall.sh
@@ -1,19 +1,13 @@
#!/bin/sh
set -eu
-if [ ! -e .git ]; then
- echo "Not in a Git repository, skipping \"$0\"." >&2
- exit
-fi
-
-
. tools/lib.sh
D="$(mkdtemp)"
R="$(mkdtemp)"
trap 'rm -rf "$D" "$R"' EXIT
-git clone -q --depth=1 file://"$PWD" "$R"
+cp -pR ./ "$R"
cd "$R"