Pārlūkot izejas kodu

Apple Silicon Test Suite updates
- update DateTimeFormat.js which required ICU_Version<72
- update ICU path for native tests (different on Apple Silicon)
- use find_package for Python

rhuanjl 3 gadi atpakaļ
vecāks
revīzija
d6e2800fa7

+ 4 - 2
test/CMakeLists.txt

@@ -1,3 +1,5 @@
+find_package (Python COMPONENTS Interpreter)
+
 if (CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
     set(TEST_BUILD_TYPE --test)
 elseif (CMAKE_BUILD_TYPE STREQUAL Debug)
@@ -31,13 +33,13 @@ if (CMAKE_BUILD_TYPE STREQUAL Release)
     add_dependencies(check smoke-check)
 else()
     add_custom_target(bytecode-check
-        COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../tools/regenByteCode.py ${VARIANT} --verify --binary=${CMAKE_BINARY_DIR}/ch
+        COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../tools/regenByteCode.py ${VARIANT} --verify --binary=${CMAKE_BINARY_DIR}/ch
         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
         USES_TERMINAL
         DEPENDS ch
         )
     add_custom_target(regression-check
-        COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/runtests.py ${TEST_BUILD_TYPE} ${TEST_ICU} ${TEST_VARIANT} --binary=${CMAKE_BINARY_DIR}/ch
+        COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/runtests.py ${TEST_BUILD_TYPE} ${TEST_ICU} ${TEST_VARIANT} --binary=${CMAKE_BINARY_DIR}/ch
         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
         USES_TERMINAL
         DEPENDS ch

+ 13 - 8
test/Intl/DateTimeFormat.js

@@ -1,5 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
+// Copyright (c) ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -63,18 +64,22 @@ const tests = [
             test({ day: "2-digit" }, "01");
             test({ day: "numeric" }, "1");
 
-            test({ hour: "2-digit" }, "01 AM");
-            test({ hour: "numeric" }, "1 AM");
+            if(!isICU || WScript.Platform.ICU_VERSION < 72)
+            {
+                test({ hour: "2-digit" }, "01 AM");
+                test({ hour: "numeric" }, "1 AM");
 
-            test({ hour: "numeric", minute: "2-digit" }, "1:01 AM");
-            test({ hour: "numeric", minute: "numeric" }, "1:01 AM");
+                test({ hour: "numeric", minute: "2-digit" }, "1:01 AM");
+                test({ hour: "numeric", minute: "numeric" }, "1:01 AM");
 
-            test({ hour: "numeric", minute: "2-digit", second: "2-digit" }, "1:01:01 AM");
+                test({ hour: "numeric", minute: "2-digit", second: "2-digit" }, "1:01:01 AM");
 
-            // WinGlob doesn't have non-2-digit seconds
-            testPlatformSpecific({ hour: "numeric", minute: "2-digit", second: "numeric" }, "1:01:01 AM", "1:01:1 AM");
+                // WinGlob doesn't have non-2-digit seconds
+                testPlatformSpecific({ hour: "numeric", minute: "2-digit", second: "numeric" }, "1:01:01 AM", "1:01:1 AM");
+
+                test({ hour: "numeric", hour12: true }, "1 AM");
+            }
 
-            test({ hour: "numeric", hour12: true }, "1 AM");
             testPlatformSpecific({ hour: "numeric", hour12: false }, "1:00", "01");
 
             const epochYear = parseInt(ascii(new Intl.DateTimeFormat("en-US", { year: "numeric", timeZone: "UTC" }).format(0)), 10);

+ 8 - 2
test/native-tests/test-shared-basic/Platform.js

@@ -1,6 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
-// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
+// Copyright (c) ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -14,6 +14,7 @@ if (isStaticBuild) {
     print("# IGNORE_THIS_TEST");
 } else {
     var platform = WScript.Platform.OS;
+    var arch = WScript.Platform.ARCH;
     var binaryPath = WScript.Platform.BINARY_PATH;
     // discard `ch` from path
     binaryPath = binaryPath.substr(0, binaryPath.lastIndexOf(path_sep));
@@ -22,10 +23,15 @@ if (isStaticBuild) {
 \n\
 LIBRARY_PATH=" + binaryPath + "/\n\
 PLATFORM=" + platform + "\n\
+ARCH=" + arch + "\n\
 LDIR=$(LIBRARY_PATH)/libChakraCore" + sharedExtension + " \n\
 \n\
 ifeq (darwin, ${PLATFORM})\n\
-\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tifeq (ARM64, ${ARCH})\n\
+\t\tICU4C_LIBRARY_PATH ?= /opt/homebrew/opt/icu4c\n\
+\t\else\n\
+\t\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tendif\n\
 \tCFLAGS=-lstdc++ -std=c++11 -I$(IDIR)\n\
 \tFORCE_STARTS=-Wl,-force_load,\n\
 \tFORCE_ENDS=\n\

+ 8 - 2
test/native-tests/test-static-c98/Platform.js

@@ -1,6 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
-// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
+// Copyright (c) ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -13,6 +13,7 @@ if (!isStaticBuild) {
     print("# IGNORE_THIS_TEST");
 } else {
     var platform = WScript.Platform.OS;
+    var arch = WScript.Platform.ARCH;
     var binaryPath = WScript.Platform.BINARY_PATH;
     // discard `ch` from path
     binaryPath = binaryPath.substr(0, binaryPath.lastIndexOf(path_sep));
@@ -21,10 +22,15 @@ if (!isStaticBuild) {
 \n\
 LIBRARY_PATH=" + binaryPath + "/lib\n\
 PLATFORM=" + platform + "\n\
+ARCH=" + arch + "\n\
 LDIR=$(LIBRARY_PATH)/libChakraCoreStatic.a \n\
 \n\
 ifeq (darwin, ${PLATFORM})\n\
-\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tifeq (ARM64, ${ARCH})\n\
+\t\tICU4C_LIBRARY_PATH ?= /opt/homebrew/opt/icu4c\n\
+\t\else\n\
+\t\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tendif\n\
 \tCFLAGS=-lstdc++ -std=c++98 -I$(IDIR)\n\
 \tFORCE_STARTS=-Wl,-force_load,\n\
 \tFORCE_ENDS=\n\

+ 8 - 2
test/native-tests/test-static-char/Platform.js

@@ -1,6 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
-// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
+// Copyright (c) ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -13,6 +13,7 @@ if (!isStaticBuild) {
     print("# IGNORE_THIS_TEST");
 } else {
     var platform = WScript.Platform.OS;
+    var arch = WScript.Platform.ARCH;
     var binaryPath = WScript.Platform.BINARY_PATH;
     // discard `ch` from path
     binaryPath = binaryPath.substr(0, binaryPath.lastIndexOf(path_sep));
@@ -21,10 +22,15 @@ if (!isStaticBuild) {
 \n\
 LIBRARY_PATH=" + binaryPath + "/lib\n\
 PLATFORM=" + platform + "\n\
+ARCH=" + arch + "\n\
 LDIR=$(LIBRARY_PATH)/libChakraCoreStatic.a \n\
 \n\
 ifeq (darwin, ${PLATFORM})\n\
-\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tifeq (ARM64, ${ARCH})\n\
+\t\tICU4C_LIBRARY_PATH ?= /opt/homebrew/opt/icu4c\n\
+\t\else\n\
+\t\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tendif\n\
 \tCFLAGS=-lstdc++ -I$(IDIR)\n\
 \tFORCE_STARTS=-Wl,-force_load,\n\
 \tFORCE_ENDS=\n\

+ 8 - 2
test/native-tests/test-static-char16/Platform.js

@@ -1,6 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
-// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
+// Copyright (c) ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -13,6 +13,7 @@ if (!isStaticBuild) {
     print("# IGNORE_THIS_TEST");
 } else {
     var platform = WScript.Platform.OS;
+    var arch = WScript.Platform.ARCH;
     var binaryPath = WScript.Platform.BINARY_PATH;
     // discard `ch` from path
     binaryPath = binaryPath.substr(0, binaryPath.lastIndexOf(path_sep));
@@ -21,10 +22,15 @@ if (!isStaticBuild) {
 \n\
 LIBRARY_PATH=" + binaryPath + "/lib\n\
 PLATFORM=" + platform + "\n\
+ARCH=" + arch + "\n\
 LDIR=$(LIBRARY_PATH)/libChakraCoreStatic.a \n\
 \n\
 ifeq (darwin, ${PLATFORM})\n\
-\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tifeq (ARM64, ${ARCH})\n\
+\t\tICU4C_LIBRARY_PATH ?= /opt/homebrew/opt/icu4c\n\
+\t\else\n\
+\t\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tendif\n\
 \tCFLAGS=-lstdc++ -std=c++11 -I$(IDIR)\n\
 \tFORCE_STARTS=-Wl,-force_load,\n\
 \tFORCE_ENDS=\n\

+ 8 - 2
test/native-tests/test-static-external/Platform.js

@@ -1,6 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
-// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
+// Copyright (c) ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -13,6 +13,7 @@ if (!isStaticBuild) {
     print("# IGNORE_THIS_TEST");
 } else {
     var platform = WScript.Platform.OS;
+    var arch = WScript.Platform.ARCH;
     var binaryPath = WScript.Platform.BINARY_PATH;
     // discard `ch` from path
     binaryPath = binaryPath.substr(0, binaryPath.lastIndexOf(path_sep));
@@ -21,10 +22,15 @@ if (!isStaticBuild) {
 \n\
 LIBRARY_PATH=" + binaryPath + "/lib\n\
 PLATFORM=" + platform + "\n\
+ARCH=" + arch + "\n\
 LDIR=$(LIBRARY_PATH)/libChakraCoreStatic.a \n\
 \n\
 ifeq (darwin, ${PLATFORM})\n\
-\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tifeq (ARM64, ${ARCH})\n\
+\t\tICU4C_LIBRARY_PATH ?= /opt/homebrew/opt/icu4c\n\
+\t\else\n\
+\t\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tendif\n\
 \tCFLAGS=-lstdc++ -std=c++11 -I$(IDIR)\n\
 \tFORCE_STARTS=-Wl,-force_load,\n\
 \tFORCE_ENDS=\n\

+ 8 - 2
test/native-tests/test-static-native/Platform.js

@@ -1,6 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
-// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
+// Copyright (c) ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -13,6 +13,7 @@ if (!isStaticBuild) {
     print("# IGNORE_THIS_TEST");
 } else {
     var platform = WScript.Platform.OS;
+    var arch = WScript.Platform.ARCH;
     var binaryPath = WScript.Platform.BINARY_PATH;
     // discard `ch` from path
     binaryPath = binaryPath.substr(0, binaryPath.lastIndexOf(path_sep));
@@ -21,10 +22,15 @@ if (!isStaticBuild) {
 \n\
 LIBRARY_PATH=" + binaryPath + "/lib\n\
 PLATFORM=" + platform + "\n\
+ARCH=" + arch + "\n\
 LDIR=$(LIBRARY_PATH)/libChakraCoreStatic.a \n\
 \n\
 ifeq (darwin, ${PLATFORM})\n\
-\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tifeq (ARM64, ${ARCH})\n\
+\t\tICU4C_LIBRARY_PATH ?= /opt/homebrew/opt/icu4c\n\
+\t\else\n\
+\t\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tendif\n\
 \tCFLAGS=-lstdc++ -std=c++11 -I$(IDIR)\n\
 \tFORCE_STARTS=-Wl,-force_load,\n\
 \tFORCE_ENDS=\n\

+ 8 - 2
test/native-tests/test-static-pal/Platform.js

@@ -1,6 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
-// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
+// Copyright (c) ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -13,6 +13,7 @@ if (!isStaticBuild) {
     print("# IGNORE_THIS_TEST");
 } else {
     var platform = WScript.Platform.OS;
+    var arch = WScript.Platform.ARCH;
     var binaryPath = WScript.Platform.BINARY_PATH;
     // discard `ch` from path
     binaryPath = binaryPath.substr(0, binaryPath.lastIndexOf(path_sep));
@@ -23,10 +24,15 @@ IDIR=" + WScript.Arguments[0] + "/lib/Jsrt \n\
 \n\
 LIBRARY_PATH=" + binaryPath + "/lib\n\
 PLATFORM=" + platform + "\n\
+ARCH=" + arch + "\n\
 LDIR=$(LIBRARY_PATH)/libChakraCoreStatic.a \n\
 \n\
 ifeq (darwin, ${PLATFORM})\n\
-\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tifeq (ARM64, ${ARCH})\n\
+\t\tICU4C_LIBRARY_PATH ?= /opt/homebrew/opt/icu4c\n\
+\t\else\n\
+\t\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tendif\n\
 \tCFLAGS=-lstdc++ -std=c++11 -I$(IDIR) -I$(ROOT) -I$(ROOT)/pal/inc/rt -I$(ROOT)/pal/inc -I$(ROOT)/pal -fms-extensions\n\
 \tFORCE_STARTS=-Wl,-force_load,\n\
 \tFORCE_ENDS=\n\

+ 8 - 2
test/native-tests/test-static-property-symbol/Platform.js

@@ -1,6 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
-// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
+// Copyright (c) ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -13,6 +13,7 @@ if (!isStaticBuild) {
     print("# IGNORE_THIS_TEST");
 } else {
     var platform = WScript.Platform.OS;
+    var arch = WScript.Platform.ARCH;
     var binaryPath = WScript.Platform.BINARY_PATH;
     // discard `ch` from path
     binaryPath = binaryPath.substr(0, binaryPath.lastIndexOf(path_sep));
@@ -21,10 +22,15 @@ if (!isStaticBuild) {
 \n\
 LIBRARY_PATH=" + binaryPath + "/lib\n\
 PLATFORM=" + platform + "\n\
+ARCH=" + arch + "\n\
 LDIR=$(LIBRARY_PATH)/libChakraCoreStatic.a \n\
 \n\
 ifeq (darwin, ${PLATFORM})\n\
-\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tifeq (ARM64, ${ARCH})\n\
+\t\tICU4C_LIBRARY_PATH ?= /opt/homebrew/opt/icu4c\n\
+\t\else\n\
+\t\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tendif\n\
 \tCFLAGS=-lstdc++ -std=c++11 -I$(IDIR)\n\
 \tFORCE_STARTS=-Wl,-force_load,\n\
 \tFORCE_ENDS=\n\

+ 8 - 2
test/native-tests/test-static-property/Platform.js

@@ -1,6 +1,6 @@
 //-------------------------------------------------------------------------------------------------------
 // Copyright (C) Microsoft. All rights reserved.
-// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
+// Copyright (c) ChakraCore Project Contributors. All rights reserved.
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
@@ -13,6 +13,7 @@ if (!isStaticBuild) {
     print("# IGNORE_THIS_TEST");
 } else {
     var platform = WScript.Platform.OS;
+    var arch = WScript.Platform.ARCH;
     var binaryPath = WScript.Platform.BINARY_PATH;
     // discard `ch` from path
     binaryPath = binaryPath.substr(0, binaryPath.lastIndexOf(path_sep));
@@ -21,10 +22,15 @@ if (!isStaticBuild) {
 \n\
 LIBRARY_PATH=" + binaryPath + "/lib\n\
 PLATFORM=" + platform + "\n\
+ARCH=" + arch + "\n\
 LDIR=$(LIBRARY_PATH)/libChakraCoreStatic.a \n\
 \n\
 ifeq (darwin, ${PLATFORM})\n\
-\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tifeq (ARM64, ${ARCH})\n\
+\t\tICU4C_LIBRARY_PATH ?= /opt/homebrew/opt/icu4c\n\
+\t\else\n\
+\t\tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
+\tendif\n\
 \tCFLAGS=-lstdc++ -std=c++11 -I$(IDIR)\n\
 \tFORCE_STARTS=-Wl,-force_load,\n\
 \tFORCE_ENDS=\n\