Bug 129423 - Make export tests export-only where applicable (DECLARE_*EXPORT_TEST => DECLARE_*EXPORT_EXPORTONLY_TEST)
Summary: Make export tests export-only where applicable (DECLARE_*EXPORT_TEST => DECLA...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Dániel Arató (NISZ)
URL:
Whiteboard: target:6.5.0 target:7.0.0 target:7.1....
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2019-12-16 07:02 UTC by Mike Kaganski
Modified: 2021-01-05 09:01 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2019-12-16 07:02:37 UTC
In the codebase, there are a lot of unit tests that have this pattern:

> DECLARE_OOXMLEXPORT_TEST(testFoo,"test.odt")
> {
>     xmlDocPtr pXmlDoc = parseExport();
>     if (!pXmlDoc)
>         return;
>     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r", 2);
> }

The code tests that pXmlDoc is valid, because the export tests run in two stages, first in initial import, then in follow-up import-export-import. For the former, there's no export yet to parse, and so the pXmlDoc validity test makes this unit test "export-only".

There are special test templates for export-only tests; and so the task is to change the above code to

> DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFoo,"test.odt")
> {
>     xmlDocPtr pXmlDoc = parseExport();
>     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r", 2);
> }

This not only makes it simpler, but also more robust: if parseExport fails for some parsing problem and returns nullptr, the test should fail, which would happen now, unlike with original code, where it would silently pass.

The code is in .cxx files, mostly under sw/qa:

https://opengrok.libreoffice.org/search?project=core&full=%2FDECLARE_.*EXPORT_TEST%2F&si=full&n=250
https://opengrok.libreoffice.org/search?project=core&full=%22if+%28%21pXmlDoc%29%22&si=full

Of course, only the actual export-only tests need to be changed.
Comment 1 Miklos Vajna 2019-12-17 08:33:15 UTC
CC Michael Stahl, we just discussed a similar topic on IRC yesterday.
Comment 2 Commit Notification 2019-12-26 05:56:38 UTC
Onur Yilmaz committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ae26c6a3cc7662c4e2a9b4c684f64b44ae28e8a9

tdf#129423: Make export tests export-only where applicable

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2019-12-26 06:01:28 UTC
Onur Yilmaz committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5c907e0718bda1cc8631eacabc1b41e4d9617332

tdf#129423: Make export tests export-only where applicable

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2019-12-26 06:05:07 UTC
Onur Yilmaz committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c48b3d092976f5b8a162408d885b178b4660d91d

tdf#129423: Make export tests export-only where applicable

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2019-12-27 12:53:05 UTC
ayhanyalcinsoy committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3b8007d4270c5453a65dabef984ed6c24a5a2b4a

tdf#129423: Make export tests export-only where applicable

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2020-01-02 19:02:10 UTC
Onur Yilmaz committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/408f84f6b95a99013b841e1d923ec4cb05bd2a5c

tdf#129423: Make export tests export-only where applicable

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2020-01-02 19:03:42 UTC
Onur Yilmaz committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/873ce9b271b00e044912f4849ae2649b4fa21efd

tdf#129423: Make export tests export-only where applicable

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2020-01-12 12:51:54 UTC
ayhanyalcinsoy committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/16e7ca76ae873fe953b483f4c34aa9e5610addf8

tdf#129423: Make export tests export-only where applicable

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2020-01-18 16:21:57 UTC
Kemal Ayhan committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c59c1a9170e9510a18a084cd90289b6a7d8b87e4

tdf#129423: Make export tests export-only where applicable

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2020-01-25 08:15:00 UTC
Shivam Kumar Singh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6ffaefa1694f71175bb499cd5ee5886b23874e90

tdf#129423: Make export tests export-only where applicable

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2020-02-02 07:22:58 UTC
Yusuf Keten committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a5cdcc3a17a562382fc2cc38a8aaf5b584343d12

 tdf#129423: Make export tests export-only where applicable

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Sachin 2020-03-15 08:41:46 UTC
I'm starting to work on this.
Comment 13 Mike Kaganski 2020-04-27 07:06:12 UTC
Note that this syntax should also be checked and converted where necessary:

