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

xml_tests_report fails to generate with exception #727

Closed
M-Bab opened this issue Jan 12, 2023 · 5 comments
Closed

xml_tests_report fails to generate with exception #727

M-Bab opened this issue Jan 12, 2023 · 5 comments

Comments

@M-Bab
Copy link

M-Bab commented Jan 12, 2023

Since the pretty recent commit 2b42ea6#diff-a0f8b345c9aeb827c5f4f8fc8991a8f177ae410c1fd631f77541b54e3be6da7c the generation of the XML report fails for me with:

Exception raised in plugin: xml_tests_report, in method post_build
/var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:88:in `join': no implicit conversion of nil into String (TypeError)
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:88:in `block (2 levels) in write_tests'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:86:in `each'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:86:in `block in write_tests'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:85:in `each'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:85:in `write_tests'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:38:in `write_results'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:28:in `block (2 levels) in post_build'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/ceedling/file_wrapper.rb:53:in `block in open'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/ceedling/file_wrapper.rb:52:in `open'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/ceedling/file_wrapper.rb:52:in `open'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:26:in `block in post_build'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:19:in `each_key'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/plugins/xml_tests_report/lib/xml_tests_report.rb:19:in `post_build'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/ceedling/plugin_manager.rb:99:in `block in execute_plugins'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/ceedling/plugin_manager.rb:97:in `each'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/ceedling/plugin_manager.rb:97:in `execute_plugins'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/ceedling/plugin_manager.rb:85:in `post_build'
	from /var/lib/gems/3.0.0/gems/ceedling-0.31.1/lib/ceedling/rakefile.rb:78:in `block in <top (required)>'

Our configuration concerning reports is pretty basic and I assume is not the cause of this issue:

:plugins:
  :load_paths:
    - "#{Ceedling.load_path}"
  :enabled:
    - stdout_pretty_tests_report
    - module_generator
    - raw_output_report
    - colour_report
    - gcov
    - xml_tests_report
    - junit_tests_report

:gcov:
  :report_generator:
  :xml_report: true
  :reports:
    - HtmlDetailed
    - Cobertura
  :gcovr:
    :html_medium_threshold: 75
    :html_high_threshold: 90
    :report_exclude: "components*|build*|test*"
    # :cobertura_pretty: true

:junit_tests_report:
    :artifact_filename: report_junit.xml

A simple revert of 2b42ea6 did immediately resolve this issue.

But maybe this is not the best option. FYI @bw35

@bw35
Copy link

bw35 commented Jan 13, 2023

Thanks for reporting. Works fine now, please test

@mvandervoord
Copy link
Member

@M-Bab -- if you run a ceedling clobber and then run tests over again, does it still have your failure?

@bw35
Copy link

bw35 commented Jan 14, 2023

@mvandervoord Pull request #729 fixes the bug but it fails some unit tests because the expected result needs to be adjusted to the new behaviour introduced by commit 2b42ea6. Could you please review the failed tests and adjust them?

https://github.com/ThrowTheSwitch/Ceedling/actions/runs/3914907519/jobs/6693858997

 1) GeneratorTestResults#process_and_write_results handles an empty input
     Failure/Error: expect(IO.read(TEST_OUT_FILE)).to eq(IO.read('spec/support/test_example_empty.pass'))

       expected: "---\n:source:\n  :path: some/place\n  :file: test_example.c\n:successes: []\n:failures: []\n:ignores: []\n:counts:\n  :total: 0\n  :passed: 0\n  :failed: 0\n  :ignored: 0\n:stdout: []\n:time: 0.0\n"
            got: "---\n:source:\n  :file: some/place/test_example.c\n  :dirname: some/place\n  :basename: test_example...es: []\n:counts:\n  :total: 0\n  :passed: 0\n  :failed: 0\n  :ignored: 0\n:stdout: []\n:time: 0.0\n"

file contains now the absolute path, basename has been added, path has renamed to dirname. The test expects the previous behaviour, i.e. file containing the basename only. basename and dirname designators have been choosen in accordance to posix equivalents.

@M-Bab
Copy link
Author

M-Bab commented Jan 15, 2023

@bw35 Cherry-picked it into my working branch and can confirm its working.

@mvandervoord During development I always run with clobber (ceedling clobber test:all) 😉 . This bug was just a side note for me when updating the repo and submodules to the latest master versions. Significantly more important for us (so that ceedling can work properly) is this MR: #728

@mvandervoord
Copy link
Member

Fixed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants