Kaynağa Gözat

Move windows CI onto runtests.py

rhuanjl 5 yıl önce
ebeveyn
işleme
8a15bcb75c

+ 1 - 5
test/jenkins.build.cmd → test/ci.build.cmd

@@ -1,16 +1,12 @@
 ::-------------------------------------------------------------------------------------------------------
 ::-------------------------------------------------------------------------------------------------------
 :: Copyright (C) Microsoft. All rights reserved.
 :: Copyright (C) Microsoft. All rights reserved.
+:: Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
 :: Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 :: Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 ::-------------------------------------------------------------------------------------------------------
 ::-------------------------------------------------------------------------------------------------------
 
 
 @echo off
 @echo off
 setlocal
 setlocal
 
 
-if not "%JENKINS_BUILD%" == "True" (
-    echo This script should be run under a Jenkins Build environment
-    exit /b 2
-)
-
 if "%_ENTRY_SCRIPT_NAME%"=="" (
 if "%_ENTRY_SCRIPT_NAME%"=="" (
     set _ENTRY_SCRIPT_NAME=%0
     set _ENTRY_SCRIPT_NAME=%0
 )
 )

+ 1 - 5
test/jenkins.build.init.cmd → test/ci.build.init.cmd

@@ -1,15 +1,11 @@
 ::-------------------------------------------------------------------------------------------------------
 ::-------------------------------------------------------------------------------------------------------
 :: Copyright (C) Microsoft. All rights reserved.
 :: Copyright (C) Microsoft. All rights reserved.
+:: Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
 :: Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 :: Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 ::-------------------------------------------------------------------------------------------------------
 ::-------------------------------------------------------------------------------------------------------
 
 
 @echo off
 @echo off
 
 
-if not "%JENKINS_BUILD%" == "True" (
-    echo This script should be run under a Jenkins Build environment
-    exit /b 2
-)
-
 set REPO_ROOT=%~dp0\..
 set REPO_ROOT=%~dp0\..
 
 
 set JENKINS_BUILD_ARGS=
 set JENKINS_BUILD_ARGS=

+ 51 - 0
test/ci.buildone.cmd

@@ -0,0 +1,51 @@
+::-------------------------------------------------------------------------------------------------------
+:: Copyright (C) Microsoft. All rights reserved.
+:: Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
+:: Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+::-------------------------------------------------------------------------------------------------------
+
+@echo off
+setlocal
+
+if "%_ENTRY_SCRIPT_NAME%"=="" (
+    set _ENTRY_SCRIPT_NAME=%0
+)
+
+REM check that we have enough parameters
+if "%1"=="" (
+    goto :usage
+)
+if "%2"=="" (
+    goto :usage
+)
+
+pushd %~dp0
+
+call ci.build.init.cmd %*
+
+set _BuildArch=
+set _BuildType=
+
+call ci.build.cmd %JENKINS_BUILD_ARGS%
+
+popd
+goto :end
+
+:: ============================================================================
+:: Not enough params
+:: ============================================================================
+:usage
+
+    echo Not enough parameters. Please specify architecture and type.
+    echo Examples:
+    echo.
+    echo     %_ENTRY_SCRIPT_NAME% x86 debug
+    echo     %_ENTRY_SCRIPT_NAME% x86 test
+    echo     %_ENTRY_SCRIPT_NAME% x86 release
+    echo.
+    echo     %_ENTRY_SCRIPT_NAME% x64 debug
+    echo     %_ENTRY_SCRIPT_NAME% x64 test
+    echo     %_ENTRY_SCRIPT_NAME% x64 release
+
+:end
+endlocal

+ 3 - 6
test/jenkins.parsetestargs.cmd → test/ci.parsetestargs.cmd

@@ -1,13 +1,9 @@
 ::-------------------------------------------------------------------------------------------------------
 ::-------------------------------------------------------------------------------------------------------
 :: Copyright (C) Microsoft. All rights reserved.
 :: Copyright (C) Microsoft. All rights reserved.
+:: Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
 :: Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 :: Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 ::-------------------------------------------------------------------------------------------------------
 ::-------------------------------------------------------------------------------------------------------
 
 
