aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjahoti <jahoti@tilde.team>2021-12-03 00:00:00 +0000
committerjahoti <jahoti@tilde.team>2021-12-03 00:00:00 +0000
commit201fcfadc87e21b0b10ecf3a2a9d114328a65ffb (patch)
treebf387ec1fd0ed046009c72a524c3de4c560ecb84
parentc39c6b9efc91a268cffa9eec397a79f7e294bf0a (diff)
downloadbrowser-extension-jahoti.tar.gz
browser-extension-jahoti.zip
Support tests outside the source directoryjahoti
Explicitly use certs in the build directory, and tests in the source
-rw-r--r--Makefile.in12
-rwxr-xr-xconfigure1
-rw-r--r--test/misc_constants.py5
3 files changed, 8 insertions, 10 deletions
diff --git a/Makefile.in b/Makefile.in
index e49415d..1e3cdbd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -61,6 +61,7 @@ uninstall:
# testing-related targets
test/certs/:
+ [ -d test ] || mkdir test
mkdir $@
test/certs/%.key: | test/certs/
@@ -71,17 +72,10 @@ test/certs/rootCA.pem: test/certs/rootCA.key
-subj "/CN=Haketilo Test"
test: test/certs/rootCA.pem test/certs/site.key
- @echo 'Warning: if the build directory is not the same'
- @echo 'as the source directory, THIS WILL NOT WORK.'
- MOZ_HEADLESS=whatever $(PYTEST)
+ MOZ_HEADLESS=whatever $(PYTEST) "$(srcdir)"
test-environment: test/certs/rootCA.pem test/certs/site.key
- @echo 'Warning: if the build directory is not the same'
- @echo 'as the source directory, THIS WILL NOT WORK.'
- $(PYTHON) -m test
-
-hello: record.conf
- @ls
+ PYTHONPATH="$(srcdir)" $(PYTHON) -m test
# helper targets
clean mostlyclean:
diff --git a/configure b/configure
index 6ac41c9..d6b51bb 100755
--- a/configure
+++ b/configure
@@ -119,6 +119,7 @@ rm -f testing.conf
[ "x$TEST_BROWSER" != x ] && echo BINARY "$TEST_BROWSER" >> testing.conf
[ "x$TEST_PROFILE" != x ] && echo TEST_PROFILE "$TEST_PROFILE" >> testing.conf
[ "x$TEST_PORT" != x ] && echo TEST_PORT "$TEST_PORT" >> testing.conf
+[ "$srcdir" != '.' ] && echo CERT_DIR "$PWD/test/certs" >> testing.conf
# Prepare and run write_makefile.sh (as config.status)
if [ ! -e config.status ]; then
diff --git a/test/misc_constants.py b/test/misc_constants.py
index 3494293..add875d 100644
--- a/test/misc_constants.py
+++ b/test/misc_constants.py
@@ -43,7 +43,7 @@ default_cert_dir = here / 'certs'
# Use user-specified values instead where available
try:
- with open(str(here.parent / 'testing.conf')) as f:
+ with open('testing.conf') as f:
option = f.readline()
while ' ' in option:
key, value = option[:-1].split(' ', maxsplit=1)
@@ -56,6 +56,9 @@ try:
elif key == 'TEST_PORT':
default_proxy_port = int(value)
+ elif key == 'CERT_DIR':
+ default_cert_dir = Path(value)
+
else:
raise KeyError(key)