jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/369676 )

Change subject: Assert MediaWiki does not generate error logs
......................................................................


Assert MediaWiki does not generate error logs

After the test command has run, assert that MediaWiki did not emit any
logs.

Update:

mediawiki-core-qunit-selenium-jessie
mediawiki-extensions-hhvm-jessie
mediawiki-extensions-php55-trusty
mediawiki-extensions-php70-jessie
mediawiki-extensions-qunit-jessie
mediawiki-phpunit-hhvm-composer-jessie
mediawiki-phpunit-hhvm-jessie
mediawiki-phpunit-php55-trusty
mediawiki-phpunit-php70-jessie

Bug: T50002
Change-Id: Ic8e06c4581da3441d4a5a7262583ed2b4fe7606a
---
A jjb/assert-no-mediawiki-errors.bash
M jjb/mediawiki.yaml
2 files changed, 114 insertions(+), 0 deletions(-)

Approvals:
  Thcipriani: Looks good to me, approved
  Krinkle: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/jjb/assert-no-mediawiki-errors.bash 
b/jjb/assert-no-mediawiki-errors.bash
new file mode 100644
index 0000000..8afe04a
--- /dev/null
+++ b/jjb/assert-no-mediawiki-errors.bash
@@ -0,0 +1,102 @@
+set -eu
+
+# The set of log files checked come from integration/jenkins
+# mediawiki/conf.d/00_set_debug_log.php
+#
+# Namely:
+#  $wgDBerrorLog = "$wmgMwLogDir/mw-dberror.log";
+#  $wgDebugLogGroups['exception'] = "$wmgMwLogDir/mw-exception.log";
+#  $wgDebugLogGroups['error'] = "$wmgMwLogDir/mw-error.log";
+#
+ERROR_FILES=( mw-dberror.log mw-exception.log mw-error.log )
+echo "Asserting empty files: ${ERROR_FILES[*]}"
+
+# The minimum RELx_xxx version for which we want to run this test
+REL_MAJOR=1
+REL_MINOR=30
+
+# The minimum wmf/1.x.0-wmf.xx version for which we want to run this test
+WMF_MAJOR=30
+WMF_MINOR=12
+
+# A valid version is a version > wmf/1.WMF_MAJOR.0-wmf.WMF_MINOR
+valid_wmf_version() {
+       local version major minor
+       version="$1"
+
+       major=${version%.*.*}
+       major=${major##*.}
+
+       minor=${version##*.}
+
+       if (( major == WMF_MAJOR )) && (( minor >= WMF_MINOR )); then
+               return 0
+       elif (( major > WMF_MAJOR )); then
+               return 0
+       else
+               return 1
+       fi
+}
+
+# A valid version is a version > REL{REL_MAJOR}_{REL_MINOR}
+valid_rel_version() {
+       local version major minor
+       version="$1"
+       major=${version%%_*}
+       minor=${version##*_}
+
+       if (( major == REL_MAJOR )) && (( minor >= REL_MINOR )); then
+               return 0
+       elif (( major > REL_MAJOR )); then
+               return 0
+       else
+               return 1
+       fi
+}
+
+# Ensures that this is a ZUUL_BRANCH for which we want this to be a valid test
+valid_version() {
+       local version wmf_version rel_version
+
+       version="$1"
+
+       # Master is valid
+       if [[ "$version" == "master" ]]; then
+               return 0
+       fi
+
+       # Is this is a wmf/something
+       wmf_version="${version#wmf\/}"
+       if (( ${#version} != ${#wmf_version} )); then
+               valid_wmf_version "$wmf_version" && return 0
+       fi
+
+       # Is this is a RELsomething
+       rel_version="${version#REL}"
+       if (( ${#version} != ${#rel_version} )); then
+               valid_rel_version "$rel_version" && return 0
+       fi
+
+       # Unidentified version: invalid
+       return 1
+}
+
+if ! valid_version "$ZUUL_BRANCH"; then
+       printf 'Test not for branch: %s\n' "$ZUUL_BRANCH"
+       exit 0
+fi
+
+log_files="$( cd "$WORKSPACE/log"; ls "${ERROR_FILES[@]}" 2> /dev/null || :)"
+if [ ! "$log_files" ]; then
+       echo "No error files. GOOD"
+       exit 0
+fi
+
+echo "Dumping file(s) $log_files"
+set +e
+       # Use `grep --color . file list` to ensure that file names appear next
+       # to log messages
+       (cd "$WORKSPACE/log"; grep --color . "${ERROR_FILES[@]}" 2> /dev/null)
+set -e
+echo -e "MediaWiki emitted some errors. Check output above."
+exit 1
diff --git a/jjb/mediawiki.yaml b/jjb/mediawiki.yaml
index 00a4eee..150706c 100644
--- a/jjb/mediawiki.yaml
+++ b/jjb/mediawiki.yaml
@@ -60,6 +60,7 @@
 
             ./node_modules/.bin/grunt webdriver:test
         fi
+     - assert-no-mediawiki-errors
     publishers:
      - castor-save
      - archive-log-dir
@@ -153,6 +154,7 @@
      - mw-apply-settings
      - mw-fetch-composer-dev
      - shell: "/srv/deployment/integration/slave-scripts/bin/mw-phpunit.sh"
+     - assert-no-mediawiki-errors
     publishers:
      - phpunit-junit-2
      - archive-log-dir
@@ -185,6 +187,7 @@
      - mw-install-mysql
      - mw-apply-settings
      - shell: "/srv/deployment/integration/slave-scripts/bin/mw-phpunit.sh"
+     - assert-no-mediawiki-errors
     publishers:
      - phpunit-junit-2
      - archive-log-dir
@@ -207,6 +210,13 @@
                 https://gerrit.wikimedia.org/r/p \
                 "$ZUUL_PROJECT"
          fi
+
+- builder:
+    name: assert-no-mediawiki-errors
+    builders:
+        - shell:
+            !include-raw:
+                - assert-no-mediawiki-errors.bash
 
 - job-template:
     name: 'mediawiki-extensions-{phpflavor}-{image}'
@@ -232,6 +242,7 @@
              - composer-test-mwextension
      - mw-fetch-composer-dev
      - mw-run-phpunit-allexts
+     - assert-no-mediawiki-errors
     publishers:
      - junit:
         results: 'log/junit*.xml'
@@ -252,6 +263,7 @@
      - castor-load
      - prepare-mediawiki-zuul-project
      - qunit-karma
+     - assert-no-mediawiki-errors
     publishers:
      - castor-save
      - archive-log-dir

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic8e06c4581da3441d4a5a7262583ed2b4fe7606a
Gerrit-PatchSet: 2
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Hashar <has...@free.fr>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com>
Gerrit-Reviewer: Thcipriani <tcipri...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to