Skip to content
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

Generate JUnit results in the Docker image #485

Merged
merged 11 commits into from
Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ ADD cpanfile ./cpanfile
RUN perl ./install-deps.pl
RUN rm cpanfile install-deps.pl

# Add in the TAP-JUnit converter
ADD tap-to-junit-xml.pl /tap-to-junit-xml.pl
RUN cpan XML::Generator

# /logs is where we should expect logs to end up
RUN mkdir /logs
# /test is where sytest will live
Expand Down
6 changes: 5 additions & 1 deletion docker/synapse_sytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -x

# Attempt to find a sytest to use.
# If /test/run-tests.pl exists, it means that a SyTest checkout has been mounted into the Docker image.
if [ -e "/test/run-tests.pl" ]
if [ -e "./run-tests.pl" ]
Copy link
Member

Choose a reason for hiding this comment

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

thank you 😄

then
# If the user has mounted in a SyTest checkout, use that. We can tell this by files being in the directory.
echo "Using local sytests..."
Expand Down Expand Up @@ -70,4 +70,8 @@ cp results.tap /logs/results.tap
cp server-0/homeserver.log /logs/homeserver-0.log
cp server-1/homeserver.log /logs/homeserver-1.log

# Write out JUnit for CircleCI
mkdir -p /logs/sytest
perl /tap-to-junit-xml.pl --puretap --input=/logs/results.tap --output=/logs/sytest/results.xml "SyTest"
Copy link
Member

Choose a reason for hiding this comment

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

I'm not entirely sure this is the optimal approach, vs (for instance) getting Sytest to spit out JUnit directly, or using a TAP-to-cpan thing from CPAN rather than dumping a script into our repo, but in the interests of not spending days hacking on sytest, let's go with this.

Copy link
Member

Choose a reason for hiding this comment

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

One question though: why are the TAP results in /logs but the junit results in /logs/sytest ? shouldn't it be /logs/junit-results.xml or /logs/junit-results/results.xml or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@richvdh CircleCI accepts the different suites under subdirectories named after the suite, in case you have multiple test suites -- I don't know if it's a convention or not, but it makes CircleCI happier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unfortunately the script isn't distributed on cpan as far as I can tell (and I needed to make a very minor change to make it spit out test names, not numbers)


exit $TEST_STATUS
Loading