vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Possible Line Ending issue in test output

Open TheKayneGame opened this issue 2 years ago • 8 comments

Brief Issue Summary

I am using CMake 3.22.2 in a podman container en connected using the VSCode Dev Container with CMake Tools v1.14.33

As a testing framework i am using GUnit which is an extension on top of Google Test.

When i run a test the test succeeds and fails when it should, this is correctly viewed on the test explorer. I issue get apparent when i open the Test Result .

CMake Tools

My test results are formatted by the test explorer like this:

Running main() from /workspaces/hello-world-app-docker/out/build/Linux-gcc/_deps/gunit-src/libs/googletest/googletest/src/gtest_main.cc
                                                                                                                                       [==========] Running 1 test from 1 test suite.
                    [----------] Global test environment set-up.
                                                                [----------] 1 test from Example
                                                                                                [ RUN      ] Example.Showing off
                                                                                                                                Set Up
                                                                                                                                      File: /workspaces/hello-world-app-docker/GUnit_HelloWorld/test/GSteps.feature
                                                  Feature: Example
                                                                  Scenario: Showing off
                                                                                       Step: 

                                                                                             Tear Down
                                                                                                      File: /workspaces/hello-world-app-docker/GUnit_HelloWorld/test/GSteps.feature
                  Feature: Example
                                  Scenario: Showing off
                                                       Step: The following steps should be shown on the screen

                                                                                                              [    Given ] I create steps                                              # GSteps.feature:7
                                        [    Given ] I add step a                                                # GSteps.feature:8
                                                                                                                                   [    Given ] I add step b                                                # GSteps.feature:9
                                                             [     When ] I run the scenario                                          # GSteps.feature:10
                                                                                                                                                         Runni...
                                                                                                                                                                The rest of the test output was removed since it exceeds the threshold of 1024 bytes.

(VSCode) Terminal

While in my terminal the test is correctly formatted like:

1: Running main() from /workspaces/hello-world-app-docker/out/build/Linux-gcc/_deps/gunit-src/libs/googletest/googletest/src/gtest_main.cc
1: [==========] Running 1 test from 1 test suite.
1: [----------] Global test environment set-up.
1: [----------] 1 test from Example
1: [ RUN      ] Example.Showing off
1: Set Up
1: File: /workspaces/hello-world-app-docker/GUnit_HelloWorld/test/GSteps.feature
1: Feature: Example
1: Scenario: Showing off
1: Step: 
1: 
1: Tear Down
1: File: /workspaces/hello-world-app-docker/GUnit_HelloWorld/test/GSteps.feature
1: Feature: Example
1: Scenario: Showing off
1: Step: The following steps should be shown on the screen
1: 
1: [    Given ] I create steps                                              # GSteps.feature:7
1: [    Given ] I add step a                                                # GSteps.feature:8
1: [    Given ] I add step b                                                # GSteps.feature:9
1: [     When ] I run the scenario                                          # GSteps.feature:10
1: Running...
1: [     Then ] The following steps should be shown on the screen           # GSteps.feature:11
1: 
1: [       OK ] Example.Showing off (0 ms)
1: [----------] 1 test from Example (0 ms total)
1: 
1: [----------] Global test environment tear-down
1: [==========] 1 test from 1 test suite ran. (0 ms total)
1: [  PASSED  ] 1 test.
1/1 Test #1: hello_test .......................   Passed    0.03 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.15 sec

CMake Test Explorer

And when i use another extension for the test explorer CMake Test Explorer the result looks like this:

