aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/vstools/tests.cmd
blob: 1571e33abbe460535ee042382c7a904582a23164 (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
:: Copyright (C) 2025 The Qt Company Ltd.
:: SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::tests.cmd
:: * Looks for auto-tests generated during build
:: * Runs the auto-tests that were found
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

ECHO.
%##########################%
%##% %BOLD%Finding tests...%RESET%

DEL %TEMP%\vstools.args > NUL 2>&1

IF %VERBOSE% %##% DIR /S /B /A:D Tests\Test_*
FOR /F %ALL% %%c IN (`DIR /S /B /A:D Tests\Test_*`) DO (
IF %VERBOSE% %##% testProject: %%c
    IF %VERBOSE% %##% WHERE /R %%c\bin\%BUILD_CONFIGURATION% Test_*.dll
    IF %VERBOSE% WHERE /R %%c\bin\%BUILD_CONFIGURATION% Test_*.dll
    WHERE /R %%c\bin\%BUILD_CONFIGURATION% Test_*.dll >> %TEMP%\vstools.args 2> NUL
)

IF %VERBOSE% %##% FINDSTR /C:dll %TEMP%\vstools.args
IF %VERBOSE% FINDSTR /C:dll %TEMP%\vstools.args
FINDSTR /C:dll %TEMP%\vstools.args > NUL 2>&1 ^
&& (
    FOR /F %%c in ('TYPE %TEMP%\vstools.args') DO %##%   * %%~nc
    %##########################%
    ECHO.
    %##########################%
    %##% %BOLD%Running tests...%RESET%
    %##########################%
    IF NOT %VERBOSE% ECHO %DARK_GRAY%
    IF %VERBOSE% (
        %##% vstest.console /logger:console;verbosity=detailed @%TEMP%\vstools.args
        vstest.console /logger:console;verbosity=detailed @%TEMP%\vstools.args ^
        || (
            ECHO %RESET%
            GOTO :error
        )
    ) ELSE (
        vstest.console @%TEMP%\vstools.args ^
        || (
            ECHO %RESET%
            GOTO :error
        )
    )
) || (
    %##%   * %BOLD%%YELLOW%No tests found.%RESET%
    %##########################%
    GOTO :eof
)

ECHO %RESET%
CALL %SCRIPTLIB%\info.cmd "version"
%##% %BOLD%%GREEN%Test run successful.%RESET%
%##########################%
GOTO :eof

:error
IF %ERRORLEVEL% NEQ 0 (
    CALL %SCRIPTLIB%\error.cmd %ERRORLEVEL% "Tests failed!"
    EXIT /B %ERRORLEVEL%
)