-if not "%JENKINS_BUILD%" == "True" (
-    echo This script should be run under a Jenkins Build environment
-    exit /b 2
-)
-
 if "%_ENTRY_SCRIPT_NAME%"=="" (
 if "%_ENTRY_SCRIPT_NAME%"=="" (
     echo This script is a utility and should not be called as a script entry point.
     echo This script is a utility and should not be called as a script entry point.
 )
 )
@@ -74,7 +70,8 @@ if not "%1"=="" (
 
 
     if "%1"=="-disablejit" (
     if "%1"=="-disablejit" (
         set _SpecialBuild=.NoJIT
         set _SpecialBuild=.NoJIT
-        REM fallthrough to default (also add this to %_ExtraTestArgs%)
+        shift
+        goto :ContinueArgParse
     )
     )
 
 
     if "%1"=="-lite" (
     if "%1"=="-lite" (

+ 53 - 28
test/jenkins.testone.cmd → test/ci.testone.cmd

@@ -6,10 +6,10 @@
 
 
 :: ============================================================================
 :: ============================================================================
 ::
 ::
-:: jenkins.testone.cmd
+:: testone.cmd
 ::
 ::
-:: Runs tests for Jenkins continuous integration. This script is called from
-:: the Jenkins CI build and it runs all tests for x86 and x64, debug and test
+:: Runs tests for continuous integration. This script is called from
+:: the CI build and it runs all tests for x86 and x64, debug and test
 :: build configs.
 :: build configs.
 ::
 ::
 :: Do not use this script to run all tests on your dev box.
 :: Do not use this script to run all tests on your dev box.
@@ -29,6 +29,18 @@
 @echo off
 @echo off
 setlocal
 setlocal
 
 
+REM check that we have enough parameters
+if "%1"=="" (
+    goto :usage
+)
+if "%2"=="" (
+    goto :usage
+)
+
+if "%_ENTRY_SCRIPT_NAME%"=="" (
+    set _ENTRY_SCRIPT_NAME=%0
+)
+
 set _RootDir=%~dp0..
 set _RootDir=%~dp0..
 set _HadFailures=0
 set _HadFailures=0
 set _error=0
 set _error=0
@@ -38,15 +50,10 @@ set _error=0
 :: ============================================================================
 :: ============================================================================
 :main
 :main
 
 
-  if not "%JENKINS_BUILD%" == "True" (
-    echo This script should be run under a Jenkins Build environment
-    exit /b 2
-  )
-
   pushd %_RootDir%\test
   pushd %_RootDir%\test
   set _TestDir=%CD%
   set _TestDir=%CD%
 
 
-  call jenkins.parsetestargs.cmd %*
+  call ci.parsetestargs.cmd %*
 
 
   set _LogDir=%_TestDir%\logs\%_TestArch%_%_TestType%
   set _LogDir=%_TestDir%\logs\%_TestArch%_%_TestType%
   set _TestArgs=%_TestArch%%_TestType%
   set _TestArgs=%_TestArch%%_TestType%
@@ -60,28 +67,27 @@ set _error=0
     call :runTests %_TestArgs%
     call :runTests %_TestArgs%
 
 
     if "%_ReducedTestRun%" == "1" (
     if "%_ReducedTestRun%" == "1" (
-      echo -- jenkins.testone.cmd ^>^> Reduced test run: skipping native tests.
+      echo -- ci.testone.cmd ^>^> Reduced test run: skipping native tests.
     ) else (
     ) else (
       call :runNativeTests %_TestArgs%
       call :runNativeTests %_TestArgs%
     )
     )
-
-    call :summarizeLogs
   )
   )
 
 
   echo.
   echo.
-  echo -- jenkins.testone.cmd ^>^> Failure code: %_HadFailures%
+  echo -- ci.testone.cmd ^>^> Failure code: %_HadFailures%
   if "%_HadFailures%" NEQ "0" (
   if "%_HadFailures%" NEQ "0" (
     if "%_HadFailures%" == "2" (
     if "%_HadFailures%" == "2" (
-      echo -- jenkins.testone.cmd ^>^> Bytecode test failed, bytecode needs to be updated! 1>&2
+      echo -- ci.testone.cmd ^>^> Bytecode test failed, bytecode needs to be updated! 1>&2
     ) else if "%_HadFailures%" == "3" (
     ) else if "%_HadFailures%" == "3" (
-      echo -- jenkins.testone.cmd ^>^> Unit tests failed! 1>&2
+      echo -- ci.testone.cmd ^>^> Unit tests failed! 1>&2
     ) else if "%_HadFailures%" == "4" (
     ) else if "%_HadFailures%" == "4" (
-      echo -- jenkins.testone.cmd ^>^> Native tests failed! 1>&2
+      echo -- ci.testone.cmd ^>^> Native tests failed! 1>&2
+      call :summarizeLogs
     ) else (
     ) else (
-      echo -- jenkins.testone.cmd ^>^> Unknown failure! 1>&2
+      echo -- ci.testone.cmd ^>^> Unknown failure! 1>&2
     )
     )
   ) else (
   ) else (
-    echo -- jenkins.testone.cmd ^>^> Tests passed!
+    echo -- ci.testone.cmd ^>^> Tests passed!
   )
   )
 
 
   popd
   popd
@@ -103,7 +109,7 @@ set _error=0
   call :do python %_RootDir%\tools\regenByteCode.py --verify %bytecode_type% --%_TestArch% --binary=%_BinDir%\%_TestArch%_%_TestType%\ch.exe
   call :do python %_RootDir%\tools\regenByteCode.py --verify %bytecode_type% --%_TestArch% --binary=%_BinDir%\%_TestArch%_%_TestType%\ch.exe
 
 
   if "%_error%" NEQ "0" (
   if "%_error%" NEQ "0" (
-    echo -- jenkins.testone.cmd ^>^> verifying bytecode failed
+    echo -- ci.testone.cmd ^>^> verifying bytecode failed
     set _HadFailures=2
     set _HadFailures=2
   )
   )
 
 
@@ -114,10 +120,14 @@ set _error=0
 :: ============================================================================
 :: ============================================================================
 :runTests
 :runTests
 
 
-  call :do %_TestDir%\runtests.cmd -%1 -quiet -cleanupall -nottags exclude_jenkins %_ExtraTestArgs% -binDir %_BinDir%
+  if "%_SpecialBuild%" == ".NoJIT" (
+    set OverideVariant=--variants=disable_jit
+  )
+
+  call :do python %_TestDir%\runtests.py --%_TestArch% --%_TestType% %OverideVariant% %_ExtraTestArgs% --binary=%_BinDir%\%_TestArch%_%_TestType%\ch.exe
 
 
   if "%_error%" NEQ "0" (
   if "%_error%" NEQ "0" (
-    echo -- jenkins.testone.cmd ^>^> runtests.cmd failed
+    echo -- ci.testone.cmd ^>^> runtests.py failed
     set _HadFailures=3
     set _HadFailures=3
   )
   )
 
 
@@ -128,14 +138,14 @@ set _error=0
 :: ============================================================================
 :: ============================================================================
 :runNativeTests
 :runNativeTests
 
 
-  echo -- jenkins.testone.cmd ^>^> Running native tests... this can take some time
+  echo -- ci.testone.cmd ^>^> Running native tests... this can take some time
   if not exist %_LogDir%\ mkdir %_LogDir%
   if not exist %_LogDir%\ mkdir %_LogDir%
   set _LogFile=%_LogDir%\nativetests.log
   set _LogFile=%_LogDir%\nativetests.log
   call :do %_TestDir%\runnativetests.cmd -%1 -binDir %_BinDir% -d yes > %_LogFile% 2>&1
   call :do %_TestDir%\runnativetests.cmd -%1 -binDir %_BinDir% -d yes > %_LogFile% 2>&1
-  echo -- jenkins.testone.cmd ^>^> Running native tests... DONE!
+  echo -- ci.testone.cmd ^>^> Running native tests... DONE!
 
 
   if "%_error%" NEQ "0" (
   if "%_error%" NEQ "0" (
-    echo -- jenkins.testone.cmd ^>^> runnativetests.cmd failed; printing %_LogFile%
+    echo -- ci.testone.cmd ^>^> runnativetests.cmd failed; printing %_LogFile%
     powershell "if (Test-Path %_LogFile%) { Get-Content %_LogFile% }"
     powershell "if (Test-Path %_LogFile%) { Get-Content %_LogFile% }"
     set _HadFailures=4
     set _HadFailures=4
   )
   )
@@ -148,11 +158,9 @@ set _error=0
 :summarizeLogs
 :summarizeLogs
 
 
   pushd %_LogDir%
   pushd %_LogDir%
-  findstr /sp failed rl.results.log > summary.log
   findstr /sip failed nativetests.log >> summary.log
   findstr /sip failed nativetests.log >> summary.log
   rem Echo to stderr so that VSO includes the output in the build summary
   rem Echo to stderr so that VSO includes the output in the build summary
 
 
-  echo -- jenkins.testone.cmd ^>^> Printing summary...
   type summary.log 1>&2
   type summary.log 1>&2
   popd
   popd
 
 
@@ -161,7 +169,7 @@ set _error=0
 :: ============================================================================
 :: ============================================================================
 :do
 :do
 
 
-  echo -- jenkins.testone.cmd ^>^> :do %*
+  echo -- ci.testone.cmd ^>^> :do %*
   cmd /s /c "%*"
   cmd /s /c "%*"
   set _error=%ERRORLEVEL%
   set _error=%ERRORLEVEL%
 
 
@@ -173,8 +181,25 @@ set _error=0
 :: ============================================================================
 :: ============================================================================
 :doSilent
 :doSilent
 
 
-  echo -- jenkins.testone.cmd ^>^> :doSilent %* ^> nul 2^>^&1
+  echo -- ci.testone.cmd ^>^> :doSilent %* ^> nul 2^>^&1
   cmd /s /c "%* > nul 2>&1"
   cmd /s /c "%* > nul 2>&1"
   set _error=%ERRORLEVEL%
   set _error=%ERRORLEVEL%
 
 
   goto :eof
   goto :eof
+
+
+:: ============================================================================
+:: Not enough params
+:: ============================================================================
+:usage
+
+    echo Not enough parameters. Please specify architecture and type.
+    echo Examples:
+    echo.
+    echo     %_ENTRY_SCRIPT_NAME% x86 debug
+    echo     %_ENTRY_SCRIPT_NAME% x86 test
+    echo.
+    echo     %_ENTRY_SCRIPT_NAME% x64 debug
+    echo     %_ENTRY_SCRIPT_NAME% x64 test
+
+    goto :end

+ 0 - 29
test/jenkins.buildone.cmd

@@ -1,29 +0,0 @@
-::-------------------------------------------------------------------------------------------------------
-:: Copyright (C) Microsoft. All rights reserved.
-:: Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
-::-------------------------------------------------------------------------------------------------------
-
-@echo off
-setlocal
-
-if not "%JENKINS_BUILD%" == "True" (
-    echo This script should be run under a Jenkins Build environment
-    exit /b 2
-)
-
-if "%_ENTRY_SCRIPT_NAME%"=="" (
-    set _ENTRY_SCRIPT_NAME=%0
-)
-
-pushd %~dp0
-
-call jenkins.build.init.cmd %*
-
-set _BuildArch=
-set _BuildType=
-
-call jenkins.build.cmd %JENKINS_BUILD_ARGS%
-
-popd
-
-endlocal

+ 10 - 14
test/runtests.py

@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 #!/usr/bin/env python
 #-------------------------------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------------------------------
 # Copyright (C) Microsoft. All rights reserved.
 # Copyright (C) Microsoft. All rights reserved.
+# Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
 # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 #-------------------------------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------------------------------
 
 
@@ -47,19 +48,15 @@ parser.add_argument('-v', '--verbose', action='store_true',
 parser.add_argument('--sanitize', metavar='sanitizers',
 parser.add_argument('--sanitize', metavar='sanitizers',
                     help='ignore tests known to be broken with these sanitizers')
                     help='ignore tests known to be broken with these sanitizers')
 parser.add_argument('-d', '--debug', action='store_true',
 parser.add_argument('-d', '--debug', action='store_true',
-                    help='use debug build');
+                    help='use debug build')
 parser.add_argument('-t', '--test', '--test-build', action='store_true',
 parser.add_argument('-t', '--test', '--test-build', action='store_true',
                     help='use test build')
                     help='use test build')
-parser.add_argument('--static', action='store_true',
-                    help='mark that we are testing a static build')
 parser.add_argument('--variants', metavar='variant', nargs='+',
 parser.add_argument('--variants', metavar='variant', nargs='+',
                     help='run specified test variants')
                     help='run specified test variants')
 parser.add_argument('--include-slow', action='store_true',
 parser.add_argument('--include-slow', action='store_true',
                     help='include slow tests (timeout ' + str(SLOW_TIMEOUT) + ' seconds)')
                     help='include slow tests (timeout ' + str(SLOW_TIMEOUT) + ' seconds)')
 parser.add_argument('--only-slow', action='store_true',
 parser.add_argument('--only-slow', action='store_true',
                     help='run only slow tests')
                     help='run only slow tests')
-parser.add_argument('--nightly', action='store_true',
-                    help='run as nightly tests')
 parser.add_argument('--tag', nargs='*',
 parser.add_argument('--tag', nargs='*',
                     help='select tests with given tags')
                     help='select tests with given tags')
 parser.add_argument('--not-tag', action='append',
 parser.add_argument('--not-tag', action='append',
@@ -149,7 +146,7 @@ if binary == None:
         binary = os.path.join(repo_root, 'out', flavor, binary_name)
         binary = os.path.join(repo_root, 'out', flavor, binary_name)
 
 
 if not os.path.isfile(binary):
 if not os.path.isfile(binary):
-    print('{} not found. Did you run ./build.sh already?'.format(binary))
+    print('{} not found. Aborting.'.format(binary))
     sys.exit(1)
     sys.exit(1)
 
 
 # global tags/not_tags
 # global tags/not_tags
@@ -165,8 +162,6 @@ elif not args.include_slow:
 elif args.include_slow and args.timeout == DEFAULT_TIMEOUT:
 elif args.include_slow and args.timeout == DEFAULT_TIMEOUT:
     args.timeout = SLOW_TIMEOUT
     args.timeout = SLOW_TIMEOUT
 
 
-not_tags.add('exclude_nightly' if args.nightly else 'nightly')
-
 # verbosity
 # verbosity
 verbose = False
 verbose = False
 show_passes = False
 show_passes = False
@@ -193,9 +188,6 @@ if arch == 'arm' or arch == 'arm64':
 if args.sanitize != None:
 if args.sanitize != None:
     not_tags.add('exclude_sanitize_'+args.sanitize)
     not_tags.add('exclude_sanitize_'+args.sanitize)
 
 
-if args.static != None:
-    not_tags.add('exclude_static')
-
 if sys.platform == 'darwin':
 if sys.platform == 'darwin':
     not_tags.add('exclude_mac')
     not_tags.add('exclude_mac')
 
 
@@ -356,7 +348,9 @@ class TestVariant(object):
     # queue a test result from multi-process runs
     # queue a test result from multi-process runs
     def _log_result(self, test, fail):
     def _log_result(self, test, fail):
         if fail or show_passes:
         if fail or show_passes:
-            output = u'\n'.join(self._print_lines).encode('utf-8') # collect buffered _print output
+            output = ''
+            for line in self._print_lines:
+                output = output + line + '\n' # collect buffered _print output
         else:
         else:
             output = ''
             output = ''
         self._print_lines = []
         self._print_lines = []
@@ -412,11 +406,11 @@ class TestVariant(object):
                     if lst_output[i] != lst_expected[i]:
                     if lst_output[i] != lst_expected[i]:
                         self._print("Output: (at line " + str(i+1) + ")")
                         self._print("Output: (at line " + str(i+1) + ")")
                         self._print("----------------------------")
                         self._print("----------------------------")
-                        self._print(lst_output[i])
+                        self._print(lst_output[i].decode('utf-8'))
                         self._print("----------------------------")
                         self._print("----------------------------")
                         self._print("Expected Output:")
                         self._print("Expected Output:")
                         self._print("----------------------------")
                         self._print("----------------------------")
-                        self._print(lst_expected[i])
+                        self._print(lst_expected[i].decode('utf-8'))
                         self._print("----------------------------")
                         self._print("----------------------------")
                         break
                         break
 
 
@@ -715,6 +709,8 @@ def main():
     if hasattr(time, 'tzset'):
     if hasattr(time, 'tzset'):
         os.environ['TZ'] = 'US/Pacific'
         os.environ['TZ'] = 'US/Pacific'
         time.tzset()
         time.tzset()
+    elif sys.platform == 'win32':
+        os.system('tzutil /s "Pacific Standard time"')
 
 
     # By default run all tests
     # By default run all tests
     if len(args.folders) == 0:
     if len(args.folders) == 0: