File: runner

package info (click to toggle)
node-sqlite3 4.0.6%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,268 kB
  • sloc: sql: 10,062; cpp: 1,878; sh: 245; makefile: 74; python: 8
file content (65 lines) | stat: -rwxr-xr-x 1,191 bytes parent folder | download
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh

set -e

if [ ! -e package.json ]; then
	echo "No package.json found" >&2
	exit 1
fi

PKG=sqlite3
LOCAL="0"

if test "$1" = "src"; then
	shift 1
	LOCAL=1
fi

TESTFILES=`ls -d test*`
if [ -e debian/tests/pkg-js/files ]; then
	TESTFILES=`cat debian/tests/pkg-js/files`
fi

COMMAND=$@
if test "$COMMAND" = "require"; then
	echo "Test: require"
	if test "$LOCAL" = "0"; then
		node -e "require('$PKG')"
	else
		node -e "require('.')"
	fi
else
	TEST=debian/tests/pkg-js/test
	if test "$LOCAL" = "0"; then
		TEMP=${ADTTMP:-${TMPDIR:-/tmp}}
		TDIR=$(mktemp -d $TEMP/smokeXXXXXX)
		PDIR=`pwd`
		if test "$TESTFILES" != ""; then
			echo "# Copy test files"
			cp -a $TESTFILES $TDIR
		fi
		if [ -e debian/tests/pkg-js ]; then
			mkdir -p $TDIR/debian/tests/
			cp -a debian/tests/pkg-js $TDIR/debian/tests/
		fi
		cd $TDIR
		for i in /usr/lib/nodejs/$PKG/*; do
			ln -s $i
		done
	fi
	if test "$COMMAND" = ""; then
		if [ -e $TEST ]; then
			echo "Launch $TEST with sh"
			sh $TEST
		else
			echo "# /!\ Missing debian/tests/pkg-js/test file, skipping"
		fi
	else
		echo "# Launch command: $COMMAND"
		$COMMAND
	fi
fi
if test "$TDIR" != ""; then
	echo "# Cleaning tmp dir"
	rm -rf $TDIR
fi