Merge ~bryce/ubuntu/+source/php-parser:sru-lp1895878-disable-tests into ubuntu/+source/php-parser:ubuntu/focal

Proposed by Bryce Harrington
Status: Approved
Approved by: Bryce Harrington
Approved revision: c7b0b79e080925539ffb815313597ef9dafa2bb3
Proposed branch: ~bryce/ubuntu/+source/php-parser:sru-lp1895878-disable-tests
Merge into: ubuntu/+source/php-parser:ubuntu/focal
Diff against target: 252 lines (+206/-0)
7 files modified
debian/changelog (+18/-0)
debian/patches/disable-CodeParsingTest-due-to-integer-syntax.patch (+65/-0)
debian/patches/disable-broken-test-case-in-EmulativeTest.patch (+38/-0)
debian/patches/series (+7/-0)
debian/patches/skip-EmulativeTest-testErrorAfterEmulation.patch (+26/-0)
debian/patches/skip-LexerTest-testError.patch (+26/-0)
debian/patches/skip-PrettyPrinterTest.patch (+26/-0)
Reviewer Review Type Date Requested Status
Bryce Harrington (community) Approve
Christian Ehrhardt  (community) Needs Fixing
Canonical Server MOTU reviewers Pending
Review via email: mp+392194@code.launchpad.net

Description of the change

This disables five test cases that are failing in focal in order to allow a php SRU to finish migration.

Two of the test case failures we encountered in groovy as well, and are known issues upstream. The other three I suspect were caused when other elements of the php stack were updated, however I've not determined a root cause for them. When php7.4 itself transitioned, I don't recall php-parser having build or test issues; however there were some pieces like phpunit, that were transitioning in parallel, and it's possible there were unresolved late-cycle transition issues as a result.

In one of last week's standups we discussed options: a) bypass the testsuite entirely, b) disable just the failing test cases, or c) diagnose the exact problems and identify necessary fixes. For expediency, we preferred (a) or (b), with (b) being felt to be more targeted and less brute-force than (a).

PPA:
 - https://launchpad.net/~bryce/+archive/ubuntu/php-parser-sru-lp1895878-disable-tests

SRU:
 - https://bugs.launchpad.net/ubuntu/+source/php-parser/+bug/1878102
 - https://bugs.launchpad.net/ubuntu/+source/php-parser/+bug/1895878

To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

You mention (LP: #1878102) twice in the changelog.
I understand what you mean but I happened to run into issues due to that by some of the tools that run for the automated bug updates and such.
Therefore I'd recommend to re-order the changelog to list the bgu ref only once and the two changes below it.

review: Needs Fixing
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

All the patches miss proper dep3 headers, I can see that we can derive most of the info of the git-format patch that this is - which is mostly fine.
But a few things to add:

1. at least a Bug-Ubuntu: ... should be added to all of them to have a link back from the patch without having to memorize which bug the changelog associates a patch file.

2. debian/patches/disable-broken-test-case-in-EmulativeTest.patch
"Upstream reports this may not be 32-bit compatible."
Is there any link of that we could add as "Origin" ?

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

In general I agree that skipping (b) the affected tests is the best we can do without wasting too much time (c). So thank you for that, but at least in my mind that was meant as "armhf only".

All of the patches should IMHO be done like "if machine.arch() == armhf then skip" or something like it. Do you think it would be possible to do it that way without wasting too much further time on it?

review: Needs Fixing
Revision history for this message
Bryce Harrington (bryce) wrote :

Regarding armhf, I am able to reproduce most of these failures on my own amd64 machine, and an earlier test in a ppa showed they fail on other arch's as well. Honestly, all of these php test failures kind of bleed together in my memory at this point, and I can't recall precisely if this was one I definitely narrowed to just armhf, or if perhaps maybe it took longer to run than the others so lost a race against whatever other package caused the breakage. In any case, the tests definitely fail on more than just armhf currently, so conditionalizing on machine arch would not be a complete fix.

As a side note, the original impetuous for this sru was to enable another php7.4 SRU to go through. But that php sru has now gone through (thanks to a CVE bumping it in). So, while the issue still exists here with php-parser, at least the near term pressure is off. Given that, do you think we should hold off until the failures can be more thoroughly diagnosed, or should we press ahead so that next time there's a php sru it doesn't bog down?

In either case, I'll incorporate your other suggested changes before backburnering or proceeding.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

On Mon, Oct 19, 2020 at 9:47 PM Bryce Harrington <email address hidden>
wrote:

> Regarding armhf, I am able to reproduce most of these failures on my own
> amd64 machine, and an earlier test in a ppa showed they fail on other
> arch's as well. Honestly, all of these php test failures kind of bleed
> together in my memory at this point, and I can't recall precisely if this
> was one I definitely narrowed to just armhf, or if perhaps maybe it took
> longer to run than the others so lost a race against whatever other package
> caused the breakage. In any case, the tests definitely fail on more than
> just armhf currently, so conditionalizing on machine arch would not be a
> complete fix.
>

Ok then, thanks for the explanation!

As a side note, the original impetuous for this sru was to enable another
> php7.4 SRU to go through. But that php sru has now gone through (thanks to
> a CVE bumping it in). So, while the issue still exists here with
> php-parser, at least the near term pressure is off. Given that, do you
> think we should hold off until the failures can be more thoroughly
> diagnosed, or should we press ahead so that next time there's a php sru it
> doesn't bog down?
>

IMHO I'd continue to fix this as intended (neither stall, nor switch to
spend 5 more days).

