Verify icon indicating copy to clipboard operation
Verify copied to clipboard

Issue with report with Linux file paths when updating from 23.7.1 to 23.7.2

Open jairbubbles opened this issue 2 years ago • 1 comments

Hello,

Updating from 23.7.1 to 23.7.2 is breaking my CI. I'm building my application on a Windows machine and executing the tests on a Linux one.

In the CI log we can see:

VerifyException : Directory: D:\b\0\2091\Source\Macros\Tests\Source\Scripting/D:\b\0\2091\Source\Macros\Tests\Source\Scripting
New:
  - Received: D:\b\0\2091\Source\Macros\Tests\Source\Scripting/D:\b\0\2091\Source\Macros\Tests\Source\Scripting/Test_Generate_Project_Is_Deterministic.net60.LINUX.DotNet6_0.received.txt
    Verified: D:\b\0\2091\Source\Macros\Tests\Source\Scripting/D:\b\0\2091\Source\Macros\Tests\Source\Scripting/Test_Generate_Project_Is_Deterministic.net60.LINUX.verified.txt

When looking closely we can see that the path is concatenated twice:

D:\b\0\2091\Source\Macros\Tests\Source\Scripting/D:\b\0\2091\Source\Macros\Tests\Source\Scripting/

The settings are set like that:

        private VerifySettings GetVerifySettings([CallerMemberName] string methodName = null)
        {
            var settings = new VerifySettings();
            settings.DisableRequireUniquePrefix();

            string fileName;
#if NET472
            fileName = $"{methodName}.net472";
#else
            fileName = $"{methodName}.net60";
#endif
            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                fileName += ".OSX";
            else if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                fileName += ".LINUX";

            settings.UseFileName(fileName);
            return settings;
        }

I quickly looked at the diff and I can see some changes regarding path concatenation that might explain the regression.

(the issue is also present with version 24.1.0)

jairbubbles avatar Apr 22 '24 15:04 jairbubbles

can u share a repro

SimonCropp avatar Apr 26 '24 07:04 SimonCropp

bump

SimonCropp avatar May 06 '24 09:05 SimonCropp

Hi @SimonCropp, the original repository is on an internal GitLab instance. As it also relies on specific build infrastructure I don't really see how can I share something meaningful.

Also, I don't think there's anything special about my test except that it's being built on Windows and the test ran on another Linux machine.

jairbubbles avatar May 06 '24 12:05 jairbubbles

I'll try to reproduce it with a sample and WSL.

jairbubbles avatar May 06 '24 12:05 jairbubbles

Here you go: TestVerify.zip

To repro:

  • Run on Windows: dotnet test
  • Then execute on Linux (through WSL): wsl dotnet test --no-build

I get the output:

Test run for /mnt/c/Users/jrichard/RiderProjects/TestVerify/TestVerify/bin/Debug/net8.0/TestVerify.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
  Failed CrossPlatformTest [1 s]
  Error Message:
   VerifyException : Directory: C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/C:\Users\jrichard\RiderProjects\TestVerify\TestVerify
NotEqual:
  - Received: C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/CrossPlatformTest.net60.LINUX.received.txt
    Verified: C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/CrossPlatformTest.net60.LINUX.verified.txt

FileContent:

NotEqual:

Received: C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/CrossPlatformTest.net60.LINUX.received.txt
test
Verified: C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/C:\Users\jrichard\RiderProjects\TestVerify\TestVerify/CrossPlatformTest.net60.LINUX.verified.txt



  Stack Trace:

Failed!  - Failed:     1, Passed:     0, Skipped:     0, Total:     1, Duration: 1 s - TestVerify.dll (net8.0)

jairbubbles avatar May 06 '24 13:05 jairbubbles

i am having rouble finding the time to dedicate to this. do you want to have a go at submitting a PR that fixes it?

SimonCropp avatar May 19 '24 11:05 SimonCropp

Sure @SimonCropp I can take a look.

jairbubbles avatar May 20 '24 14:05 jairbubbles