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

Label merging is broken after adding current working directory in the advanced executables configuration #427

Closed
5 tasks done
rafalborczuch opened this issue Feb 22, 2024 · 8 comments
Labels
incomplete Make sure you followed the issue template

Comments

@rafalborczuch
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

Label merging stops working after adding cwd property to the advanced executables configuration.
The cwd path exists on the filesystem and tests have the correct cwd set when running/debugging.
I use a multi-root workspace.

To Reproduce

The following config correctly merges the labels in the tree view. Note that the cwd property is commented.

"testMate.cpp.test.advancedExecutables": [
    {
        "pattern": "${command:cmake.activeFolderName}/bin/linux/${command:cmake.buildType}/**/*{test,Test,TEST}*",
        // "cwd": "${relDirpath}/ctest_cwds/${filename}",
        "gtest": {
            "testGrouping": {
                "groupByExecutable": {
                    "label": "${absDirpath[-4:-3]}",
                    "description": "${relDirpath}",
                    "mergeByLabel": true,
                    "groupByExecutable": {
                        "label": "${filename}",
                        "description": "${workspaceName}",
                        "groupByTags": {
                            "tags": [],
                            "tagFormat": "${tag}"
                        }
                    },
                }
            }
        }
    }
],

producing the following tree view in the Test Explorer:

projectA
    executable1
        TestClassA
            testA1
            tetsA2
        TestClassB
            testB1
            tetsB2
    executable2
        TestClassC
            testC1
            tetsC2
        TestClassD
            testD1
            tetsD2

After uncommenting the cwd line:

"testMate.cpp.test.advancedExecutables": [
    {
        "pattern": "${command:cmake.activeFolderName}/bin/linux/${command:cmake.buildType}/**/*{test,Test,TEST}*",
        "cwd": "${relDirpath}/ctest_cwds/${filename}",
        "gtest": {
            "testGrouping": {
                "groupByExecutable": {
                    "label": "${absDirpath[-4:-3]}",
                    "description": "${relDirpath}",
                    "mergeByLabel": true,
                    "groupByExecutable": {
                        "label": "${filename}",
                        "description": "${workspaceName}",
                        "groupByTags": {
                            "tags": [],
                            "tagFormat": "${tag}"
                        }
                    },
                }
            }
        }
    }
],

tree view in the Test Explorer doesn't merge 1st level label:

projectA
    executable1
        TestClassA
            testA1
            tetsA2
        TestClassB
            testB1
            tetsB2
projectA
    executable2
        TestClassC
            testC1
            tetsC2
        TestClassD
            testD1
            tetsD2

Each executable has its own 1st level node (projectA in the example).

Desktop

  • Extension Version: v4.9.0
  • VS Code Version: 1.85.2
  • Catch2 / Google Test / DOCTest Version: Google Test 1.6
  • OS Type and Version: Windows 11 23H2
  • Using remote-ssh/docker/wsl?: Using remote dev container (CentOS 7) with WSL 2 (Ubuntu 22.04)
@matepek matepek added the incomplete Make sure you followed the issue template label Mar 5, 2024
@matepek
Copy link
Owner

matepek commented Mar 5, 2024

where is the ProjectA coming from?

@rafalborczuch
Copy link
Author

The above assumes that the directory structure is as follows:

repo
    projectA
    projectB
    repo.code-workspace

and it is opened in the VS Code as a mutli-root workspace file repo.code-workspace that has the following folders defined:

"folders": [
    {
        "path": "projectA"
    },
    {
        "path": "projectB"
    }
]

The build output binaries are placed under projectA/bin/linux/Debug and projectB/bin/linux/Debug and the "label": "${absDirpath[-4:-3]}", results in projectA or projectB.

@matepek
Copy link
Owner

matepek commented Mar 6, 2024

And what is the expectations for that label?
It's a but unclear what is the current value and what you expect.
Have you tried using ${relDirpath[0]}?

@rafalborczuch
Copy link
Author

${relDirpath[0]} gives the same result.
The expected top level label is projectA or projectB.

@rafalborczuch
Copy link
Author

The problem is here: https://github.com/matepek/vscode-catch2-test-adapter/blob/master/src/framework/AbstractExecutable.ts#L293
The this.shared.options has cwd which has different value for each executable (due to the advancedExecutable config "cwd": "${relDirpath}/ctest_cwds/${filename}") resulting in different options hash value that is used to construct the id.
The mergeByLabel configuration works more like mergeByEnvAndCwd.

@matepek
Copy link
Owner

matepek commented Mar 9, 2024

is ${relDirpath}/ctest_cwds/${filename} a directory or a file?

@matepek
Copy link
Owner

matepek commented Mar 9, 2024

Fixed in v4.11.0.

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 Mar 9, 2024
@rafalborczuch
Copy link
Author

Thanks, I have successfully verified the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incomplete Make sure you followed the issue template
Projects
None yet
Development

No branches or pull requests

2 participants