[llvm-branch-commits] [libunwind] be811d1 - [libc++] Run picolibc tests with qemu

Louis Dionne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 30 09:15:22 PST 2023


Author: Michael Platings
Date: 2023-11-29T17:21:08-05:00
New Revision: be811d1617654e46f4f4daa82259ae4fad4c8e6a

URL: https://github.com/llvm/llvm-project/commit/be811d1617654e46f4f4daa82259ae4fad4c8e6a
DIFF: https://github.com/llvm/llvm-project/commit/be811d1617654e46f4f4daa82259ae4fad4c8e6a.diff

LOG: [libc++] Run picolibc tests with qemu

This patch actually runs the tests for picolibc behind an emulator,
removing a few workarounds and increasing coverage.

Differential Revision: https://reviews.llvm.org/D155521

Added: 
    

Modified: 
    libcxx/cmake/caches/Armv7M-picolibc.cmake
    libcxx/docs/index.rst
    libcxx/test/configs/armv7m-picolibc-libc++.cfg.in
    libcxx/test/libcxx/selftest/dsl/dsl.sh.py
    libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
    libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
    libcxx/test/libcxx/selftest/stdin-is-piped.sh.cpp
    libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
    libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
    libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
    libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp
    libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
    libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp
    libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp
    libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
    libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
    libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp
    libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
    libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.PR44847.pass.cpp
    libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp
    libcxxabi/test/configs/armv7m-picolibc-libc++abi.cfg.in
    libunwind/test/configs/armv7m-picolibc-libunwind.cfg.in
    libunwind/test/libunwind_02.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/cmake/caches/Armv7M-picolibc.cmake b/libcxx/cmake/caches/Armv7M-picolibc.cmake
index 6ed1866a50845fe..9f8863943444b65 100644
--- a/libcxx/cmake/caches/Armv7M-picolibc.cmake
+++ b/libcxx/cmake/caches/Armv7M-picolibc.cmake
@@ -29,6 +29,8 @@ set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
 set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
 set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "")
+# Long tests are prohibitively slow when run via emulation.
+set(LIBCXX_TEST_PARAMS "long_tests=False" CACHE STRING "")
 set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
 set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
 set(LIBUNWIND_ENABLE_STATIC ON CACHE BOOL "")
@@ -36,3 +38,4 @@ set(LIBUNWIND_ENABLE_THREADS OFF CACHE BOOL "")
 set(LIBUNWIND_IS_BAREMETAL ON CACHE BOOL "")
 set(LIBUNWIND_REMEMBER_HEAP_ALLOC ON CACHE BOOL "")
 set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
+find_program(QEMU_SYSTEM_ARM qemu-system-arm)

diff  --git a/libcxx/docs/index.rst b/libcxx/docs/index.rst
index 7bb5512beb1f1fc..e8b4a95dbcffae1 100644
--- a/libcxx/docs/index.rst
+++ b/libcxx/docs/index.rst
@@ -133,7 +133,7 @@ Linux                 i386, x86_64, arm, arm64  Only glibc-2.24 and later and no
 Android 5.0+          i386, x86_64, arm, arm64
 Windows               i386, x86_64              Both MSVC and MinGW style environments, ABI in MSVC environments is :doc:`unstable <DesignDocs/ABIVersioning>`
 AIX 7.2TL5+           powerpc, powerpc64
-Embedded (picolibc)   arm                       Support for building with picolibc is currently work-in-progress
+Embedded (picolibc)   arm
 ===================== ========================= ============================
 
 Generally speaking, libc++ should work on any platform that provides a fairly complete

diff  --git a/libcxx/test/configs/armv7m-picolibc-libc++.cfg.in b/libcxx/test/configs/armv7m-picolibc-libc++.cfg.in
index c0d23f136475eba..a39d43aec96aa4a 100644
--- a/libcxx/test/configs/armv7m-picolibc-libc++.cfg.in
+++ b/libcxx/test/configs/armv7m-picolibc-libc++.cfg.in
@@ -26,10 +26,16 @@ config.substitutions.append(('%{link_flags}',
     ' -Wl,--defsym=__ram_size=0x1000000'
     ' -Wl,--defsym=__stack_size=0x1000'
 ))
+
+config.executor = (
+    '@LIBCXX_SOURCE_DIR@/utils/qemu_baremetal.py'
+    ' --qemu @QEMU_SYSTEM_ARM@'
+    ' --machine mps2-an385'
+    ' --cpu cortex-m3')
 config.substitutions.append(('%{exec}',
-    'true' # TODO use qemu-system-arm
+    '%{executor}'
+    ' --execdir %T'
 ))
