]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - regression-tests.dnsdist/runtests
rec: ensure correct service user on debian
[thirdparty/pdns.git] / regression-tests.dnsdist / runtests
index f6803132a32e6789c75a1308cea9bc8bd41aec23..1f6de2ea1c0f1504063781cec1186d8c742814a9 100755 (executable)
@@ -1,18 +1,43 @@
 #!/usr/bin/env bash
 set -e
 
-PYTHON=${PYTHON:-python2}
-
 if [ ! -d .venv ]; then
-       virtualenv -p ${PYTHON} .venv
+  if [ -z "$PYTHON" ]; then
+    if [ ! -z "$(python3 --version | egrep '^Python 3.[6789]' 2>/dev/null)" ]; then
+      # found python3.6 or better
+      PYTHON=python3
+    else
+      # until we have better Linux distribution detection.
+      PYTHON=python2
+    fi
+  fi
+
+  virtualenv -p ${PYTHON} .venv
 fi
 . .venv/bin/activate
 python -V
+
+if [ `uname -s` == Darwin ]
+then
+  if [ ! -e /usr/local/opt/curl-openssl ]
+  then
+    echo Please run: brew install curl-openssl, and try again
+    exit 1
+  else
+    export PYCURL_CURL_CONFIG=/usr/local/opt/curl-openssl/bin/curl-config
+    export LDFLAGS=-L/usr/local/opt/openssl/lib
+    export CPPFLAGS=-I/usr/local/opt/openssl/include
+  fi
+fi
 pip install -r requirements.txt
+
 protoc -I=../pdns/ --python_out=. ../pdns/dnsmessage.proto
+protoc -I=../pdns/ --python_out=. ../pdns/dnstap.proto
+
+mkdir -p configs
 
 if [ -z "${DNSDISTBIN}" ]; then
-    DNSDISTBIN=$(ls ../pdns/dnsdistdist/dnsdist-*/dnsdist)
+  DNSDISTBIN=$(ls ../pdns/dnsdistdist/dnsdist-*/dnsdist)
 fi
 export DNSDISTBIN
 
@@ -21,15 +46,24 @@ if [ "${PDNS_DEBUG}" = "YES" ]; then
   set -x
 fi
 
+rm -f ca.key ca.pem ca.srl server.csr server.key server.pem server.chain
+rm -rf configs/*
+
 # Generate a new CA
 openssl req -new -x509 -days 1 -extensions v3_ca -keyout ca.key -out ca.pem -nodes -config configCA.conf
 # Generate a new server certificate request
 openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr -config configServer.conf
 # Sign the server cert
-openssl x509 -req -days 1 -CA ca.pem -CAkey ca.key -CAcreateserial -in server.csr -out server.pem
+openssl x509 -req -days 1 -CA ca.pem -CAkey ca.key -CAcreateserial -in server.csr -out server.pem -extfile configServer.conf -extensions v3_req
 # Generate a chain
-cat server.pem ca.pem >> server.chain
+cat server.pem ca.pem > server.chain
 
-nosetests --with-xunit $@
+if ! nosetests --with-xunit $@; then
+    for log in configs/*.log; do
+        echo "=== ${log} ==="
+        cat "${log}"
+    done
+    false
+fi
 
 rm ca.key ca.pem ca.srl server.csr server.key server.pem server.chain