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

Parsing error, if < or > is printed to console #238

Closed
4 tasks done
sutyum opened this issue Nov 24, 2020 · 5 comments
Closed
4 tasks done

Parsing error, if < or > is printed to console #238

sutyum opened this issue Nov 24, 2020 · 5 comments

Comments

@sutyum
Copy link

sutyum commented Nov 24, 2020

Checklist

  • The issue is about this extension and NOT about a fork.
  • Check the known issues list.
  • The latest version of the extension was used.
  • It is not related to remote-vscode or I checked the following issue

Describe the bug

Having text with angle brackets < , > causes parsing error. The log of the error is attached below along with a small program to reproduce the bug.

To Reproduce

#include <catch.hpp>
#include <iostream>

TEST_CASE("Parsing Bug: Print") { std::cout << "<Hello>"; }
TEST_CASE("Parsing Bug: spdlog") { SPDLOG_DEBUG("Hello"); }
TEST_CASE("Parsing Bug: spdlog <>") { SPDLOG_DEBUG("<Hello>"); }

Screenshots (optional)

Screenshot from 2020-11-24 14-02-41

Desktop

  • Extension Version: 3.6.7
  • VS Code Version: 1.51.1
  • Catch2 / Google Test / DOCTest Version: 2.13.3
  • OS Type and Version: Ubuntu 20.04.1 LTS
  • Using remote-ssh/docker/wsl?: No

Regression bug?

  • Last extension version in which the feature were working:

Log (optional but recommended)

😱 Unexpected error under parsing output !! Error: Error: Error: Unexpected close tag
Line: 3
Column: 15
Char: >
    at k (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:238811)
    at A (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:239187)
    at j (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:241565)
    at i.write (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:231144)
    at i.parseString (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:392173)
    at i.parseString (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:386744)
    at h.parseAndProcessTestCase (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:335697)
    at u (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:329970)
    at Socket.<anonymous> (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:332007)
    at Socket.emit (events.js:223:5)
    at Socket.EventEmitter.emit (domain.js:475:20)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:181:23)
    at /home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:335731
    at i.<anonymous> (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:391992)
    at i.emit (events.js:223:5)
    at i.EventEmitter.emit (domain.js:475:20)
    at i.saxParser.onerror (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:388816)
    at T (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:238475)
    at k (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:238834)
    at A (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:239187)
    at j (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:241565)
    at i.write (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:231144)
    at i.parseString (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:392173)
    at i.parseString (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:386744)
    at h.parseAndProcessTestCase (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:335697)
    at u (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:329970)
    at Socket.<anonymous> (/home/home/.vscode/extensions/matepek.vscode-catch2-test-adapter-3.6.7/out/dist/main.js:2:332007)
    at Socket.emit (events.js:223:5)
    at Socket.EventEmitter.emit (domain.js:475:20)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:181:23)
Consider opening an issue: https://github.com/matepek/vscode-catch2-test-adapter/issues/new/choose
Please attach the output of: "/home/home/Documents/Cpp-Things/Microfabricator-Embedded/build/test/firmware_test /home/home/Documents/Cpp-Things/Microfabricator-Embedded/build/test/firmware_test,LightSensor: can Construct.,LightSensor: can set Pin.,LightSensor: can read Value.,LightSensor: transmits correctly.,Light Controller: can construct.,--reporter,xml,--durations,yes"

⬇ std::cout:
[object Object]
⬆ std::cout
⬇ stdoutBuffer:
<TestCase name="LightSensor: can Construct." filename="/home/home/Documents/Cpp-Things/Microfabricator-Embedded/test/unit-tests/light_sensor_test.cpp" line="7">
[132357μs] 12  D FakeLightSensor.hpp          Constructed <Pin:10>
      <OverallResult success="true" durationInSeconds="4.3e-05"/>
    </TestCase>
    <TestCase name="LightSensor: can set Pin." filename="/home/home/Documents/Cpp-Things/Microfabricator-Embedded/test/unit-tests/light_sensor_test.cpp" line="13">
[132401μs] 12  D FakeLightSensor.hpp          Constructed <Pin:10>
      <OverallResult success="true" durationInSeconds="1.6e-05"/>
    </TestCase>
    <TestCase name="LightSensor: can read Value." filename="/home/home/Documents/Cpp-Things/Microfabricator-Embedded/test/unit-tests/light_sensor_test.cpp" line="19">
[132427μs] 12  D FakeLightSensor.hpp          Constructed <Pin:10>
      <OverallResult success="true" durationInSeconds="9.7e-05"/>
    </TestCase>
    <TestCase name="LightSensor: transmits correctly." filename="/home/home/Documents/Cpp-Things/Microfabricator-Embedded/test/unit-tests/light_sensor_test.cpp" line="29">
[132538μs] 12  D FakeLightSensor.hpp          Constructed <Pin:10>

⬆ stdoutBuffer
⬇ std::cerr:
[object Object]
⬆ std::cerr
⬇ stderrBuffer:

⬆ stderrBuffer
@matepek
Copy link
Owner

matepek commented Nov 29, 2020

Constructed <Pin:10> messes up the xml parsing. I think the problem is that Catch2 does not escapes it properly. :(

@matepek matepek closed this as completed Nov 29, 2020
@sutyum
Copy link
Author

sutyum commented Nov 29, 2020

Thank you for a very useful extension. 👏

@matepek
Copy link
Owner

matepek commented Nov 30, 2020

I had some thought on the issue. Maybe spdlog uses some other channel than std::cout and Cathc2 cannot redirect it. It's unclear to me.

@sutyum
Copy link
Author

sutyum commented Nov 30, 2020

It seems more likely that it is due the closing tag which is being assumed by the parser. I suppose it is not a crucial problem to solve and perhaps should simply be added to the README.md in the Known Issues section?

Do note that the tests are run successfully as shown through the terminal log messages. The error appears to occur when the stdoutBuffer is being parsed. Kindly refer to the section of the log messages provided below.

⬇ std::cout:
[object Object]
⬆ std::cout
⬇ stdoutBuffer:
<TestCase name="Light Controller: can construct." filename="/home/tcr/Cpp-Things/Microfabricator-Firmware/test/unit-tests/light_controller_test.cpp" line="5">
[239195μs] 11  D FakeLightsController.hpp     Constructed <Pin:10> // <-------- '>' appears to be the closing tag that raises the exception
      <OverallResult success="true" durationInSeconds="0.000111"/>
    </TestCase>

@matepek
Copy link
Owner

matepek commented Nov 30, 2020

Well in the perspective of this extension: The Catch2 library emits xml output which is not parsable.

What I'm trying to say is that Catch2 is smart and I would expect that it handles it well. (As it does actually in case of std::cout << "<Hello>"; ). The problem is might related tyo SPDLOG which uses a different way of writing the output and Catch2 cannot capture and escape that.

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

2 participants