Skip to content

Commit be811d1

Browse files
mplatingsldionne
authored andcommitted
[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
1 parent b92bf0d commit be811d1

File tree

23 files changed

+53
-16
lines changed

23 files changed

+53
-16
lines changed

libcxx/cmake/caches/Armv7M-picolibc.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
2929
set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
3030
set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
3131
set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "")
32+
# Long tests are prohibitively slow when run via emulation.
33+
set(LIBCXX_TEST_PARAMS "long_tests=False" CACHE STRING "")
3234
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
3335
set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
3436
set(LIBUNWIND_ENABLE_STATIC ON CACHE BOOL "")
3537
set(LIBUNWIND_ENABLE_THREADS OFF CACHE BOOL "")
3638
set(LIBUNWIND_IS_BAREMETAL ON CACHE BOOL "")
3739
set(LIBUNWIND_REMEMBER_HEAP_ALLOC ON CACHE BOOL "")
3840
set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
41+
find_program(QEMU_SYSTEM_ARM qemu-system-arm)

libcxx/docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Linux i386, x86_64, arm, arm64 Only glibc-2.24 and later and no
133133
Android 5.0+ i386, x86_64, arm, arm64
134134
Windows i386, x86_64 Both MSVC and MinGW style environments, ABI in MSVC environments is :doc:`unstable <DesignDocs/ABIVersioning>`
135135
AIX 7.2TL5+ powerpc, powerpc64
136-
Embedded (picolibc) arm Support for building with picolibc is currently work-in-progress
136+
Embedded (picolibc) arm
137137
===================== ========================= ============================
138138

139139
Generally speaking, libc++ should work on any platform that provides a fairly complete

libcxx/test/configs/armv7m-picolibc-libc++.cfg.in

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ config.substitutions.append(('%{link_flags}',
2626
' -Wl,--defsym=__ram_size=0x1000000'
2727
' -Wl,--defsym=__stack_size=0x1000'
2828
))
29+
30+
config.executor = (
31+
'@LIBCXX_SOURCE_DIR@/utils/qemu_baremetal.py'
32+
' --qemu @QEMU_SYSTEM_ARM@'
33+
' --machine mps2-an385'
34+
' --cpu cortex-m3')
2935
config.substitutions.append(('%{exec}',
30-
'true' # TODO use qemu-system-arm
36+
'%{executor}'
37+
' --execdir %T'
3138
))
32-
config.available_features.add('libcxx-fake-executor')
3339

3440
import os, site
3541
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))

libcxx/test/libcxx/selftest/dsl/dsl.sh.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
#
77
# ===----------------------------------------------------------------------===##
88

9-
# XFAIL: libcxx-fake-executor
9+
# With picolibc, test_program_stderr_is_not_conflated_with_stdout fails
10+
# because stdout & stderr are treated as the same.
11+
# XFAIL: LIBCXX-PICOLIBC-FIXME
1012

1113
# Note: We prepend arguments with 'x' to avoid thinking there are too few
1214
# arguments in case an argument is an empty string.

libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// UNSUPPORTED: libcxx-fake-executor
109
// XFAIL: *
1110

1211
// Make sure the test DOES NOT pass if it fails at runtime.

libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
// REQUIRES: objective-c++
10-
// UNSUPPORTED: libcxx-fake-executor
1110

1211
// XFAIL: *
1312

libcxx/test/libcxx/selftest/stdin-is-piped.sh.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
// Make sure that the executor pipes standard input to the test-executable being run.
1010

11+
// XFAIL: LIBCXX-PICOLIBC-FIXME
12+
1113
// RUN: %{build}
1214
// RUN: echo "abc" | %{exec} %t.exe
1315

libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// This test appears to hang with picolibc & qemu.
10+
// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
11+
912
// <algorithm>
1013

1114
// template<RandomAccessIterator Iter>

libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12}}
10+
// XFAIL: LIBCXX-PICOLIBC-FIXME
1011

1112
// <system_error>
1213

libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// const error_category& system_category();
1414

1515
// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12}}
16+
// XFAIL: LIBCXX-PICOLIBC-FIXME
1617

1718
#include <system_error>
1819
#include <cassert>

0 commit comments

Comments
 (0)