QChris has submitted this change and it was merged.

Change subject: Use WORKSPACE variable to determine $__CODE_BASE in fallback
......................................................................


Use WORKSPACE variable to determine $__CODE_BASE in fallback

It was hard to run the tests locally on a non-wmf machine, as
$__CODE_BASE defaulted to "/a/...". Hence, we now generalize the
Jenkins case and build $__CODE_BASE from the WORKSPACE environment
variable.  Thereby, it should be possible to rune the tests an
non-gallium Jenkins slaves.


Change-Id: I2ba2c3e4ba829dd36017aa6ab9c303536e445662
---
M squids/t/03-regression-wrong-domains-actually-ipv6.t
M squids/t/CommonConfig.pm
2 files changed, 13 insertions(+), 5 deletions(-)

Approvals:
  QChris: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/squids/t/03-regression-wrong-domains-actually-ipv6.t 
b/squids/t/03-regression-wrong-domains-actually-ipv6.t
index bef8d01..3e1bb81 100644
--- a/squids/t/03-regression-wrong-domains-actually-ipv6.t
+++ b/squids/t/03-regression-wrong-domains-actually-ipv6.t
@@ -95,6 +95,10 @@
 
 our $__DATA_BASE;
 
+# Making sure $__DATA_BASE identification worked (i.e.: it is a
+# directory), as otherwise creating files will fail badly and not give
+# much hints what wehn wrong.
+ok(-d $__DATA_BASE, '$__DATA_BASE points to directory');
 
 ################################
 # Creating input for test
diff --git a/squids/t/CommonConfig.pm b/squids/t/CommonConfig.pm
index 367e5e9..bcede39 100644
--- a/squids/t/CommonConfig.pm
+++ b/squids/t/CommonConfig.pm
@@ -16,10 +16,7 @@
 chomp $hostname;
 
 our $__CODE_BASE;
-if($hostname eq "gallium") {
-  # Running on Jenkins
-  $__CODE_BASE = $ENV{WORKSPACE}."/squids";
-} elsif($hostname eq "stat1" && $ENV{HOME} eq "/home/ezachte") {
+if($hostname eq "stat1" && $ENV{HOME} eq "/home/ezachte") {
   # Running on Erik's account on stat1
   $__CODE_BASE = "/home/ezachte/wikistats/squids";
 } elsif($hostname eq "stat1" && $ENV{HOME} eq "/home/diederik") {
@@ -29,7 +26,14 @@
   $__CODE_BASE = "/home/travis/build/wsdookadr/analytics-wikistats/squids";
 } else {
   # Anywhere else
-  $__CODE_BASE = "/a/wikistats_git/squids";
+
+  # If WORKSPACE seems to point to a checkout, we use it (Allowing for
+  # easier local testing, and use through Jenkins). Otherwise we fall
+  # back to the usual wmf setup.
+  $__CODE_BASE = $ENV{WORKSPACE}."/squids";
+  if(! -d $__CODE_BASE) {
+    $__CODE_BASE = "/a/wikistats_git/squids";
+  }
 };
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/102299
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2ba2c3e4ba829dd36017aa6ab9c303536e445662
Gerrit-PatchSet: 4
Gerrit-Project: analytics/wikistats
Gerrit-Branch: master
Gerrit-Owner: QChris <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: Erik Zachte <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: QChris <[email protected]>
Gerrit-Reviewer: Stefan.petrea <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to