> In either case, I'll incorporate your other suggested changes before
> backburnering or proceeding.
>

Ok, once those are in I think you are all set then - thanks for the
discussion.

Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks, changes applied, tagged and uploaded:

$ git ubuntu tag --upload
$ git push pkg upload/4.2.2-2ubuntu0.1
Enumerating objects: 43, done.
Counting objects: 100% (43/43), done.
Delta compression using up to 12 threads
Compressing objects: 100% (38/38), done.
Writing objects: 100% (38/38), 6.70 KiB | 428.00 KiB/s, done.
Total 38 (delta 25), reused 0 (delta 0)
To ssh://git.launchpad.net/ubuntu/+source/php-parser
 * [new tag] upload/4.2.2-2ubuntu0.1 -> upload/4.2.2-2ubuntu0.1
$ dput ubuntu php-parser_4.2.2-2ubuntu0.1_source.changes
Checking signature on .changes
gpg: /home/bryce/pkg/PhpParser/sru-lp1895878-disable-tests-armhf/php-parser_4.2.2-2ubuntu0.1_source.changes: Valid signature from E603B2578FB8F0FB
Checking signature on .dsc
gpg: /home/bryce/pkg/PhpParser/sru-lp1895878-disable-tests-armhf/php-parser_4.2.2-2ubuntu0.1.dsc: Valid signature from E603B2578FB8F0FB
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading php-parser_4.2.2-2ubuntu0.1.dsc: done.
  Uploading php-parser_4.2.2-2ubuntu0.1.debian.tar.xz: done.
  Uploading php-parser_4.2.2-2ubuntu0.1_source.buildinfo: done.
  Uploading php-parser_4.2.2-2ubuntu0.1_source.changes: done.
Successfully uploaded packages.

review: Approve

Unmerged commits

c7b0b79... by Bryce Harrington

changelog

