From a0bece5ae507acaf058830fcb93d29644a427d55 Mon Sep 17 00:00:00 2001 From: Neil Dhar Date: Mon, 23 Sep 2024 16:06:55 -0700 Subject: [PATCH] Add armv7 CI --- .circleci/config.yml | 24 +++++++++++++++++++++ unittests/VMRuntime/StringPrimitiveTest.cpp | 11 +++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3c60ccd4017..3e6ea773fb7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,6 +10,7 @@ workflows: sanitize: ["ON", "OFF"] gc: ["MALLOC", "HADES"] - test-linux + - test-linux-armv7 jobs: test-macos: @@ -70,3 +71,26 @@ jobs: cmake -S hermes -B build cmake --build build -j 4 cmake --build build --target check-hermes -j 4 + + test-linux-armv7: + docker: + - image: arm32v7/ubuntu:jammy + resource_class: arm.medium + environment: + - DEBIAN_FRONTEND: noninteractive + working_directory: /root + steps: + - run: + name: Install dependencies + command: | + apt update + apt install -y git openssh-client cmake build-essential \ + libicu-dev zip python3 tzdata clang-15 + - checkout: + path: hermes + - run: + name: Run Hermes regression tests + command: | + cmake -S hermes -B build + cmake --build build -j 4 + cmake --build build --target check-hermes -j 4 diff --git a/unittests/VMRuntime/StringPrimitiveTest.cpp b/unittests/VMRuntime/StringPrimitiveTest.cpp index acb1c551bd8..fab49269f04 100644 --- a/unittests/VMRuntime/StringPrimitiveTest.cpp +++ b/unittests/VMRuntime/StringPrimitiveTest.cpp @@ -148,11 +148,15 @@ TEST_F(StringPrimTest, ConcatTest) { // an interior pointer, or if someone else maintained a pointer to the string. template void test1StringMemcpySafety(const StringType &s) { + // memcpy the string so we can freely poke at its contents. + llvh::AlignedCharArrayUnion mb; + memcpy(mb.buffer, &s, sizeof(StringType)); + // Grub through the string's bits, looking for pointers to the interior of the // string. intptr_t start = reinterpret_cast(&s); intptr_t end = reinterpret_cast(&s + 1); - const intptr_t *stringGuts = reinterpret_cast(&s); + const intptr_t *stringGuts = reinterpret_cast(mb.buffer); for (size_t i = 0; i < sizeof(StringType) / sizeof(void *); i++) { intptr_t p = stringGuts[i]; EXPECT_FALSE(start <= p && p <= end) << "string size: " << s.size(); @@ -163,10 +167,7 @@ void test1StringMemcpySafety(const StringType &s) { EXPECT_FALSE(start <= p && p <= end) << "string size: " << s.size(); } - // memcpy our string and verify the buffer, when interpreted as a string, is - // equal to the original. - llvh::AlignedCharArrayUnion mb; - memcpy(mb.buffer, &s, sizeof(StringType)); + // Verify the buffer, when interpreted as a string, is equal to the original. const StringType *memcpydStr = reinterpret_cast(mb.buffer); EXPECT_EQ(s, *memcpydStr) << "string size: " << s.size();