-config.available_features.add('libcxx-fake-executor')
 
 import os, site
 site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))

diff  --git a/libcxx/test/libcxx/selftest/dsl/dsl.sh.py b/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
index 6c695a0d672ee07..012759436d891c1 100644
--- a/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
+++ b/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
@@ -6,7 +6,9 @@
 #
 # ===----------------------------------------------------------------------===##
 
-# XFAIL: libcxx-fake-executor
+# With picolibc, test_program_stderr_is_not_conflated_with_stdout fails
+# because stdout & stderr are treated as the same.
+# XFAIL: LIBCXX-PICOLIBC-FIXME
 
 # Note: We prepend arguments with 'x' to avoid thinking there are too few
 #       arguments in case an argument is an empty string.

diff  --git a/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp b/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
index 1df98ef11191845..eac7d8846e23a6f 100644
--- a/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
+++ b/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: libcxx-fake-executor
 // XFAIL: *
 
 // Make sure the test DOES NOT pass if it fails at runtime.

diff  --git a/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm b/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
index 02e8321c96b2303..22e17666eab073c 100644
--- a/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
+++ b/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: objective-c++
-// UNSUPPORTED: libcxx-fake-executor
 
 // XFAIL: *
 

diff  --git a/libcxx/test/libcxx/selftest/stdin-is-piped.sh.cpp b/libcxx/test/libcxx/selftest/stdin-is-piped.sh.cpp
index ffd10631c6a67d4..897e10e94783cf5 100644
--- a/libcxx/test/libcxx/selftest/stdin-is-piped.sh.cpp
+++ b/libcxx/test/libcxx/selftest/stdin-is-piped.sh.cpp
@@ -8,6 +8,8 @@
 
 // Make sure that the executor pipes standard input to the test-executable being run.
 
+// XFAIL: LIBCXX-PICOLIBC-FIXME
+
 // RUN: %{build}
 // RUN: echo "abc" | %{exec} %t.exe
 

diff  --git a/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
index 554bd8982ab3331..e2581fbf2fa6cc0 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
@@ -6,6 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// This test appears to hang with picolibc & qemu.
+// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
+
 // <algorithm>
 
 // template<RandomAccessIterator Iter>

diff  --git a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
index 5b63272a3a1a6a9..3f49c36f8ba2e75 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12}}
+// XFAIL: LIBCXX-PICOLIBC-FIXME
 
 // <system_error>
 

diff  --git a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
index 1caf5cb2ccf73d5..4a29e1baa808a43 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
@@ -13,6 +13,7 @@
 // const error_category& system_category();
 
 // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12}}
+// XFAIL: LIBCXX-PICOLIBC-FIXME
 
 #include <system_error>
 #include <cassert>

diff  --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp
index 9a4b437ab109a65..da5563f87df45ad 100644
--- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
+// XFAIL: LIBCXX-PICOLIBC-FIXME
 
 // <iostream>
 

diff  --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
index 28ea650e58b1cde..ad6cc192e2f4884 100644
--- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp
@@ -8,6 +8,7 @@
 
 // TODO: Investigate
 // UNSUPPORTED: LIBCXX-AIX-FIXME
+// XFAIL: LIBCXX-PICOLIBC-FIXME
 
 // This test hangs on Android devices that lack shell_v2, which was added in
 // Android N (API 24).

diff  --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp
index 783be3a52e94dc3..9bedd67e816ef53 100644
--- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
+// XFAIL: LIBCXX-PICOLIBC-FIXME
 
 // <iostream>
 

diff  --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp
index 1234da38de03148..b8d319385ca1f71 100644
--- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
-
 // <iostream>
 
 // ostream cout;

diff  --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
index 901f2cca4ce03f1..21663cdf956d425 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
@@ -9,7 +9,6 @@
 // test sized operator delete[] replacement.
 
 // UNSUPPORTED: sanitizer-new-delete, c++03, c++11
-// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
 
 // NOTE: Clang does not enable sized-deallocation in C++14 and beyond by
 // default. It is only enabled when -fsized-deallocation is given.

diff  --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
index d0b10b65be2835a..a8701ce7a86cff5 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
@@ -9,7 +9,6 @@
 // test sized operator delete replacement.
 
 // UNSUPPORTED: sanitizer-new-delete, c++03, c++11
-// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
 
 // NOTE: Clang does not enable sized-deallocation in C++14 and beyond by
 // default. It is only enabled when -fsized-deallocation is given.

