Skip to content

Commit

Permalink
Apple Silicon Test Suite updates
Browse files Browse the repository at this point in the history
- update DateTimeFormat.js which required ICU_Version<72
- update ICU path for native tests (different on Apple Silicon)
- use find_package for Python
  • Loading branch information
rhuanjl committed Mar 22, 2023
1 parent af58421 commit d6e2800
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 28 deletions.
6 changes: 4 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions test/Intl/DateTimeFormat.js
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -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);
Expand Down
10 changes: 8 additions & 2 deletions test/native-tests/test-shared-basic/Platform.js
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand All @@ -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));
Expand All @@ -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\
Expand Down
10 changes: 8 additions & 2 deletions test/native-tests/test-static-c98/Platform.js
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand All @@ -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));
Expand All @@ -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\
Expand Down
10 changes: 8 additions & 2 deletions test/native-tests/test-static-char/Platform.js
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand All @@ -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));
Expand All @@ -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\
Expand Down
10 changes: 8 additions & 2 deletions test/native-tests/test-static-char16/Platform.js
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand All @@ -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));
Expand All @@ -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\
Expand Down
10 changes: 8 additions & 2 deletions test/native-tests/test-static-external/Platform.js
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand All @@ -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));
Expand All @@ -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\
Expand Down
10 changes: 8 additions & 2 deletions test/native-tests/test-static-native/Platform.js
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand All @@ -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));
Expand All @@ -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\
Expand Down
10 changes: 8 additions & 2 deletions test/native-tests/test-static-pal/Platform.js
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand All @@ -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));
Expand All @@ -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\
Expand Down
10 changes: 8 additions & 2 deletions test/native-tests/test-static-property-symbol/Platform.js
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand All @@ -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));
Expand All @@ -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\
Expand Down
10 changes: 8 additions & 2 deletions test/native-tests/test-static-property/Platform.js
Original file line number Diff line number Diff line change
@@ -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.
//-------------------------------------------------------------------------------------------------------

Expand All @@ -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));
Expand All @@ -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\
Expand Down

0 comments on commit d6e2800

Please sign in to comment.