Project

General

Profile

« Previous | Next » 

Revision 5a002642

Added by jahoti almost 2 years ago

  • ID 5a0026423b61915fd2f9544456b2634505a952b1
  • Parent 6d819aae

Allow testing behavior to be customized

Adds PYTEST, PYTHON, BROWSER_BIN, TEST_PORT, and TEST_PROFILE variables
to configure.

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)"
73
	set_browserpath /etc/alternatives/x-www-browser
63 74
	TARGET="$(/etc/alternatives/x-www-browser --version 2> /dev/null |
64 75
	    tail -n 1 | awk '{ print $1 }' | tr [A-Z] [a-z])"
65 76
    else
......
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
# Write test/config.py (if testing is enabled)
117
echo from .misc_constants import '*' > test/config.py
118
echo default_firefox_binary = "'${BINARY:-/usr/lib/icecat/icecat}'" >> test/config.py
119
echo default_clean_profile_dir = "'$TEST_PROFILE'" or \
120
	default_clean_profile_dir >> test/config.py
121
echo default_proxy_port = "${TEST_PORT:-1337}" >> test/config.py
122

  
103 123

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

Also available in: Unified diff