Page MenuHomePhabricator

MediaWiki tests using Tidy do not pass on HHVM
Closed, ResolvedPublic

Description

The MediaWiki core tests HtmlFormatterTest::testTransform.testTransform and TidyTest::testTidyWrapping.testTidyWrapping do not pass with HHVM. They die with:

Unable to load internal tidy class. [Called from MWTidy::internalClean in includes/parser/MWTidy.php at line 250]

The HHVM version used is the latest from apt.wikimedia.org:

HipHop VM 3.3.1 (rel)
Compiler: heads/master-0-gaab439ff2621541ec1a197976ec698be1a8bf1be
Repo schema: ef03a9ff7249bca56eabd688c45d47e836e9d387
Extension API: 20140829

And the configuration from https://gerrit.wikimedia.org/r/#/c/178806/

Example Jenkins run: https://integration.wikimedia.org/ci/job/mediawiki-phpunit-hhvm/3/testReport/

Details

Event Timeline

hashar raised the priority of this task from to Needs Triage.
hashar updated the task description. (Show Details)
hashar changed Security from none to None.
hashar added subscribers: hashar, HHVM, ori, Joe.

The package needs to be installed (sudo apt-get install hhvm-tidy) and tidy.so needs to be added to hhvm.dynamic_extensions in the config file. This is a really new config change. Before we always shelled out for running tidy.

The package is installed and configured via the puppet ::hhvm class:

integration-slave1009:~$ apt-cache policy hhvm-tidy
hhvm-tidy:
  Installed: 0.1-3
  Candidate: 0.1-3
  Version table:
 *** 0.1-3 0
       1001 http://apt.wikimedia.org/wikimedia/ trusty-wikimedia/main amd64 Packages
        100 /var/lib/dpkg/status
     0.1-1 0
       1001 http://apt.wikimedia.org/wikimedia/ trusty-wikimedia/universe amd64 Packages

$ grep dynamic_extensions /etc/hhvm/php.ini 
hhvm.dynamic_extensions[fss.so] = fss.so
hhvm.dynamic_extensions[luasandbox.so] = luasandbox.so
hhvm.dynamic_extensions[tidy.so] = tidy.so
hhvm.dynamic_extensions[wikidiff2.so] = wikidiff2.so
$

Maybe it is not loaded properly.

There's a bug in MWTidy I think. It's checking for the tidy class, but since the HHVM implementation does not provide that class and instead provides the procedural interface as explained in the if ( wfIsHHVM() ) block starting around line 260.

Change 178872 had a related patch set uploaded (by BryanDavis):
hhvm: Check for tidy function instead of class

https://gerrit.wikimedia.org/r/178872

Patch-For-Review

Change 178872 merged by jenkins-bot:
hhvm: Check for tidy function instead of class

https://gerrit.wikimedia.org/r/178872

HtmlFormatterTest.php and TidyTest.php both pass locally for me on my mw-vagrant instance now. They seem to still be failing in Jenkins however. Is the tidy.so version there possibly out of date? I have hhvm-tidy 0.1-3 installed locally.

HtmlFormatterTest.php and TidyTest.php both pass locally for me on my mw-vagrant instance now. They seem to still be failing in Jenkins however. Is the tidy.so version there possibly out of date? I have hhvm-tidy 0.1-3 installed locally.

@hashar's apt-cache policy hhvm-tidy output in T78166#837937 seems to match. The failed test I'm looking at is https://integration.wikimedia.org/ci/job/mediawiki-core-regression-hhvm-master/2908/#showFailuresLink which ran on integration-slave1006 but it has the same apt-cache policy hhvm-tidy output and shows tidy.so in /etc/hhvm/php.ini as well.

The first time the tests fails is https://integration.wikimedia.org/ci/job/mediawiki-core-regression-hhvm-master/2902/testReport/ at noon. Around that time I got a puppet change to ensure hhvm package is the latest and that instance had: 2014-12-10 11:07:25 upgrade hhvm:amd64 3.3.0+dfsg1-1+wm4 3.3.0+dfsg1-1+wm5

I noticed a change in mediawiki/core which "Simplify MWTidy" https://gerrit.wikimedia.org/r/#/c/176862/ I rebuild it and got the same failure.

But taking the commit before and rebuilding it pass TidyTest::testTidyWrapping.testTidyWrapping:
https://integration.wikimedia.org/ci/job/mediawiki-core-regression-hhvm-master/2913/testReport/

Though HtmlFormatterTest::testTransform.testTransform fails with:

HtmlFormatterTest::testTransform with data set #0 ('<img src="/foo/bar.jpg" alt="Blah"/>', '', array('<img src="/foo/bar.jpg" alt="Blah">'), Closure$HtmlFormatterTest::getHtmlData;976590306)
MWException: MWTidy::clean: error text return from HHVM tidy is not supported

:(

hashar claimed this task.

The latest change merged no more has the problems: https://integration.wikimedia.org/ci/job/mediawiki-core-regression-hhvm-master/2914/testReport/

I gave it a try with fresh core+vendor clones and running using hhvm on integration-slave1006:

$ php phpunit.php --with-phpunitdir /srv/deployment/integration/phpunit/vendor/phpunit/phpunit includes/parser/TidyTest.php
$ php phpunit.php --with-phpunitdir /srv/deployment/integration/phpunit/vendor/phpunit/phpunit includes/HtmlFormatterTest.php

Both pass.

I restarted the job and it pass as well now: https://integration.wikimedia.org/ci/job/mediawiki-phpunit-hhvm/5/testReport/

Assuming whatever transient issue happened is now fixed. Thanks Bryan.