Merge remote-tracking branch 'notepad3_orig_rizone/master'

This commit is contained in:
Rainer Kottenhoff 2017-10-11 15:45:20 +02:00
commit 729daeeea5
9 changed files with 109 additions and 29 deletions

View File

@ -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)."

View File

@ -1 +1 @@
569
586

View File

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

View File

@ -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%
:: --------------------------------------------------------------------------------------------------------------------
:: ====================================================================================================================

86
test/TestFileVersion.cmd Normal file
View File

@ -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
:: ====================================================================================================================