summaryrefslogtreecommitdiff
path: root/tests/assert-install.sh
blob: f2696bc53b90c8b7120459145a195123683f6b3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
set -eu

. tools/lib.sh

D="$(mkdtemp)"
trap 'rm -rf "$D"' EXIT


make -s DESTDIR="$D" install
PATH="$D/usr/bin:$PATH"
NODE_PATH="$D/usr/lib/node:$NODE_PATH"

{
	printf 'Assert that the papo(3js) library is installed correctly...'
	node -e 'require("papo");'
	printf ' OK.\n'

	printf 'Assert that the papo(1) command is installed correctly...'
	papo -V | grep -q '^papo '
	printf ' OK.\n'

	make -s DESTDIR="$D" uninstall
	printf 'Assert that the papo(1) command is installed correctly...'
	if [ "$(find "$D" -not -type d | wc -l)" != 0 ]; then
		printf ' ERR.\n'
		cat <<-EOF
			Leftover files not removed by "make uninstall":

			$(find "$D" -not -type d)
		EOF
		exit 1
	fi
	printf ' OK.\n'
} >&2