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>

libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp

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

9-
// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
9+
// XFAIL: LIBCXX-PICOLIBC-FIXME
1010

1111
// <iostream>
1212

libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp

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

99
// TODO: Investigate
1010
// UNSUPPORTED: LIBCXX-AIX-FIXME
11+
// XFAIL: LIBCXX-PICOLIBC-FIXME
1112

1213
// This test hangs on Android devices that lack shell_v2, which was added in
1314
// Android N (API 24).

libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp

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

9-
// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
9+
// XFAIL: LIBCXX-PICOLIBC-FIXME
1010

1111
// <iostream>
1212

libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp

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

9-
// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
10-
119
// <iostream>
1210

1311
// ostream cout;

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// test sized operator delete[] replacement.
1010

1111
// UNSUPPORTED: sanitizer-new-delete, c++03, c++11
12-
// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
1312

1413
// NOTE: Clang does not enable sized-deallocation in C++14 and beyond by
1514
// default. It is only enabled when -fsized-deallocation is given.

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// test sized operator delete replacement.
1010

1111
// UNSUPPORTED: sanitizer-new-delete, c++03, c++11
12-
// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
1312

1413
// NOTE: Clang does not enable sized-deallocation in C++14 and beyond by
1514
// default. It is only enabled when -fsized-deallocation is given.

libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp

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

9+
// XFAIL: LIBCXX-PICOLIBC-FIXME
10+
911
// <locale>
1012

1113
// template <> class ctype<char>

libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// iter_type put(iter_type s, ios_base& iob, char_type fill, long double v) const;
1414

1515
// XFAIL: win32-broken-printf-g-precision
16+
// XFAIL: LIBCXX-PICOLIBC-FIXME
1617

1718
// Needs more investigation, but this is probably failing on Android M (API 23)
1819
// and up because the printf formatting of NAN changed.

libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.bin/eval.PR44847.pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
// Serializing/deserializing the state of the RNG requires iostreams
1919
// UNSUPPORTED: no-localization
2020

21+
// This test appears to hang with picolibc & qemu.
22+
// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
23+
2124
#include <random>
2225
#include <numeric>
2326
#include <vector>

libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
// UNSUPPORTED: availability-filesystem-missing
1212

13+
// qemu: Unsupported SemiHosting SWI 0x30
14+
// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
15+
1316
// <chrono>
1417

1518
// file_clock

libcxxabi/test/configs/armv7m-picolibc-libc++abi.cfg.in

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ config.substitutions.append(('%{link_flags}',
1717
' -Wl,--defsym=__ram_size=0x1000000'
1818
' -Wl,--defsym=__stack_size=0x1000'
1919
))
20+
21+
config.executor = (
22+
'@LIBCXXABI_LIBCXX_PATH@/utils/qemu_baremetal.py'
23+
' --qemu @QEMU_SYSTEM_ARM@'
24+
' --machine mps2-an385'
25+
' --cpu cortex-m3')
2026
config.substitutions.append(('%{exec}',
21-
'true' # TODO use qemu-system-arm
27+
'%{executor}'
28+
' --execdir %T'
2229
))
23-
config.available_features.add('libcxx-fake-executor')
2430

2531
import os, site
2632
site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))

libunwind/test/configs/armv7m-picolibc-libunwind.cfg.in

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ config.substitutions.append(('%{link_flags}',
1717
' -Wl,--defsym=__ram_size=0x1000000'
1818
' -Wl,--defsym=__stack_size=0x1000'
1919
))
20+
21+
config.executor = (
22+
'@LIBUNWIND_LIBCXX_PATH@/utils/qemu_baremetal.py'
23+
' --qemu @QEMU_SYSTEM_ARM@'
24+
' --machine mps2-an385'
25+
' --cpu cortex-m3')
2026
config.substitutions.append(('%{exec}',
21-
'true' # TODO use qemu-system-arm
27+
'%{executor}'
28+
' --execdir %T'
2229
))
23-
config.available_features.add('libcxx-fake-executor')
2430

2531
import os, site
2632
site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils'))

libunwind/test/libunwind_02.pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
// TODO: Figure out why this fails with Memory Sanitizer.
1111
// XFAIL: msan
1212

13+
// This test fails on older llvm, when built with picolibc.
14+
// XFAIL: clang-16 && LIBCXX-PICOLIBC-FIXME
15+
1316
#undef NDEBUG
1417
#include <assert.h>
1518
#include <stdlib.h>

0 commit comments

Comments
 (0)