> if (xmlDocPtr pXmlDoc = parseExport("styles.xml"))
> {
>     ...
> }
Comment 14 Xisco Faulí 2020-05-19 15:51:13 UTC
(In reply to Mike Kaganski from comment #13)
> Note that this syntax should also be checked and converted where necessary:
> 
> > if (xmlDocPtr pXmlDoc = parseExport("styles.xml"))
> > {
> >     ...
> > }

Yes, sw/qa/extras/ooxmlexport/ooxmlexport5.cxx has some of those. E.g https://opengrok.libreoffice.org/xref/core/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx?r=ec8dc357#1210
Comment 15 Commit Notification 2020-05-19 18:14:53 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8e572dc82b132de8472928db0ab0aed6388390e8

tdf#129423: make these tests export-only

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Attila Bakos (NISZ) 2020-08-05 11:25:44 UTC
Already done.
Comment 17 Mike Kaganski 2020-08-05 11:35:01 UTC
(In reply to Attila Bakos (NISZ) from comment #16)
> Already done.

I don't see it done e.g. for odfexport...
Comment 18 Attila Bakos (NISZ) 2020-08-06 06:48:39 UTC
Oh, should the unit tests that load a concrete XML file also be converted?
Such as testTableStyles3 in odfexport which calls parseExport("styles.xml")?
Comment 19 Mike Kaganski 2020-08-06 07:13:26 UTC
(In reply to Attila Bakos (NISZ) from comment #18)

Please check some commits mentioned in this bug, like e.g. in comment 2.
Comment 20 Commit Notification 2020-08-22 15:44:38 UTC
Attila Bakos committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5ac88d12b377f64ff36551bfb3cf95a4a23a167d

tdf#129423 sw: Convert more tests to export-only

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Commit Notification 2020-08-24 13:32:54 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d9e1775941ff2314d4c1c3d2ace273796d809ca4

tdf#129423 sw: remove last two bad nullptr checks

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 22 Mike Kaganski 2020-08-27 13:35:46 UTC
(In reply to Attila Bakos (NISZ) from comment #16)
> Already done.

(In reply to Mike Kaganski from comment #17)
> I don't see it done e.g. for odfexport...

Then today ...

> Dániel Arató (NISZ) <arato.daniel@nisz.hu> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|ASSIGNED                    |RESOLVED
>          Resolution|---                         |FIXED

I'm looking at odfexport, and don't see anything changed. Does NISZ team simply try to close as many bugs as it can, ignoring the common sense?
Comment 23 Dániel Arató (NISZ) 2020-08-27 13:49:46 UTC
(In reply to Mike Kaganski from comment #22)

I apologize. The original bug description referred to OOXML export tests specifically. I never looked at the other modules.

We will look for the same pattern in the remaining modules now.
Comment 24 Mike Kaganski 2020-08-27 13:51:55 UTC
(In reply to Dániel Arató (NISZ) from comment #23)
> The original bug description referred to OOXML export tests specifically.

No. It described a pattern; and then provided a OpenGrok reference using DECLARE_.*EXPORT_TEST regex.
Comment 25 Dániel Arató (NISZ) 2020-08-27 13:57:52 UTC
(In reply to Mike Kaganski from comment #24)

You're correct of course. Please excuse my inattention.
Comment 26 Commit Notification 2020-09-01 07:04:25 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ceae73dd294b5ca4073062afc1223efb1c206780

tdf#129423 sw: Make yet more tests export-only

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 27 Commit Notification 2020-09-03 05:16:03 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f83f06475996cdf072a230aa8c0abe6d85b278ec

tdf#129423 sw: export-only tests, part 2

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 28 Commit Notification 2020-09-03 05:20:14 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/87c6b7a8dea4f59b09001d4d6364cb1835d10903

tdf#129423 sw: export-only tests, part 3

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 29 Commit Notification 2020-09-03 05:22:25 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/78bc1c3c0c71eb67046db5596eb8d442ad564310

tdf#129423 sw: export-only tests, part 6

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 30 Commit Notification 2020-09-03 05:23:37 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/bc01e76bab663826c7c0f125cbbfc790f7de4a98

tdf#129423 sw: export-only tests, part 7

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 31 Commit Notification 2020-09-03 05:25:49 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4419b19715fdc65728b559d9fc6e36c9e66bc562

tdf#129423 sw: export-only tests, part 11

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 32 Commit Notification 2020-09-03 05:29:01 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a53e0459280a06a3794cd2a83fd7fbca90fb7ea5

tdf#129423 sw: export-only tests, part 12

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 33 Commit Notification 2020-09-03 05:31:13 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c41d937fdd97238fe7787f97a51b3e2a4c72d30a

tdf#129423 sw: export-only tests, part 13

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 34 Commit Notification 2020-09-03 06:48:05 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f51aaf80002c74af78c8934a3dff4938e1f55acd

tdf#129423 sw: export-only tests, part 9

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 35 Commit Notification 2020-09-03 07:23:44 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0e3e0b04395de673e0cc9709de360e5cf95c1cc7

tdf#129423 sw: export-only tests, part 5

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 36 Commit Notification 2020-09-03 08:24:11 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4d57fd4557d818c6ec5aea12cdd797899b4fdcf7

tdf#129423 sw: export-only tests, part 8

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 37 Commit Notification 2020-09-03 17:35:33 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/77829e5310350afe5d5e66f8abc3adbcc988ba39

tdf#129423 sw: export-only tests, part 4

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 38 Commit Notification 2020-09-03 17:36:47 UTC
Daniel Arato (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0be6e21857f868d85049fca2c8e02fc5e8802120

tdf#129423 sw: export-only tests, part 10

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 39 Commit Notification 2021-01-05 09:01:05 UTC
umutbayramoglu committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0825f53a715d7c0e8ddcd9220726c71c4250536e

tdf#129423: Make export tests export-only where applicable

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.