Skip to content

Commit 4f423e4

Browse files
authored
[libc++][test] Adds backdeployment shorthands. (#78204)
Some changes in libc++ affect the dylib. These changes are not present on systems that use the system dylib. Currently that are the Apple backdeployment targets. Figuring out which MacOS versions to target is not trivial for non-Apple engineers. These shorthands make it easier to select the proper feature make a test UNSUPPORTED or XFAIL. During the design discussion with Louis we considered whether or not to add preprocessor definitions to allow partial disabling of a test. This would be useful when an existing feature is changed by modifying the dylib. In the end we decided not to add this feature to avoid additional complexity in the tests. Instead the test will be disabled for that target.
1 parent e973ab1 commit 4f423e4

File tree

1 file changed

+95
-6
lines changed

1 file changed

+95
-6
lines changed

libcxx/utils/libcxx/test/features.py

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,36 +526,118 @@ def check_gdb(cfg):
526526
# target that doesn't support it will fail at compile time, not at runtime. This can
527527
# be achieved by creating a `.verify.cpp` test that checks for the right errors, and
528528
# mark that test as requiring `stdlib=<vendor>-libc++ && target=<target>`.
529+
#
530+
# Since it is not always known which deployment target to pick there are
531+
# short-hands based on the LLVM version like using-built-library-before-llvm-xx.
532+
# These short-hands make it easy for libc++ developers to select the proper
533+
# version the feature will be available in and allows vendors to set the proper
534+
# target information.
529535
DEFAULT_FEATURES += [
536+
# Backdeployment short-hands
537+
Feature(
538+
name="using-built-library-before-llvm-11",
539+
when=lambda cfg: BooleanExpression.evaluate(
540+
"stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0)(.0)?}}",
541+
cfg.available_features,
542+
),
543+
),
544+
Feature(
545+
name="using-built-library-before-llvm-12",
546+
when=lambda cfg: BooleanExpression.evaluate(
547+
"using-built-library-before-llvm-11 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx12.{{(0|1|2)}}.0)",
548+
cfg.available_features,
549+
),
550+
),
551+
552+
Feature(
553+
name="using-built-library-before-llvm-13",
554+
when=lambda cfg: BooleanExpression.evaluate(
555+
"using-built-library-before-llvm-12 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx{{((12.(3|4|5|6|7))|(13.(0|1|2|3)))}}.0)",
556+
cfg.available_features,
557+
),
558+
),
559+
560+
Feature(
561+
name="using-built-library-before-llvm-14",
562+
when=lambda cfg: BooleanExpression.evaluate(
563+
"using-built-library-before-llvm-13",
564+
cfg.available_features,
565+
),
566+
),
567+
568+
Feature(
569+
name="using-built-library-before-llvm-15",
570+
when=lambda cfg: BooleanExpression.evaluate(
571+
"using-built-library-before-llvm-14 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx13.{{(4|5|6)}}.0)",
572+
cfg.available_features,
573+
),
574+
),
575+
576+
Feature(
577+
name="using-built-library-before-llvm-16",
578+
when=lambda cfg: BooleanExpression.evaluate(
579+
"using-built-library-before-llvm-15 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx14.{{(0|1|2|3)}}.0)",
580+
cfg.available_features,
581+
),
582+
),
583+
584+
Feature(
585+
name="using-built-library-before-llvm-17",
586+
when=lambda cfg: BooleanExpression.evaluate(
587+
"using-built-library-before-llvm-16",
588+
cfg.available_features,
589+
),
590+
),
591+
592+
Feature(
593+
name="using-built-library-before-llvm-18",
594+
when=lambda cfg: BooleanExpression.evaluate(
595+
# For now, no released version of macOS contains LLVM 18
596+
# TODO(ldionne) Please provide the correct value.
597+
"using-built-library-before-llvm-17 || stdlib=apple-libc++ && target={{.+}}-apple-macosx{{.+}}",
598+
cfg.available_features,
599+
),
600+
),
601+
602+
Feature(
603+
name="using-built-library-before-llvm-19",
604+
when=lambda cfg: BooleanExpression.evaluate(
605+
# For now, no released version of macOS contains LLVM 19
606+
# TODO(ldionne) Please provide the correct value.
607+
"using-built-library-before-llvm-18 || stdlib=apple-libc++ && target={{.+}}-apple-macosx{{.+}}",
608+
cfg.available_features,
609+
),
610+
),
611+
530612
# Tests that require std::to_chars(floating-point) in the built library
531613
Feature(
532614
name="availability-fp_to_chars-missing",
533615
when=lambda cfg: BooleanExpression.evaluate(
534-
"stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.13|10.14|10.15|11.0|12.0|13.0)(.0)?}}",
616+
"using-built-library-before-llvm-13",
535617
cfg.available_features,
536618
),
537619
),
538620
# Tests that require https://wg21.link/P0482 support in the built library
539621
Feature(
540622
name="availability-char8_t_support-missing",
541623
when=lambda cfg: BooleanExpression.evaluate(
542-
"stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.13|10.14|10.15|11.0)(.0)?}}",
624+
"using-built-library-before-llvm-11",
543625
cfg.available_features,
544626
),
545627
),
546628
# Tests that require __libcpp_verbose_abort support in the built library
547629
Feature(
548630
name="availability-verbose_abort-missing",
549631
when=lambda cfg: BooleanExpression.evaluate(
550-
"stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.13|10.14|10.15|11.0|12.0|13.0)(.0)?}}",
632+
"using-built-library-before-llvm-13",
551633
cfg.available_features,
552634
),
553635
),
554636
# Tests that require std::pmr support in the built library
555637
Feature(
556638
name="availability-pmr-missing",
557639
when=lambda cfg: BooleanExpression.evaluate(
558-
"stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.13|10.14|10.15|11.0|12.0|13.0)(.0)?}}",
640+
"using-built-library-before-llvm-13",
559641
cfg.available_features,
560642
),
561643
),
@@ -579,8 +661,15 @@ def check_gdb(cfg):
579661
Feature(
580662
name="availability-tzdb-missing",
581663
when=lambda cfg: BooleanExpression.evaluate(
582-
# TODO(ldionne) Please provide the correct value.
583-
"(stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.13|10.14|10.15|11.0|12.0|13.0)(.0)?}})",
664+
"using-built-library-before-llvm-19",
665+
cfg.available_features,
666+
),
667+
),
668+
# Tests that require support for <print> and std::print in <ostream> in the built library.
669+
Feature(
670+
name="availability-print-missing",
671+
when=lambda cfg: BooleanExpression.evaluate(
672+
"using-built-library-before-llvm-18",
584673
cfg.available_features,
585674
),
586675
),

0 commit comments

Comments
 (0)