diff  --git a/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp b/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp
index 8fe8080bde98f36..50c60180ce0dd5a 100644
--- a/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// XFAIL: LIBCXX-PICOLIBC-FIXME
+
 // <locale>
 
 // template <> class ctype<char>

diff  --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
index 8bb9ff1c202ae95..8637a933008fb9d 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
@@ -13,6 +13,7 @@
 // iter_type put(iter_type s, ios_base& iob, char_type fill, long double v) const;
 
 // XFAIL: win32-broken-printf-g-precision
+// XFAIL: LIBCXX-PICOLIBC-FIXME
 
 // Needs more investigation, but this is probably failing on Android M (API 23)
 // and up because the printf formatting of NAN changed.

diff  --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.PR44847.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.PR44847.pass.cpp
index 9213d2bac5a6156..572a59b7a1926a0 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.PR44847.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.PR44847.pass.cpp
@@ -18,6 +18,9 @@
 // Serializing/deserializing the state of the RNG requires iostreams
 // UNSUPPORTED: no-localization
 
+// This test appears to hang with picolibc & qemu.
+// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
+
 #include <random>
 #include <numeric>
 #include <vector>

diff  --git a/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp b/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp
index 0852483a8b39fc8..4ba17a48988b376 100644
--- a/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp
+++ b/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp
@@ -10,6 +10,9 @@
 
 // UNSUPPORTED: availability-filesystem-missing
 
+// qemu: Unsupported SemiHosting SWI 0x30
+// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
+
 // <chrono>
 
 // file_clock

diff  --git a/libcxxabi/test/configs/armv7m-picolibc-libc++abi.cfg.in b/libcxxabi/test/configs/armv7m-picolibc-libc++abi.cfg.in
index cb5ede3ac67a179..b4744f935ad8595 100644
--- a/libcxxabi/test/configs/armv7m-picolibc-libc++abi.cfg.in
+++ b/libcxxabi/test/configs/armv7m-picolibc-libc++abi.cfg.in
@@ -17,10 +17,16 @@ config.substitutions.append(('%{link_flags}',
     ' -Wl,--defsym=__ram_size=0x1000000'
     ' -Wl,--defsym=__stack_size=0x1000'
 ))
+
+config.executor = (
+    '@LIBCXXABI_LIBCXX_PATH@/utils/qemu_baremetal.py'
+    ' --qemu @QEMU_SYSTEM_ARM@'
+    ' --machine mps2-an385'
+    ' --cpu cortex-m3')
 config.substitutions.append(('%{exec}',
-    'true' # TODO use qemu-system-arm
+    '%{executor}'
+    ' --execdir %T'
 ))
-config.available_features.add('libcxx-fake-executor')
 
 import os, site
 site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))

diff  --git a/libunwind/test/configs/armv7m-picolibc-libunwind.cfg.in b/libunwind/test/configs/armv7m-picolibc-libunwind.cfg.in
index c2dd320ddfd1fb6..e8f68a51fc53f8a 100644
--- a/libunwind/test/configs/armv7m-picolibc-libunwind.cfg.in
+++ b/libunwind/test/configs/armv7m-picolibc-libunwind.cfg.in
@@ -17,10 +17,16 @@ config.substitutions.append(('%{link_flags}',
     ' -Wl,--defsym=__ram_size=0x1000000'
     ' -Wl,--defsym=__stack_size=0x1000'
 ))
+
+config.executor = (
+    '@LIBUNWIND_LIBCXX_PATH@/utils/qemu_baremetal.py'
+    ' --qemu @QEMU_SYSTEM_ARM@'
+    ' --machine mps2-an385'
+    ' --cpu cortex-m3')
 config.substitutions.append(('%{exec}',
-    'true' # TODO use qemu-system-arm
+    '%{executor}'
+    ' --execdir %T'
 ))
-config.available_features.add('libcxx-fake-executor')
 
 import os, site
 site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils'))

diff  --git a/libunwind/test/libunwind_02.pass.cpp b/libunwind/test/libunwind_02.pass.cpp
index fc034378781a2fa..ea34cd54222c825 100644
--- a/libunwind/test/libunwind_02.pass.cpp
+++ b/libunwind/test/libunwind_02.pass.cpp
@@ -10,6 +10,9 @@
 // TODO: Figure out why this fails with Memory Sanitizer.
 // XFAIL: msan
 
+// This test fails on older llvm, when built with picolibc.
+// XFAIL: clang-16 && LIBCXX-PICOLIBC-FIXME
+
 #undef NDEBUG
 #include <assert.h>
 #include <stdlib.h>


        


More information about the llvm-branch-commits mailing list