diff --git a/Version.ps1 b/Version.ps1 index 6f00b162f..d31f6f9f2 100644 --- a/Version.ps1 +++ b/Version.ps1 @@ -38,7 +38,7 @@ try $Build = [int]($env:appveyor_build_number) } else { - $Build = [int](Get-Content "Versions\build.txt") + $Build = [int](Get-Content "Versions\build.txt") + 1 } if (!$Build) { $Build = 0 } $SciVer = [int](Get-Content "scintilla\version.txt") @@ -68,9 +68,7 @@ catch } finally { - if (-not $AppVeyorEnv) { - $Build + 1 | Set-Content "Versions\build.txt" - } + $Build | Set-Content "Versions\build.txt" [Environment]::SetEnvironmentVariable("LASTEXITCODE", $LastExitCode, "User") $host.SetShouldExit($LastExitCode) Write-Host "VersionPatching: Done! Elapsed time: $($stopwatch.Elapsed)." diff --git a/Versions/build.txt b/Versions/build.txt index 696290484..2550c37fd 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -569 +586 diff --git a/appveyor.yml b/appveyor.yml index c1b861192..c47544787 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -180,6 +180,7 @@ before_test: # to run your custom scripts instead of automatic tests test_script: + - TestFileVersion.cmd - TestAhkNotepad3.cmd # scripts to run after tests diff --git a/test/TestAhkNotepad3.cmd b/test/TestAhkNotepad3.cmd index 2c61462a0..69e253ffb 100644 --- a/test/TestAhkNotepad3.cmd +++ b/test/TestAhkNotepad3.cmd @@ -6,7 +6,7 @@ set CWD=%CD% set TEST_DIR=%SCRIPTDIR%_TESTDIR\ set TEST_LOG=test.log -set NP3_DISTRIB_DIR=%SCRIPT_DIR%..\distrib\ +set NP3_CONFIG_DIR=%SCRIPT_DIR%config\ set NP3_WIN32_DIR=%SCRIPT_DIR%..\Bin\Release_x86_v141\ set NP3_X64_DIR=%SCRIPT_DIR%..\Bin\Release_x64_v141\ @@ -16,33 +16,31 @@ set AHK_EXE64=%ProgramFiles%/AutoHotkey/AutoHotkeyU32.exe if not exist "%AHK_EXE%" set AHK_EXE=%AHK_EXE32% if not exist "%AHK_EXE%" set AHK_EXE=%AHK_EXE64% -set EXITCODE=0 - :: -------------------------------------------------------------------------------------------------------------------- :: prepare tests if not exist "%TEST_DIR%" mkdir "%TEST_DIR%" -copy "%NP3_DISTRIB_DIR%Notepad3.ini" "%TEST_DIR%Notepad3.ini" /Y /V +if not exist "%TEST_DIR%Favorites\" mkdir "%TEST_DIR%Favorites\" +copy "%NP3_CONFIG_DIR%Notepad3_distrib.ini" "%TEST_DIR%Notepad3.ini" /Y /V if exist "%NP3_WIN32_DIR%Notepad3.exe" copy /B "%NP3_WIN32_DIR%Notepad3.exe" /B "%TEST_DIR%Notepad3.exe" /Y /V if exist "%NP3_X64_DIR%Notepad3.exe" copy /B "%NP3_X64_DIR%Notepad3.exe" /B "%TEST_DIR%Notepad3.exe" /Y /V -rem Loop over all ahk files in tests directory -rem for /r %%i in (*.ahk) do ( -rem echo ** Running %%~nxi ** -rem start "testing" /B /wait "%AHK_EXE%" /ErrorStdOut %%~nxi > %TEST_LOG% 2>&1 -rem if errorlevel 1 ( -rem set err_level=%ERRORLEVEL% -rem echo *** Test file %%~nxi failed *** -rem ) -rem type testoutput.txt -rem echo. -rem ) - -:: START Testing -start "Testing" /B /Wait "%AHK_EXE%" /ErrorStdOut "%~dpn0.ahk" > "%TEST_LOG%" 2>&1 -if errorlevel 1 ( - set EXITCODE=%ERRORLEVEL% - echo *** Test failed *** >> "%TEST_LOG%" +::Loop over all ahk files in tests directory +echo. > "%TEST_LOG%" +set EXITCODE=0 +::for /r %%i in (*.ahk) do ( +for %%i in (*.ahk) do ( + echo - Run Testsuite %%~nxi + echo +++ Run Testsuite %%~nxi +++ >> "%TEST_LOG%" + start "testing" /B /Wait "%AHK_EXE%" /ErrorStdOut "%%~nxi" >> "%TEST_LOG%" 2>&1 + if errorlevel 1 ( + set EXITCODE=%ERRORLEVEL% + echo *** Testsuite %%~nxi failed! *** + echo *** ERROR: Testsuite %%~nxi failed! *** >> "%TEST_LOG%" + ) else ( + echo +++ Testsuite %%~nxi succeeded. +++ >> "%TEST_LOG%" + ) + echo. >> "%TEST_LOG%" ) :: -------------------------------------------------------------------------------------------------------------------- @@ -53,7 +51,4 @@ endlocal & set EXITCODE=%EXITCODE% ::echo.EXITCODE=%EXITCODE% ::pause if [%EXITCODE%] NEQ [0] exit /B %EXITCODE% - -:: -------------------------------------------------------------------------------------------------------------------- :: ==================================================================================================================== - \ No newline at end of file diff --git a/test/TestFileVersion.cmd b/test/TestFileVersion.cmd new file mode 100644 index 000000000..6fd4f5727 --- /dev/null +++ b/test/TestFileVersion.cmd @@ -0,0 +1,86 @@ +@echo off +setlocal enableextensions +set SCRIPT_DIR=%~dp0 + +set NP3_WIN32_DIR=%SCRIPT_DIR%..\Bin\Release_x86_v141\ +set NP3_X64_DIR=%SCRIPT_DIR%..\Bin\Release_x64_v141\ +set NP3_BUILD_VER=%SCRIPT_DIR%..\Versions\build.txt + +:: -------------------------------------------------------------------------------------------------------------------- + +set YY=00 +set MM=00 +set DD=00 +call :GETDATE +set BUILD=0 +call :GETBUILD "%~1" +set VERSHOULD=2.%YY%.%MM%%DD%.%BUILD% + +:: -------------------------------------------------------------------------------------------------------------------- + +set TEST_SUCCEEDED=false + +set FILEVER= +if exist "%NP3_WIN32_DIR%Notepad3.exe" call :GETFILEVER "%NP3_WIN32_DIR%Notepad3.exe" +if exist "%NP3_X64_DIR%Notepad3.exe" call :GETFILEVER "%NP3_X64_DIR%Notepad3.exe" +if defined FILEVER call :COMPAREVER "%VERSHOULD%" "%FILEVER%" + +:: ==================================================================================================================== +goto :END +:: -------------------------------------------------------------------------------------------------------------------- + +:COMPAREVER +if ["%~1"] EQU ["%~2"] ( + set TEST_SUCCEEDED=true +) +goto:EOF +:: -------------------------------------------------------------------------------------------------------------------- + +:GETDATE +for /f "tokens=2 delims==" %%a in (' + wmic OS Get localdatetime /value +') do set "dt=%%a" +set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" +set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%" +::set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%" +::set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%" +::echo datestamp: "%datestamp%" +::echo timestamp: "%timestamp%" +::echo fullstamp: "%fullstamp%" +goto:EOF +:: -------------------------------------------------------------------------------------------------------------------- + +:GETFILEVER +set "file=%~1" +if not defined file goto:EOF +if not exist "%file%" goto:EOF +set "FILEVER=" +for /F "tokens=2 delims==" %%a in (' + wmic datafile where name^="%file:\=\\%" Get Version /value +') do set "FILEVER=%%a" +::echo %file% = %FILEVER% +goto:EOF +:: -------------------------------------------------------------------------------------------------------------------- + +:GETBUILD +set argbuild=%~1 +if defined argbuild ( + set BUILD=%argbuild% + goto:EOF +) +::set /p nxbuild=<"%NP3_BUILD_VER%" +::set /a BUILD=%nxbuild% - 1 +set /p BUILD=<"%NP3_BUILD_VER%" +goto:EOF +:: -------------------------------------------------------------------------------------------------------------------- + +:: ==================================================================================================================== +:END +echo.VERSHOULD = %VERSHOULD% +echo.FILEVER = %FILEVER% +echo.TEST_SUCCEEDED = %TEST_SUCCEEDED% +:: - make TEST_SUCCEEDED survive 'endlocal' +endlocal & set TEST_SUCCEEDED=%TEST_SUCCEEDED% +::pause +if [%TEST_SUCCEEDED%] NEQ [true] exit /B 1 +:: ==================================================================================================================== diff --git a/test/conf/Notepad3_test_X.ini b/test/config/Notepad3_distrib.ini similarity index 100% rename from test/conf/Notepad3_test_X.ini rename to test/config/Notepad3_distrib.ini diff --git a/test/txt/korean-Win-949.txt b/test/txtfiles/korean-Win-949.txt similarity index 100% rename from test/txt/korean-Win-949.txt rename to test/txtfiles/korean-Win-949.txt diff --git a/test/txt/regex_find.txt b/test/txtfiles/regex_find.txt similarity index 100% rename from test/txt/regex_find.txt rename to test/txtfiles/regex_find.txt diff --git a/test/txt/strange.txt b/test/txtfiles/strange.txt similarity index 100% rename from test/txt/strange.txt rename to test/txtfiles/strange.txt