Skip to content

Commit

Permalink
Cleanup of fmt-tests buildfile organization and comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
kamrann committed Sep 11, 2024
1 parent 8f3e148 commit bffc9c4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 18 deletions.
56 changes: 40 additions & 16 deletions fmt-tests/basics/buildfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
include ../test-main/

#test_names =
# args-test \
# assert-test \
# base-test
gtest_test_names = args-test assert-test base-test chrono-test color-test compile-fp-test compile-test format-test gtest-extra-test noexception-test os-test ostream-test printf-test std-test unicode-test xchar-test
# NOTE: Maintaining explicit lists to match upstream, as it's not clear that there is intended to be a uniform pattern that can be reliably globbed.
# See individual invocations of add_fmt_test() in upstream/test/CMakeLists.txt

# header-only-test <- header only mode seemingly not supported by this build2 package?
# scan-test <- some linker issues
# posix-mock-test <- needs posix-mock.h, and has some msvc/runtime conditional logic going on

standalone_test_names = enforce-checks-test # some way to pair these? -DFMT_ENFORCE_COMPILE_STRING
# Tests that use gtest, and do not require any additional source/headers beyond a single cc file

gtest_test_names = \
args-test \
assert-test \
base-test \
chrono-test \
color-test \
compile-fp-test \
compile-test \
format-test \
gtest-extra-test \
noexception-test \
os-test \
ostream-test \
printf-test \
std-test \
unicode-test \
xchar-test

# NOTE: header-only-test - Excluded as this package does not currently provide support for FMT_HEADER_ONLY.
# TODO: scan-test - Excluded due to unresolved linker errors.

for test_name : $gtest_test_names
{
Expand All @@ -21,25 +36,34 @@ for test_name : $gtest_test_names
}
}

# END [Tests that use gtest, and do not require any additional source/headers beyond a single cc file]


# Tests using gtest but with additional prerequisites

./: exe{ranges-test} : test/cxx{ranges-test ranges-odr-test}
exe{ranges-test}: ../test-main/liba{test-main}:
{
bin.whole = true
}

# linker issues.
#./: exe{scan-test} : test/cxx{scan-test} ../test-main/liba{test-main}
# NOTE: format-impl-test- For whatever reason, format-impl-test is tied in upstream to header-only-test, which we do not support. Attempting to compile it alone yields errors, therefore omitted.
# TODO: posix-mock-test - Excluded pending further work. Needs posix-mock.h, and has some msvc/runtime conditional logic that needs looking into.

# END [Tests using gtest but with additional prerequisites]

# @todo: cmake adds this test conditionally on NOT ( msvc AND fmt-shared )
# in build2, i guess it's a bit different in that we can potentially build both shared and static variants within a single config?
# also not clear how fmt_shared/fmt_header_only is being configured, looks like the package doesn't do anything there. using defaults only?
# if $cxx. != msvc
#./: exe{format-impl-test} : test/cxx{format-impl-test header-only-test} ../test-main/liba{test-main}

# Tests which do not use gtest and therefore should link directly to fmt only and not the test-main lib

# TODO: Is there a clean way to use a declarative list but with more structure, in order to pair names to additional options?
standalone_test_names = \
enforce-checks-test # -DFMT_ENFORCE_COMPILE_STRING

import fmt = fmt%lib{fmt}

for test_name : $standalone_test_names
{
./: exe{$test_name} : test/cxx{$test_name} $fmt
}

# END [Tests which do not use gtest and therefore should link directly to fmt only and not the test-main lib]
2 changes: 0 additions & 2 deletions fmt/tests/basics/buildfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import! [metadata, rule_hint=cxx.link] libs = fmt%lib{fmt}

./ :

./ : exe{driver} : include = $($libs: fmt.has_header)
./ : exe{driver-modules} : include = $($libs: fmt.has_module)

Expand Down

0 comments on commit bffc9c4

Please sign in to comment.