Skip to content

Issue 1102: Fixup test suite, fix broken tests #1103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 24, 2020
Merged

Conversation

baylesj
Copy link
Contributor

@baylesj baylesj commented Nov 14, 2019

A recent PR broken the JsonChecker tests by adding support for trailing
commas. This didn't end up breaking the build, because those tests
aren't run, except locally and only using CMake.

This patch fixes the tests by adding exclusions for trailing comma
tests, as well as updates Meson to run these tests as part of ninja test.

See issue #1102.

@coveralls
Copy link

coveralls commented Nov 14, 2019

Coverage Status

Coverage remained the same at 93.858% when pulling 387045d on fixup-tests into 8b20b7a on master.

@cdunn2001
Copy link
Contributor

Hmmm. Using this branch locally, I have this:

[7/8] Running all tests.
1/3 unittest_jsoncpp_test                   OK       0.34 s
2/3 unittest_jsontestrunner                 FAIL     2.24 s (exit status 1)
3/3 jsonchecker_jsontestrunner              FAIL     2.60 s (exit status 1)

... Oh, if I delete the build-dir and start over, then it works. That's odd. Meson/Ninja usually do a good job of auto-updating for changes. Very suspicious, but it does work.

1/3 unittest_jsoncpp_test                   OK       0.15 s
2/3 unittest_jsontestrunner                 OK       3.17 s
3/3 jsonchecker_jsontestrunner              OK       4.04 s

Thanks for fixing this!

... Oh, hold on. It fails if you run a second time:

$ ninja -C build-static/ test
$ ninja -C build-static/ test
1/3 unittest_jsoncpp_test                   OK       0.03 s
2/3 unittest_jsontestrunner                 FAIL     1.17 s (exit status 1)
3/3 jsonchecker_jsontestrunner              OK       3.74 s

So we still have something to fix ...

@cdunn2001
Copy link
Contributor

I've verified that ninja test is repeatable onmaster, so something fishy is happening on this branch.

@baylesj
Copy link
Contributor Author

baylesj commented Feb 21, 2020

I'm digging back into this... looks like a fun problem. Basically both the unittest_jsontestrunner and jsonchecker_jsontestrunner are both intermittently flaky. Maybe a timing issue? I'll update once I have it sorted.

@baylesj
Copy link
Contributor Author

baylesj commented Feb 21, 2020

I figured it out! It's a race condition--for some reason the runjsontests.py script is trying to read the test files before they are done. I'm working on improving the hygeine of the test harness, and hopefully will have a 100% reliable configuration soon.

@baylesj
Copy link
Contributor Author

baylesj commented Feb 21, 2020

I think this is ready for another look!

@dota17
Copy link
Member

dota17 commented Mar 30, 2020

I think this is ready for another look!

Is there any progress?

@cdunn2001
Copy link
Contributor

This worked:

cd build-static; meson test --no-rebuild --print-errorlogs

But this failed (from top-dir):

ninja -C build-static/ test

ninja: Entering directory `build-static/'
[0/1] Running all tests.
1/3 unittest_jsoncpp_test                   OK       0.06 s
2/3 unittest_jsontestrunner                 FAIL     2.05 s (exit status 1)
3/3 jsonchecker_jsontestrunner              OK       2.67 s
...
FAILED: meson-test
/usr/local/Cellar/meson/0.52.0/libexec/bin/meson test --no-rebuild --print-errorlogs

I'll update meson, but I don't think that's the issue...

@cdunn2001
Copy link
Contributor

After upgrading python/meson/ninja on my Mac, I don't see a failure anymore. Weird. But the tests seem slow... Ok. I see the problem. Meson runs 3 tests: C++ unit-tests, a python round-trip checker on test/data/*.json, and the same python round-trip checker on those same *.json in addition to any expected-failure tests plus (some of) the tests under jsonchecker. The problem is that the non-fail tests under test/data/*.json are run twice. That's easy to prevent.

This whole thing should be done differently, but I try to solve just one specific problem at a time. For now I will revert your last 2 commits and skip the repetition of those tests. Tomorrow....

@cdunn2001 cdunn2001 self-assigned this Apr 24, 2020
@cdunn2001 cdunn2001 added the build or testing cmake, meson, continuous integration, or testing related label Apr 24, 2020
cdunn2001 and others added 4 commits April 24, 2020 09:32
A recent PR broken the JsonChecker tests by adding support for trailing
commas. This didn't end up breaking the build, because those tests
aren't run, except locally and only using CMake.

This patch fixes the tests by adding exclusions for trailing comma
tests, as well as updates Meson to run these tests as part of `ninja
test`.

See issue #1102.
Copy link
Contributor

@cdunn2001 cdunn2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed some commits, and it seems fine now, though we clearly still need some reorganization of the test-suite(s).



def safeReadFile(file_path):
# We may try to read early, so wait if the file doesn't exist yet.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There must be a way to prevent the race. We might merge just to make progress, but I'd like to figure out a way to prevent this problem altogether.

I'm about to try these changes locally....

@cdunn2001 cdunn2001 merged commit a0b8c3e into master Apr 24, 2020
@cdunn2001 cdunn2001 deleted the fixup-tests branch April 24, 2020 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build or testing cmake, meson, continuous integration, or testing related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants