Project

General

Profile

« Previous | Next » 

Revision 3fcff338

Added by jahoti almost 2 years ago

Make testing configurable

Add options to configure in accordance with #97

View differences:

configure
15 15

  
16 16
set -e
17 17

  
18
# Set BROWSERPATH appropriately
19
set_browserpath () {
20
    BROWSERPATH="${BINARY:-$(realpath "$1")}"
21
}
22

  
23
BINARY="$BROWSER_BIN"
18 24
BROWSERPATH=''
19 25
SRCDIR=''
20 26
TARGET=''
......
22 28
# Parse command line options
23 29
while [ "x$1" != x ]; do
24 30
    case "$1" in
25
	--srcdir=*)         SRCDIR="$(echo "$1" | cut -c 10-)";;
26
	--srcdir)                           SRCDIR="$2"; shift;;
27
	"DESTDIR"=*)        DESTDIR="$(echo "$1" | cut -c 9-)";;
28
	"UPDATE_URL"=*) UPDATE_URL="$(echo "$1" | cut -c 12-)";;
29
	--host=*)            TARGET="$(echo "$1" | cut -c 8-)";;
30
	--host)                             TARGET="$2"; shift;;
31
	--srcdir=*)           SRCDIR="$(echo "$1" | cut -c 10-)";;
32
	--srcdir)                             SRCDIR="$2"; shift;;
33
	BROWSER_BIN=*)        BINARY="$(echo "$1" | cut -c 13-)";;
34
	DESTDIR=*)            DESTDIR="$(echo "$1" | cut -c 9-)";;
35
	PYTEST=*)              PYTEST="$(echo "$1" | cut -c 8-)";;
36
	PYTHON=*)              PYTHON="$(echo "$1" | cut -c 8-)";;
37
	TEST_PORT=*)       TEST_PORT="$(echo "$1" | cut -c 11-)";;
38
	TEST_PROFILE=*) TEST_PROFILE="$(echo "$1" | cut -c 14-)";;
39
	UPDATE_URL=*)     UPDATE_URL="$(echo "$1" | cut -c 12-)";;
40
	--host=*)              TARGET="$(echo "$1" | cut -c 8-)";;
41
	--host)                               TARGET="$2"; shift;;
31 42

  
32 43
	# browsers
33 44
	chromium | chrome | google-chrome | mozilla |\
34 45
	firefox | librewolf | icecat | iceweasel | abrowser |\
35
	iceweasel-uxp | tor-browser)                 TARGET=$1;;
36
	*)                         echo Ignoring option "'$1'";;
46
	iceweasel-uxp | tor-browser)                   TARGET=$1;;
47
	*)                           echo Ignoring option "'$1'";;
37 48
    esac
38 49
    shift
39 50
done
......
59 70
if [ "x$TARGET" = x ]; then
60 71
    echo Detecting target automatically.
61 72
    if [ -h /etc/alternatives/x-www-browser ]; then
62
	BROWSERPATH="$(realpath /etc/alternatives/x-www-browser)"
63
	TARGET="$(/etc/alternatives/x-www-browser --version 2> /dev/null |
73
	set_browserpath /etc/alternatives/x-www-browser
74
	TARGET="$("$BROWSERPATH" --version 2> /dev/null |
64 75
	    tail -n 1 | awk '{ print $1 }' | tr [A-Z] [a-z])"
65 76
    else
66 77
    	echo Warning: could not find target automatically. >&2
67 78
    	echo Some make rules may fail. >&2
68 79
    fi
69 80
else
70
    BROWSERPATH="$(realpath "$(which $TARGET)")"
81
    set_browserpath "$(which $TARGET)"
71 82
fi
72 83

  
73 84
# Check and standardize target
......
98 109
echo srcdir = "$SRCDIR" > record.conf
99 110
echo default_target = "$TARGET" >> record.conf
100 111
echo DESTDIR = "$DESTDIR" >> record.conf
112
echo PYTEST = "${PYTEST:-$(which pytest)}" >> record.conf
113
echo PYTHON = "${PYTHON:-$(which python3)}" >> record.conf
101 114
echo UPDATE_URL = "$UPDATE_URL" >> record.conf
102 115

  
116
# (Re-)write testing.conf
117
rm -f testing.conf
118
[ "x$BINARY" != x ] && echo BINARY "$BINARY" >> testing.conf
119
[ "x$TEST_PROFILE" != x ] && echo TEST_PROFILE "$TEST_PROFILE" >> testing.conf
120
[ "x$TEST_PORT" != x ] && echo TEST_PORT "$TEST_PORT" >> testing.conf
103 121

  
104 122
# Prepare and run write_makefile.sh (as config.status)
105 123
if [ ! -e config.status ]; then

Also available in: Unified diff