[tor-commits] [bridgedb/develop] Add setup-tests script and use it in .travis.yml.

isis at torproject.org isis at torproject.org
Sat Mar 28 02:50:58 UTC 2015


commit 0344fe89ff12ebe6c0cb8737ba14d28419eba221
Author: Isis Lovecruft <isis at torproject.org>
Date:   Thu Mar 26 09:39:01 2015 +0000

    Add setup-tests script and use it in .travis.yml.
---
 .travis.yml         |   17 +----------------
 scripts/setup-tests |   29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 7cda131..b058d71 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -64,22 +64,7 @@ install:
 
 # Start a BridgeDB instance before running the tests:
 before_script:
-  - mkdir run
-  - cp -R -t run bridgedb.conf captchas .gnupg
-  # Add '127.0.0.1' to EMAIL_DOMAINS in bridgedb.conf. This should ONLY be
-  # done on testing servers, never on production servers.
-  - sed -r -i -e "s/(EMAIL_DOMAINS)(.*)(])/\1\2\, '127.0.0.1']/" run/bridgedb.conf
-  # Change EMAIL_SMTP_PORT to 2525:
-  - sed -r -i -e "s/(EMAIL_SMTP_PORT = )([1-9]{2,5})/\12525/" run/bridgedb.conf
-  # Enable plaintext HTTP distribution, otherwise the mechanize-based tests in
-  # test_https.py will fail with CERTIFICATE_VERIFY_FAILED because urllib2
-  # won't recognize our self-signed certificate:
-  - sed -r -i -e "s/(HTTP_UNENCRYPTED_BIND_IP = )(None)/\1'127.0.0.1'/" run/bridgedb.conf
-  - sed -r -i -e "s/(HTTP_UNENCRYPTED_PORT = )(None)/\16788/" run/bridgedb.conf
-  - leekspin -n 100
-  - cp -t run networkstatus-bridges cached-extrainfo* bridge-descriptors
-  - ./scripts/make-ssl-cert
-  - cp -t run privkey.pem cert
+  - ./scripts/setup-tests
   - bridgedb -r run &
 
 script:
diff --git a/scripts/setup-tests b/scripts/setup-tests
new file mode 100755
index 0000000..e82576f
--- /dev/null
+++ b/scripts/setup-tests
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+set -x --
+
+THIS_SCRIPT="$(realpath $0)"
+HERE="$THIS_SCRIPT"
+
+while [ "${HERE##*/}" != "bridgedb" ] ; do HERE="${HERE%/*}" ; done
+
+THERE="$HERE"
+echo "Found top-level repo directory: $THERE"
+cd $THERE
+
+mkdir run
+cp -R -t run bridgedb.conf captchas .gnupg
+# Add '127.0.0.1' to EMAIL_DOMAINS in bridgedb.conf. This should ONLY be
+# done on testing servers, never on production servers.
+sed -r -i -e "s/(EMAIL_DOMAINS)(.*)(])/\1\2\, '127.0.0.1']/" run/bridgedb.conf
+# Change EMAIL_SMTP_PORT to 2525:
+sed -r -i -e "s/(EMAIL_SMTP_PORT = )([1-9]{2,5})/\12525/" run/bridgedb.conf
+# Enable plaintext HTTP distribution, otherwise the mechanize-based tests in
+# test_https.py will fail with CERTIFICATE_VERIFY_FAILED because urllib2
+# won't recognize our self-signed certificate:
+sed -r -i -e "s/(HTTP_UNENCRYPTED_BIND_IP = )(None)/\1'127.0.0.1'/" run/bridgedb.conf
+sed -r -i -e "s/(HTTP_UNENCRYPTED_PORT = )(None)/\16788/" run/bridgedb.conf
+leekspin -n 100
+cp -t run networkstatus-bridges cached-extrainfo* bridge-descriptors
+./scripts/make-ssl-cert
+cp -t run privkey.pem cert





More information about the tor-commits mailing list