From d6e2800fa7fb792aaed56a2408ae5ab4690b0756 Mon Sep 17 00:00:00 2001 From: rhuanjl Date: Tue, 14 Feb 2023 18:12:25 +0000 Subject: [PATCH] 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 --- test/CMakeLists.txt | 6 ++++-- test/Intl/DateTimeFormat.js | 21 ++++++++++++------- .../test-shared-basic/Platform.js | 10 +++++++-- test/native-tests/test-static-c98/Platform.js | 10 +++++++-- .../native-tests/test-static-char/Platform.js | 10 +++++++-- .../test-static-char16/Platform.js | 10 +++++++-- .../test-static-external/Platform.js | 10 +++++++-- .../test-static-native/Platform.js | 10 +++++++-- test/native-tests/test-static-pal/Platform.js | 10 +++++++-- .../test-static-property-symbol/Platform.js | 10 +++++++-- .../test-static-property/Platform.js | 10 +++++++-- 11 files changed, 89 insertions(+), 28 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b7197c2bc7f..4e569d9a4f3 100644 --- a/test/CMakeLists.txt +++ b/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 diff --git a/test/Intl/DateTimeFormat.js b/test/Intl/DateTimeFormat.js index 5baa2b31dfb..afc7af52d96 100644 --- a/test/Intl/DateTimeFormat.js +++ b/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); diff --git a/test/native-tests/test-shared-basic/Platform.js b/test/native-tests/test-shared-basic/Platform.js index 20cb0e5bdaf..6f6f43fc186 100644 --- a/test/native-tests/test-shared-basic/Platform.js +++ b/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\ diff --git a/test/native-tests/test-static-c98/Platform.js b/test/native-tests/test-static-c98/Platform.js index f6ef18cd9d6..57f1f2a2613 100644 --- a/test/native-tests/test-static-c98/Platform.js +++ b/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\ diff --git a/test/native-tests/test-static-char/Platform.js b/test/native-tests/test-static-char/Platform.js index 076206fcdb2..f907cf201e5 100644 --- a/test/native-tests/test-static-char/Platform.js +++ b/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\ diff --git a/test/native-tests/test-static-char16/Platform.js b/test/native-tests/test-static-char16/Platform.js index 7eb780812b8..9dddd45fb54 100644 --- a/test/native-tests/test-static-char16/Platform.js +++ b/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\ diff --git a/test/native-tests/test-static-external/Platform.js b/test/native-tests/test-static-external/Platform.js index 7eb780812b8..9dddd45fb54 100644 --- a/test/native-tests/test-static-external/Platform.js +++ b/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\ diff --git a/test/native-tests/test-static-native/Platform.js b/test/native-tests/test-static-native/Platform.js index 7eb780812b8..9dddd45fb54 100644 --- a/test/native-tests/test-static-native/Platform.js +++ b/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\ diff --git a/test/native-tests/test-static-pal/Platform.js b/test/native-tests/test-static-pal/Platform.js index 392dbca8877..5911de0354d 100644 --- a/test/native-tests/test-static-pal/Platform.js +++ b/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\ diff --git a/test/native-tests/test-static-property-symbol/Platform.js b/test/native-tests/test-static-property-symbol/Platform.js index 7eb780812b8..9dddd45fb54 100644 --- a/test/native-tests/test-static-property-symbol/Platform.js +++ b/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\ diff --git a/test/native-tests/test-static-property/Platform.js b/test/native-tests/test-static-property/Platform.js index 7eb780812b8..9dddd45fb54 100644 --- a/test/native-tests/test-static-property/Platform.js +++ b/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\