44a2ca9... by Bryce Harrington

 * d/p/skip-EmulativeTest-testErrorAfterEmulation.patch,
   d/p/skip-LexerTest-testError.patch,
   d/p/skip-PrettyPrinterTest.patch: Disable test cases that fail on
   focal, but not groovy.
   (LP: #1878102)

72524b7... by Bryce Harrington

changelog

c289125... by Bryce Harrington

  * d/p/disable-CodeParsingTest-due-to-integer-syntax.patch:
    Disable another test case that is not yet 32-bit compatible, to fix
    proposed migration blockage on armhf.
    (LP: #1895878)

e3ee89d... by Bryce Harrington

  * d/p/disable-broken-test-case-in-EmulativeTest.patch:
    Fix FTBFS by disabling a test case upstream suggests may not
    yet be adequately checked for all architectures.
    (LP: #1878102)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 966163c..ded4105 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,21 @@
6+php-parser (4.2.2-2ubuntu0.1) focal; urgency=medium
7+
8+ * d/p/disable-broken-test-case-in-EmulativeTest.patch:
9+ Fix FTBFS by disabling a test case upstream suggests may not
10+ yet be adequately checked for all architectures.
11+ (LP: #1878102)
12+ * d/p/disable-CodeParsingTest-due-to-integer-syntax.patch:
13+ Disable another test case that is not yet 32-bit compatible, to fix
14+ proposed migration blockage on armhf.
15+ (LP: #1895878)
16+ * d/p/skip-EmulativeTest-testErrorAfterEmulation.patch,
17+ d/p/skip-LexerTest-testError.patch, d/p/skip-PrettyPrinterTest.patch:
18+ Disable additional parser/lexer test cases that fail on focal, but not
19+ groovy.
20+ (LP: #1878102)
21+
22+ -- Bryce Harrington <bryce@canonical.com> Wed, 30 Sep 2020 22:14:10 +0000
23+
24 php-parser (4.2.2-2) unstable; urgency=medium
25
26 * Upload to unstable in sync with phpdox
27diff --git a/debian/patches/disable-CodeParsingTest-due-to-integer-syntax.patch b/debian/patches/disable-CodeParsingTest-due-to-integer-syntax.patch
28new file mode 100644
29index 0000000..9cac701
30--- /dev/null
31+++ b/debian/patches/disable-CodeParsingTest-due-to-integer-syntax.patch
32@@ -0,0 +1,65 @@
33+From a354b3bc4fcf1bfe22d84741ebd1d945c4fa50df Mon Sep 17 00:00:00 2001
34+From: Bryce Harrington <bryce@bryceharrington.org>
35+Date: Thu, 14 May 2020 23:11:18 +0000
36+Subject: [PATCH] Disable CodeParsingTest due to integer syntax inconsistency
37+ on armhf
38+
39+Workaround testsuite failure when run on armhf by disabling the test
40+case. The specific failing test case is from
41+PhpParser\CodeParsingTest::testParse with the
42+scalar/numberSeparators.test#0 data set:
43+
44+ 2: Stmt_Expression(
45+ - expr: Scalar_LNumber(
46+ - value: 3405705229
47+ + expr: Scalar_DNumber(
48+ + value: 0
49+ )
50+
51+Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
52+---
53+ test/PhpParser/CodeParsingTest.php | 28 ----------------------------
54+ 1 file changed, 28 deletions(-)
55+
56+diff --git a/test/PhpParser/CodeParsingTest.php b/test/PhpParser/CodeParsingTest.php
57+index 24e93dd..dba8f1e 100644
58+--- a/test/PhpParser/CodeParsingTest.php
59++++ b/test/PhpParser/CodeParsingTest.php
60+@@ -7,34 +7,6 @@ use PhpParser\Node\Stmt;
61+
62+ class CodeParsingTest extends CodeTestAbstract
63+ {
64+- /**
65+- * @dataProvider provideTestParse
66+- */
67+- public function testParse($name, $code, $expected, $modeLine) {
68+- if (null !== $modeLine) {
69+- $modes = array_fill_keys(explode(',', $modeLine), true);
70+- } else {
71+- $modes = [];
72+- }
73+-
74+- list($parser5, $parser7) = $this->createParsers($modes);
75+- list($stmts5, $output5) = $this->getParseOutput($parser5, $code, $modes);
76+- list($stmts7, $output7) = $this->getParseOutput($parser7, $code, $modes);
77+-
78+- if (isset($modes['php5'])) {
79+- $this->assertSame($expected, $output5, $name);
80+- $this->assertNotSame($expected, $output7, $name);
81+- } elseif (isset($modes['php7'])) {
82+- $this->assertNotSame($expected, $output5, $name);
83+- $this->assertSame($expected, $output7, $name);
84+- } else {
85+- $this->assertSame($expected, $output5, $name);
86+- $this->assertSame($expected, $output7, $name);
87+- }
88+-
89+- $this->checkAttributes($stmts5);
90+- $this->checkAttributes($stmts7);
91+- }
92+
93+ public function createParsers(array $modes) {
94+ $lexer = new Lexer\Emulative(['usedAttributes' => [
95+--
96+2.25.1
97+
98diff --git a/debian/patches/disable-broken-test-case-in-EmulativeTest.patch b/debian/patches/disable-broken-test-case-in-EmulativeTest.patch
99new file mode 100644
100index 0000000..61fc1a1
101--- /dev/null
102+++ b/debian/patches/disable-broken-test-case-in-EmulativeTest.patch
103@@ -0,0 +1,38 @@
104+From 6bf75f03c7e498e7339e21c6a1ba3cf5a0ccf336 Mon Sep 17 00:00:00 2001
105+From: Bryce Harrington <bryce@canonical.com>
106+Date: Wed, 30 Sep 2020 21:42:18 +0000
107+Subject: [PATCH] test: Disable broken test case in EmulativeTest
108+
109+Upstream reports this may not be 32-bit compatible.
110+---
111+ test/PhpParser/Lexer/EmulativeTest.php | 14 --------------
112+ 1 file changed, 14 deletions(-)
113+
114+diff --git a/test/PhpParser/Lexer/EmulativeTest.php b/test/PhpParser/Lexer/EmulativeTest.php
115+index a53c379..b67e659 100644
116+--- a/test/PhpParser/Lexer/EmulativeTest.php
117++++ b/test/PhpParser/Lexer/EmulativeTest.php
118+@@ -70,20 +70,6 @@ class EmulativeTest extends LexerTest
119+ ];
120+ }
121+
122+- /**
123+- * @dataProvider provideTestLexNewFeatures
124+- */
125+- public function testLexNewFeatures($code, array $expectedTokens) {
126+- $lexer = $this->getLexer();
127+- $lexer->startLexing('<?php ' . $code);
128+-
129+- $tokens = [];
130+- while (0 !== $token = $lexer->getNextToken($text)) {
131+- $tokens[] = [$token, $text];
132+- }
133+- $this->assertSame($expectedTokens, $tokens);
134+- }
135+-
136+ /**
137+ * @dataProvider provideTestLexNewFeatures
138+ */
139+--
140+2.25.1
141+
142diff --git a/debian/patches/series b/debian/patches/series
143index 57b1eeb..589922b 100644
144--- a/debian/patches/series
145+++ b/debian/patches/series
146@@ -1,3 +1,10 @@
147 0001-Allow-require-to-search-in-the-path.patch
148 0002-Adapt-shebang-for-PHP-script.patch
149 0003-Compatibility-with-recent-PHPUnit.patch
150+
151+# Ubuntu
152+disable-broken-test-case-in-EmulativeTest.patch
153+disable-CodeParsingTest-due-to-integer-syntax.patch
154+skip-EmulativeTest-testErrorAfterEmulation.patch
155+skip-LexerTest-testError.patch
156+skip-PrettyPrinterTest.patch
157diff --git a/debian/patches/skip-EmulativeTest-testErrorAfterEmulation.patch b/debian/patches/skip-EmulativeTest-testErrorAfterEmulation.patch
158new file mode 100644
159index 0000000..991fe51
160--- /dev/null
161+++ b/debian/patches/skip-EmulativeTest-testErrorAfterEmulation.patch
162@@ -0,0 +1,26 @@
163+From 1ceca6f34d2e736fe6782e91358055b158a8cfe5 Mon Sep 17 00:00:00 2001
164+From: Bryce Harrington <bryce@bryceharrington.org>
165+Date: Mon, 5 Oct 2020 13:19:30 -0700
166+Subject: [PATCH] Skip EmulativeTest::testErrorAfterEmulation
167+
168+---
169+ test/PhpParser/Lexer/EmulativeTest.php | 17 +++--------------
170+ 1 file changed, 3 insertions(+), 14 deletions(-)
171+
172+diff --git a/test/PhpParser/Lexer/EmulativeTest.php b/test/PhpParser/Lexer/EmulativeTest.php
173+index a53c379..7b9bf28 100644
174+--- a/test/PhpParser/Lexer/EmulativeTest.php
175++++ b/test/PhpParser/Lexer/EmulativeTest.php
176+@@ -102,6 +88,9 @@ class EmulativeTest extends LexerTest
177+ * @dataProvider provideTestLexNewFeatures
178+ */
179+ public function testErrorAfterEmulation($code) {
180++ // Skip testErrorAfterEmulation() (LP: #1878102)
181++ return;
182++
183+ $errorHandler = new ErrorHandler\Collecting;
184+ $lexer = $this->getLexer();
185+ $lexer->startLexing('<?php ' . $code . "\0", $errorHandler);
186+--
187+2.25.1
188+
189diff --git a/debian/patches/skip-LexerTest-testError.patch b/debian/patches/skip-LexerTest-testError.patch
190new file mode 100644
191index 0000000..8144cdb
192--- /dev/null
193+++ b/debian/patches/skip-LexerTest-testError.patch
194@@ -0,0 +1,26 @@
195+From 90b6aa2e2fbef8e1a22e99b50a7ec17317d96da9 Mon Sep 17 00:00:00 2001
196+From: Bryce Harrington <bryce@bryceharrington.org>
197+Date: Mon, 5 Oct 2020 13:27:38 -0700
198+Subject: [PATCH] Disable LexerTest::testError
199+
200+---
201+ test/PhpParser/LexerTest.php | 3 +++
202+ 1 file changed, 3 insertions(+)
203+
204+diff --git a/test/PhpParser/LexerTest.php b/test/PhpParser/LexerTest.php
205+index f24c64d..19036ef 100644
206+--- a/test/PhpParser/LexerTest.php
207++++ b/test/PhpParser/LexerTest.php
208+@@ -15,6 +15,9 @@ class LexerTest extends \PHPUnit\Framework\TestCase
209+ * @dataProvider provideTestError
210+ */
211+ public function testError($code, $messages) {
212++ // Skip EmulativeTest::testError (LP: #1878102)
213++ return;
214++
215+ if (defined('HHVM_VERSION')) {
216+ $this->markTestSkipped('HHVM does not throw warnings from token_get_all()');
217+ }
218+--
219+2.25.1
220+
221diff --git a/debian/patches/skip-PrettyPrinterTest.patch b/debian/patches/skip-PrettyPrinterTest.patch
222new file mode 100644
223index 0000000..934ee23
224--- /dev/null
225+++ b/debian/patches/skip-PrettyPrinterTest.patch
226@@ -0,0 +1,26 @@
227+From 2831a91e247d9c05f6b2b67d3d66baee8854780c Mon Sep 17 00:00:00 2001
228+From: Bryce Harrington <bryce@bryceharrington.org>
229+Date: Mon, 5 Oct 2020 13:17:32 -0700
230+Subject: [PATCH] Skip PrettyPrinterTest
231+
232+---
233+ test/PhpParser/PrettyPrinterTest.php | 3 +++
234+ 1 file changed, 3 insertions(+)
235+
236+diff --git a/test/PhpParser/PrettyPrinterTest.php b/test/PhpParser/PrettyPrinterTest.php
237+index e5b8a1a..c266234 100644
238+--- a/test/PhpParser/PrettyPrinterTest.php
239++++ b/test/PhpParser/PrettyPrinterTest.php
240+@@ -283,6 +283,9 @@ CODE
241+
242+ $printer = new PrettyPrinter\Standard();
243+
244++ // Skip test
245++ return;
246++
247+ try {
248+ $oldStmts = $parser->parse($code);
249+ } catch (Error $e) {
250+--
251+2.25.1
252+

Subscribers

People subscribed via source and target branches