jenkins-bot has submitted this change and it was merged. Change subject: Compile texvccheck in testsuite ......................................................................
Compile texvccheck in testsuite The MathInputCheckTexvcTest class expects texvccheck to be available via $wgMathTexvcCheckExecutable. It is not always set or the executable might not have been compiled (for example on Wikimedia CI Jenkins). This patch still attempt to use $wgMathTexvcCheckExecutable, if it is not found it will attempt to compile it using the Makefile in the texvccheck subfolder of the repository. That should work whenever someone has ocaml installed, the resulting binary is used to set $wgMathTexvcCheckExecutable. Bug: 61090 Change-Id: I9ea4b87de6e2827aad83961712f66ecbef2639de --- M tests/MathInputCheckTexvcTest.php 1 file changed, 33 insertions(+), 2 deletions(-) Approvals: Physikerwelt: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/MathInputCheckTexvcTest.php b/tests/MathInputCheckTexvcTest.php index c72fc9e..067dd4a 100644 --- a/tests/MathInputCheckTexvcTest.php +++ b/tests/MathInputCheckTexvcTest.php @@ -11,6 +11,33 @@ protected $BadObject; protected $GoodObject; + protected static $hasTexvccheck; + protected static $texvccheckPath; + + public static function setUpBeforeClass() { + global $wgMathTexvcCheckExecutable; + + if ( is_executable( $wgMathTexvcCheckExecutable ) ) { + wfDebugLog( __CLASS__, " using build in texvccheck from " + . "\$wgMathTexvcCheckExecutable = $wgMathTexvcCheckExecutable" ); + # Using build-in + self::$hasTexvccheck = true; + self::$texvccheckPath = $wgMathTexvcCheckExecutable; + } else { + # Attempt to compile + wfDebugLog( __CLASS__, " compiling texvccheck..." ); + $cmd = 'cd ' . dirname(__DIR__) . '/texvccheck; make --always-make 2>&1'; + $stdout = wfShellExec( $cmd, $retval ); + if ( $retval === 0 ) { + self::$hasTexvccheck = true; + self::$texvccheckPath = dirname( __DIR__ ) . '/texvccheck/texvccheck'; + wfDebugLog( __CLASS__, ' compiled texvccheck at ' . self::$texvccheckPath ); + } else { + wfDebugLog( __CLASS__, ' ocaml not available or compilation of texvccheck failed' ); + } + } + } + /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. @@ -20,8 +47,12 @@ parent::setUp(); $this->BadObject = new MathInputCheckTexvc( '\newcommand{\text{do evil things}}' ); $this->GoodObject = new MathInputCheckTexvc( '\sin\left(\frac12x\right)' ); - if ( !is_executable( $wgMathTexvcCheckExecutable ) ) { - $this->markTestSkipped( "No texvc installed on server" ); + + if ( ! self::$hasTexvccheck ) { + $this->markTestSkipped( "No texvccheck installed on server" ); + } else { + $this->setMwGlobals( 'wgMathTexvcCheckExecutable', + self::$texvccheckPath ); } } -- To view, visit https://gerrit.wikimedia.org/r/114154 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9ea4b87de6e2827aad83961712f66ecbef2639de Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Hashar <has...@free.fr> Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org> Gerrit-Reviewer: GWicke <gwi...@wikimedia.org> Gerrit-Reviewer: Hashar <has...@free.fr> Gerrit-Reviewer: Physikerwelt <w...@physikerwelt.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits