-
Notifications
You must be signed in to change notification settings - Fork 705
/
test.bat
50 lines (42 loc) · 1.97 KB
/
test.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@echo OFF
SETLOCAL EnableDelayedExpansion
@REM A Windows domain user should be able to run this against a feed in an AAD-back AzDO org
@REM and all scenarios should succeed non-interactively.
IF "%~1" == "" (
echo "Please specify an AzDO organization package feed URL as the first parameter."
exit /b 1
)
set TEST_FEED=%1
set NUGET_CREDENTIALPROVIDER_MSAL_FILECACHE_ENABLED=true
set NUGET_CREDENTIALPROVIDER_MSAL_FILECACHE_LOCATION=%TEMP%\msal.cache
IF EXIST %NUGET_CREDENTIALPROVIDER_MSAL_FILECACHE_LOCATION% (del /q %NUGET_CREDENTIALPROVIDER_MSAL_FILECACHE_LOCATION%)
echo "Testing MSAL with broker"
set NUGET_CREDENTIALPROVIDER_MSAL_ALLOW_BROKER=true
CALL :TEST_FRAMEWORKS
IF %ERRORLEVEL% NEQ 0 (
echo "Failed: %ERRORLEVEL%"
exit /b %ERRORLEVEL%
)
echo "Testing MSAL without broker"
set NUGET_CREDENTIALPROVIDER_MSAL_ALLOW_BROKER=false
CALL :TEST_FRAMEWORKS
IF %ERRORLEVEL% NEQ 0 (
echo "Failed: %ERRORLEVEL%"
exit /b %ERRORLEVEL%
)
echo "All tests passed!"
exit /b 0
:TEST_FRAMEWORKS
for %%I in ("netcoreapp3.1","net461","net481","net6.0","net8.0") DO (
del /q "!UserProfile!\AppData\Local\MicrosoftCredentialProvider\*.dat" 2>NUL
del /q "%NUGET_CREDENTIALPROVIDER_MSAL_FILECACHE_LOCATION%" 2>NUL
echo Testing %%I with NUGET_CREDENTIALPROVIDER_MSAL_ALLOW_BROKER=!NUGET_CREDENTIALPROVIDER_MSAL_ALLOW_BROKER!
echo dotnet run --no-restore --no-build -f %%I --project CredentialProvider.Microsoft\CredentialProvider.Microsoft.csproj -- -C -U !TEST_FEED! -V Debug
dotnet run --no-restore --no-build -f %%I --project CredentialProvider.Microsoft\CredentialProvider.Microsoft.csproj -- -C -U !TEST_FEED! -V Debug ^
> test.%%I.%NUGET_CREDENTIALPROVIDER_MSAL_ALLOW_BROKER%.log
IF !ERRORLEVEL! NEQ 0 (
echo "Previous command execution failed: !ERRORLEVEL!"
dotnet run --no-restore --no-build -f %%I --project CredentialProvider.Microsoft\CredentialProvider.Microsoft.csproj -- -C -U !TEST_FEED! -V Debug
exit /b !ERRORLEVEL!
)
)