Start 1: hello_test
1: Test command: /workspaces/hello-world-app-docker/out/build/Linux-gcc/GUnit_HelloWorld/test/hello_test
1: Environment variables: 
1:  SCENARIO=/workspaces/hello-world-app-docker/GUnit_HelloWorld/test/GSteps.feature
1: Test timeout computed to be: 10000000
1: Running main() from /workspaces/hello-world-app-docker/out/build/Linux-gcc/_deps/gunit-src/libs/googletest/googletest/src/gtest_main.cc
1: [==========] Running 1 test from 1 test suite.
1: [----------] Global test environment set-up.
1: [----------] 1 test from Example
1: [ RUN      ] Example.Showing off
1: Set Up
1: File: /workspaces/hello-world-app-docker/GUnit_HelloWorld/test/GSteps.feature
1: Feature: Example
1: Scenario: Showing off
1: Step: 
1: 
1: Tear Down
1: File: /workspaces/hello-world-app-docker/GUnit_HelloWorld/test/GSteps.feature
1: Feature: Example
1: Scenario: Showing off
1: Step: The following steps should be shown on the screen
1: 
1: [    Given ] I create steps                                              # GSteps.feature:7
1: [    Given ] I add step a                                                # GSteps.feature:8
1: [    Given ] I add step b                                                # GSteps.feature:9
1: [     When ] I run the scenario                                          # GSteps.feature:10
1: Running...
1: [     Then ] The following steps should be shown on the screen           # GSteps.feature:11
1: 
1: [       OK ] Example.Showing off (0 ms)
1: [----------] 1 test from Example (0 ms total)
1: 
1: [----------] Global test environment tear-down
1: [==========] 1 test from 1 test suite ran. (0 ms total)
1: [  PASSED  ] 1 test.
1/1 Test #1: hello_test .......................   Passed    0.03 sec

Since CMake Test Explorer also uses the native test explorer and all the while does output in the desired format I think it's fair to make the assumption that the issue lies within (my usage of) CMake Tools. Is there anything that can be done for this issue

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

Running in dev container using docker and windows 10

TheKayneGame avatar Aug 01 '23 13:08 TheKayneGame

@TheKayneGame Thanks for notifying us of this issue! I suspect that you are correct regarding it possibly being a line ending issue. We will investigate and work to get a fix in our 1.16 release.

gcampbell-msft avatar Aug 02 '23 13:08 gcampbell-msft

Me too. I'm looking forward for this issue to be solved.

yhgu2000 avatar Mar 06 '24 06:03 yhgu2000

@yhgu2000 @TheKayneGame Is there any way that you could provide a minimal repro project so that we can investigate?

gcampbell-msft avatar Apr 23 '24 20:04 gcampbell-msft

@yhgu2000 @TheKayneGame Is there any way that you could provide a minimal repro project so that we can investigate?

Here you go: 3274.tar.gz

yhgu2000 avatar Apr 24 '24 06:04 yhgu2000

@yhgu2000 I'm using the program you provided but I don't seem to be reproducing the problem, hopefully you can give me some advice!

Here are my test results: Test results: image (VSCode) Terminal: image

v-frankwang avatar Apr 26 '24 02:04 v-frankwang

@v-frankwang I think I know where the problem is: it happens only when one ssh to Linux machines from Windows, and the missed \r in Linux output caused this issue. I'm afraid that there might be problem for macOS too.

I reproduced your experience in my computer too. The picture below is my observation. The VSCode on the left is using VSCode on the local Windows machine. The right is using VSCode on a remote linux machine by Remote SSH.

Snipaste_2024-04-26_12-09-59

In case of there's something wrong with the CMake version. The cmake on my Windows is version 3.26.3, and the cmake on my Linux is version 3.22.1.

yhgu2000 avatar Apr 26 '24 04:04 yhgu2000

@gcampbell-msft @yhgu2000 Following the steps given by the user, this issue we can reproduce on top of the latest VSCode and you can get some information below:

ENV: VS Code: 1.88.1 CMake tools: 1.18.29 C/C++:1.20.2

Repro steps recording:

  1. Download the project:3274.tar.gz and open it in vscode.
  2. Run the CMake:config command.
  3. Click on the Testing icon in the left navigation bar.
  4. Click the Run Test icon.
  5. Observe the test results window.

Actual results: OS: Linux CMake version: 3.29.2 Screenshot from 2024-04-26 07-13-11

OS: Mac CMake version: 3.29.2 Screenshot 2024-04-26 at 3 39 51 PM

v-frankwang avatar Apr 26 '24 07:04 v-frankwang

@gcampbell-msft i think this issue is probably solved with #3752

hippo91 avatar May 12 '24 19:05 hippo91

@hippo91 This pull requests:https://github.com/microsoft/vscode-cmake-tools/pull/3752 hasn't been merged yet, I'll wait until it is and then I'll verify that this issue has been resolved.

v-frankwang avatar May 17 '24 06:05 v-frankwang

We verified the issue on the latest version and it is not reproducing, so close it.

ENV: VS Code: 1.90.2 CMake tools: 1.19.13(pre-release) C/C++:1.21.0(pre-release)

Actual results: image

v-frankwang avatar Jul 03 '24 02:07 v-frankwang