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

GoogleTest messages printed in global tear down are not shown in TestResults output #442

Closed
5 tasks done
maximiliank opened this issue Aug 21, 2024 · 1 comment
Closed
5 tasks done

Comments

@maximiliank
Copy link

Checklist

  • The issue is about this extension and NOT about a fork.
  • Checked the ALL the SUPPORT document.
  • The latest version of the extension was used.
  • It is not related to remote-vscode or I checked the following issue
  • Imagine yourself into my position and think how hard to debug the issue without insufficient information.
    I understand that you have privacy concerns and I expect you to understand that this extension is developed for free.
    Thanks.

Describe the bug

I am using gtest with global setup and tear down as described here https://google.github.io/googletest/advanced.html#global-set-up-and-tear-down. My main.cpp looks like

#include <gtest/gtest.h>
#include <iostream>

TEST(MyTest, Test)
{
    ASSERT_TRUE(true);
}

class GlobalEnvironment : public ::testing::Environment {
  public:
    ~GlobalEnvironment() override {}

    void SetUp() override
    {
        std::cout << "GlobalEnvironment set up" << std::endl;
    }

    void TearDown() override
    {
        std::cout << "GlobalEnvironment tear down" << std::endl;
    }
};
int main(int argc, char** argv)
{
    ::testing::InitGoogleTest(&argc, argv);
    ::testing::AddGlobalTestEnvironment(new GlobalEnvironment());
    return RUN_ALL_TESTS();
}

When I run the tests via the extension and look at the TestResults output it only prints the message from SetUp() and not the message from TearDown(), e.g.:

$1│ Started PID#1234 - '/home/user/out/build/unixlike-gcc-debug/test/tests'
$1$1│ GlobalEnvironment set up
$1│ [ RUN      ] MyTest.Test @ ./test/main.cpp:4
$1│ [       OK ] MyTest.Test (0 ms)
$1$1│ Stopped PID#1234 - Exit(0) / OK - '/home/user/out/build/unixlike-gcc-debug/test/tests'

When I run it from the command line it prints also the TearDown() message:

$ out/build/unixlike-gcc-debug/test/tests --gtest_color=no
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
GlobalEnvironment set up
[----------] 1 test from MyTest
[ RUN      ] MyTest.Test
[       OK ] MyTest.Test (0 ms)
[----------] 1 test from MyTest (0 ms total)

[----------] Global test environment tear-down
GlobalEnvironment tear down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 1 test.

To Reproduce

Compile given main.cpp with gtest.

Screenshots (optional)

Desktop

  • Extension Version: v4.12.0
  • VS Code Version: 1.92.2
  • Catch2 / Google Test / DOCTest Version: Google Test 1.15.0
  • OS Type and Version: Linux, RHEL 9
  • Using remote-ssh/docker/wsl?: remote-ssh

Regression bug?

Not that I am aware of.

  • Last extension version in which the feature were working:
**Log** (optional but recommended)
  <paste logs here>
@matepek
Copy link
Owner

matepek commented Oct 19, 2024

Fixed in v4.12.1.

This issue was mentioned in CHANGELOG.md under a released entry so it is assumed to be fixed.
User verifications are always welcome.

@matepek matepek closed this as completed Oct 19, 2024
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