summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-11-10 10:26:53 -0300
committerEuAndreh <eu@euandre.org>2023-11-10 10:57:56 -0300
commitdc563de9378993f666f27bef715bc425a7711f45 (patch)
tree77ee21bb4b444e1f79a0c6fceed6b297a5dfb9c8 /tools
parenttests/assert-deps.sh: Enforce Makefile is always up-to-date (diff)
downloadpapod-dc563de9378993f666f27bef715bc425a7711f45.tar.gz
papod-dc563de9378993f666f27bef715bc425a7711f45.tar.xz
tests/assert-install.sh: Always to enforce correct installation
Also in this change: - now we call ln(1) in the "install" target without using the -r "relative" flag, as it isn't POSIX; - add `+` as a prefix to the "assert-tests" command, so we tell sub-make calls to also run things in parallel. In this case, the "make DESTDIR=... install" calls; - use the implicit `index.js` entrypoint and do away completly with `package.json`; - change from `import` to `require` as Node.js ESM modules don't support `$NODE_PATH`[0]: "NODE_PATH is not part of resolving import specifiers. Please use symlinks if this behavior is desired." 🤦; The parallel sub-make behaviour isn't available in current specification of make (POSIX issue 7) but is included in the upcoming[1] version 8: > If a rule invokes a sub-make either via the MAKE macro or via a > command line that begins with '+', the sub-make is the same > implementation as the make that invoked the sub-make, and the −j > option is passed to the sub-make via the MAKEFLAGS environment > variable with the same maxjobs value and is not overridden by a > maxjobs value from another source (even if it has the same value), the > sub-make shall use the same token pool as its invoking make rather > than create a new token pool. [0]: https://nodejs.org/api/esm.html#no-node_path [1]: https://www.opengroup.org/austin/restricted/202x-d3/202x_d3.pdf
Diffstat (limited to 'tools')
-rw-r--r--tools/lib.sh33
-rwxr-xr-xtools/manpages.sh2
2 files changed, 34 insertions, 1 deletions
diff --git a/tools/lib.sh b/tools/lib.sh
new file mode 100644
index 0000000..9d183f9
--- /dev/null
+++ b/tools/lib.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ printf 'Missing %s.\n\n' "$2" >&2
+ cat <<-'EOF'
+ usage >&2
+ exit 2
+ EOF
+ fi
+}
+
+uuid() {
+ od -xN20 /dev/urandom |
+ head -n1 |
+ awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}'
+}
+
+tmpname() {
+ echo "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)"
+}
+
+mkstemp() {
+ name="$(tmpname)"
+ touch "$name"
+ echo "$name"
+}
+
+mkdtemp() {
+ name="$(tmpname)"
+ mkdir "$name"
+ echo "$name"
+}
diff --git a/tools/manpages.sh b/tools/manpages.sh
index 959b1c2..755ff77 100755
--- a/tools/manpages.sh
+++ b/tools/manpages.sh
@@ -1,7 +1,7 @@
#!/bin/sh
set -eu
-. tests/lib.sh
+. tools/lib.sh
usage() {