-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First try to test with modules under OSX #2
First try to test with modules under OSX #2
Conversation
Tested with cmake v3.26.3 and clang v16.0.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Danke für deine Vorschläge, Carl!
Alles was du tust, muß mindestens dieselben erfolgreichen Tests haben wie aktuell in meinem Repo. Regressionen sind immer problematisch.
Kannst du eigentlich aktuell manuell auf deinem Rechner die bestehenden Quellen übersetzen und die Tests erfolgreich durchlaufen? Wenn das nicht funktionieren sollte, wäre das der erste notwendige Schritt vor allen weiteren.
Super-interessant wäre der Inhalt der Dependency-Datei, welche mit -MD
erstellt wird. Ich habe keinen Zugriff auf ein OSX-System und kann daher nicht erkennen, ob das noch was im GMF des Modules fehlt. Im Grunde reicht dafür
clang++ -std=c++20 -fmodule-output -MD -c -x c++ fmt.cxx
endif () | ||
if (FMT_TEST AND FMT_MODULE) | ||
# The tests require {fmt} to be compiled as traditional library | ||
message(STATUS "Testing is incompatible with build mode 'module'.") | ||
message(WARNING "FMT_MODULE: Some test are incompatible and disabled!") | ||
endif () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diese drei Änderungen bringen keine funktionalen Vorteile. Erst Funktion, später Kosmetik. Immerhin muß das muß das Eingang in das originale {fmt} Repository finden und dann will Victor wissen, wozu das gut ist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solange nicht alle Tests laufen finde ich das wichtig, dann kann das wieder raus.
target_compile_options(compile-fp-test PRIVATE /Zc:__cplusplus) | ||
endif() | ||
add_fmt_test(printf-test) | ||
add_fmt_test(ranges-test ranges-odr-test.cc) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Die funktionalen Tests sollen auf jeden Fall mitlaufen. Bei Compilern, die Modules beherrschen (und nur dort!) sollen zusätzlich die beiden Targets test-module
(Erstellen des BMI und der Lib) und module-test
(Nutzen des BMI) erstellt und getestet werden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Klar, bisher wurde aber mit der Module version gar kein test compiliert!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Und einfach so von der Kommandozeile? (Dateien passend zurechtgelegt)
clang++ -std=c++20 -fmodule-output -c -x c++ fmt.cc
clang++ -std=c++20 -I. -stdlib=libc++ test-main.cc gtest-extra.cc util.cc format.cc os.cc gmock-gtest-all.cc
clang++ -std=c++20 -I. -stdlib=libc++ -fprebuilt-module-path=. module-test.cc test-main.o gtest-extra.o util.o format.o os.o gmock-gtest-all.o fmt.o -o module-test.exe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a little more love it works:
#!/bin/sh
files="
../test/args-test.cc
../test/std-test.cc
../test/os-test.cc
../test/module-test.cc
../test/gtest-extra.cc
../test/chrono-test.cc
../test/ranges-test.cc
../test/cuda-test/cpp14.cc
../test/ostream-test.cc
../test/unicode-test.cc
../test/test-main.cc
../test/compile-test.cc
../test/scan-test.cc
../test/gtest-extra-test.cc
../test/noexception-test.cc
../test/enforce-checks-test.cc
../test/xchar-test.cc
../test/util.cc
../test/gtest/gmock-gtest-all.cc
../test/assert-test.cc
../test/ranges-odr-test.cc
../test/detect-stdfs.cc
../test/compile-fp-test.cc
../test/posix-mock-test.cc
../test/core-test.cc
../test/format-test.cc
../test/header-only-test.cc
../test/color-test.cc
../test/printf-test.cc
../test/format-impl-test.cc
../src/os.cc
../src/format.cc
../src/fmt.cc
"
for f in $files; do ln -s $f .; done
clang++ -std=c++20 -fmodule-output=fmt.pcm -I../include -c -x c++-module fmt.cc
clang++ -std=c++20 -I../include -I../test/gtest -I../test -stdlib=libc++ test-main.cc gtest-extra.cc util.cc format.cc os.cc gmock-gtest-all.cc -c
clang++ -std=c++20 -I../test -stdlib=libc++ -fprebuilt-module-path=. module-test.cc *.o -o module-test
exit
#######################
bash-3.2$ ./module-test
[==========] Running 45 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 45 tests from module_test
[ RUN ] module_test.namespace
[ OK ] module_test.namespace (0 ms)
[ RUN ] module_test.detail_namespace
[ OK ] module_test.detail_namespace (0 ms)
[ RUN ] module_test.macros
[ OK ] module_test.macros (0 ms)
[ RUN ] module_test.to_string
[ OK ] module_test.to_string (0 ms)
[ RUN ] module_test.format
[ OK ] module_test.format (0 ms)
[ RUN ] module_test.format_to
[ OK ] module_test.format_to (0 ms)
[ RUN ] module_test.formatted_size
[ OK ] module_test.formatted_size (0 ms)
[ RUN ] module_test.format_to_n
[ OK ] module_test.format_to_n (0 ms)
[ RUN ] module_test.format_args
[ OK ] module_test.format_args (0 ms)
[ RUN ] module_test.wformat_args
[ OK ] module_test.wformat_args (0 ms)
[ RUN ] module_test.dynamic_format_args
[ OK ] module_test.dynamic_format_args (0 ms)
[ RUN ] module_test.vformat
[ OK ] module_test.vformat (0 ms)
[ RUN ] module_test.vformat_to
[ OK ] module_test.vformat_to (0 ms)
[ RUN ] module_test.vformat_to_n
[ OK ] module_test.vformat_to_n (0 ms)
[ RUN ] module_test.print
module-test.cc:256: Failure
fmt::print(L"{}µ", 42) produces different output.
Expected: 4\0\0\02\0\0\0?\0\0\0
Actual: 42?
module-test.cc:257: Failure
fmt::print(__stderrp, L"{}µ", 4.2) produces different output.
Expected: 4\0\0\0.\0\0\02\0\0\0?\0\0\0
Actual: 4.2?
[ FAILED ] module_test.print (0 ms)
[ RUN ] module_test.vprint
module-test.cc:265: Failure
fmt::vprint(L"{:}µ", fmt::make_wformat_args(42)) produces different output.
Expected: 4\0\0\02\0\0\0?\0\0\0
Actual: 42?
module-test.cc:267: Failure
fmt::vprint(__stderrp, L"{}", fmt::make_wformat_args(42)) produces different output.
Expected: 4\0\0\02\0\0\0
Actual: 42
[ FAILED ] module_test.vprint (0 ms)
[ RUN ] module_test.named_args
[ OK ] module_test.named_args (0 ms)
[ RUN ] module_test.literals
[ OK ] module_test.literals (0 ms)
[ RUN ] module_test.locale
[ OK ] module_test.locale (0 ms)
[ RUN ] module_test.string_view
[ OK ] module_test.string_view (0 ms)
[ RUN ] module_test.memory_buffer
[ OK ] module_test.memory_buffer (0 ms)
[ RUN ] module_test.is_char
[ OK ] module_test.is_char (0 ms)
[ RUN ] module_test.ptr
[ OK ] module_test.ptr (0 ms)
[ RUN ] module_test.errors
[ OK ] module_test.errors (4 ms)
[ RUN ] module_test.error_code
[ OK ] module_test.error_code (0 ms)
[ RUN ] module_test.format_int
[ OK ] module_test.format_int (0 ms)
[ RUN ] module_test.formatter
[ OK ] module_test.formatter (0 ms)
[ RUN ] module_test.join
[ OK ] module_test.join (0 ms)
[ RUN ] module_test.time
[ OK ] module_test.time (1 ms)
[ RUN ] module_test.time_point
[ OK ] module_test.time_point (0 ms)
[ RUN ] module_test.time_duration
[ OK ] module_test.time_duration (0 ms)
[ RUN ] module_test.weekday
[ OK ] module_test.weekday (0 ms)
[ RUN ] module_test.printf
[ OK ] module_test.printf (0 ms)
[ RUN ] module_test.fprintf
[ OK ] module_test.fprintf (0 ms)
[ RUN ] module_test.sprintf
[ OK ] module_test.sprintf (0 ms)
[ RUN ] module_test.vprintf
[ OK ] module_test.vprintf (0 ms)
[ RUN ] module_test.vfprintf
[ OK ] module_test.vfprintf (0 ms)
[ RUN ] module_test.vsprintf
[ OK ] module_test.vsprintf (0 ms)
[ RUN ] module_test.color
[ OK ] module_test.color (0 ms)
[ RUN ] module_test.cstring_view
[ OK ] module_test.cstring_view (0 ms)
[ RUN ] module_test.buffered_file
[ OK ] module_test.buffered_file (0 ms)
[ RUN ] module_test.output_file
[=disabled=] Clang 16.0 emits multiple copies of vtables
[ OK ] module_test.output_file (0 ms)
[ RUN ] module_test.custom_context
[ OK ] module_test.custom_context (0 ms)
[ RUN ] module_test.compile_format_string
[=disabled=] Clang 16.0 fails to import user-defined literals
[ OK ] module_test.compile_format_string (0 ms)
[ RUN ] module_test.std_types
[ OK ] module_test.std_types (0 ms)
[----------] 45 tests from module_test (7 ms total)
[----------] Global test environment tear-down
[==========] 45 tests from 1 test suite ran. (7 ms total)
[ PASSED ] 43 tests.
[ FAILED ] 2 tests, listed below:
[ FAILED ] module_test.print
[ FAILED ] module_test.vprint
2 FAILED TESTS
bash-3.2$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some progress! 🎉
The test failures are possibly related to some encoding issues. There are no functional tests for fmt::print
with wide strings in format-test.cc
. May be you want to add them there for a cross-check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, nun war ich ins Englische abgerutscht 🤦♀️
Ich bin nicht sicher, ob Deutsch deine Muttersprache ist. Dein Name könnte auch Schwedisch sein 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mein Name ist Claus Klein
aus Schwäbisch Hall
(gebürtiger Pfälzer) ;-)
if (FMT_CAN_MODULE) | ||
return () | ||
endif () | ||
|
||
if (NOT DEFINED MSVC_STATIC_RUNTIME AND MSVC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wenn die Test-Runner damit glücklich sind, bin ich's auch 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nur solange nicht alle tests linken, und war sowie drinnen, nur ganz oben!
Ich bin im Moment nur am linken des module tests
interessiert, solange der nicht geht.
@@ -139,7 +145,7 @@ endif() | |||
|
|||
if (NOT MSVC_STATIC_RUNTIME) | |||
add_fmt_executable(posix-mock-test | |||
posix-mock-test.cc ../src/format.cc ${TEST_MAIN_SRC}) | |||
posix-mock-test.cc ${PROJECT_SOURCE_DIR}/src/format.cc ${TEST_MAIN_SRC}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Das und die beiden nachfolgenden Änderungen haben nicht mit dem Module zu tun! Also bitte nicht ändern, wie alle anderen bestehenden funktionalen Test aus dem Original-Repo bei Victor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
des ..
gibt eine __
im binary dir path!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Da kann ich leider nichts beitragen. Meine Grundlage ist das originale CMakeLists.txt
mit meinen Änderungen für Modules aus 2019, welche die letzten beiden Jahre bei Victor nicht überlebt haben. CMake war unfähig, ordentliche Projekte für den GitHub CI zu erzeugen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMake
macht das, was man in den CMakeLists.txt
modelliert!
Die Tests sind undurchsichtig, für mich nicht nachvollziehbar modelliert?
Warum wird nicht die vorgebaute fmt
lib verwendet?
Die libfmt.a
wird 2 mal gebaut, mit gleichem Inhalt. See TODO.txt.
Ich kann nicht linken, immer noch ein unresolved! siehe TODO.txt. Claus |
Mein version geht jetzt auf dem CI, aber nicht auf meinem OSX!
[
{
"directory": "/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install",
"command": "/usr/local/opt/llvm/bin/clang++-16 -I/Users/clausklein/Workspace/cpp/fmt/include -g -std=c++20 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fvisibility=hidden -fvisibility-inlines-hidden -fmodule-output=/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install/fmt.pcm -x c++-module -o CMakeFiles/fmt.dir/src/fmt.cc.o -c /Users/clausklein/Workspace/cpp/fmt/src/fmt.cc",
"file": "/Users/clausklein/Workspace/cpp/fmt/src/fmt.cc",
"output": "CMakeFiles/fmt.dir/src/fmt.cc.o"
},
{
"directory": "/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install",
"command": "/usr/local/opt/llvm/bin/clang++-16 -DGTEST_HAS_STD_WSTRING=1 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1 -I/Users/clausklein/Workspace/cpp/fmt/include -isystem /Users/clausklein/Workspace/cpp/fmt/test/gtest/. -g -std=c++20 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fvisibility=hidden -fvisibility-inlines-hidden -o test/CMakeFiles/test-main.dir/test-main.cc.o -c /Users/clausklein/Workspace/cpp/fmt/test/test-main.cc",
"file": "/Users/clausklein/Workspace/cpp/fmt/test/test-main.cc",
"output": "test/CMakeFiles/test-main.dir/test-main.cc.o"
},
{
"directory": "/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install",
"command": "/usr/local/opt/llvm/bin/clang++-16 -DGTEST_HAS_STD_WSTRING=1 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1 -I/Users/clausklein/Workspace/cpp/fmt/include -isystem /Users/clausklein/Workspace/cpp/fmt/test/gtest/. -g -std=c++20 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fvisibility=hidden -fvisibility-inlines-hidden -o test/CMakeFiles/test-main.dir/gtest-extra.cc.o -c /Users/clausklein/Workspace/cpp/fmt/test/gtest-extra.cc",
"file": "/Users/clausklein/Workspace/cpp/fmt/test/gtest-extra.cc",
"output": "test/CMakeFiles/test-main.dir/gtest-extra.cc.o"
},
{
"directory": "/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install",
"command": "/usr/local/opt/llvm/bin/clang++-16 -DGTEST_HAS_STD_WSTRING=1 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1 -I/Users/clausklein/Workspace/cpp/fmt/include -isystem /Users/clausklein/Workspace/cpp/fmt/test/gtest/. -g -std=c++20 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fvisibility=hidden -fvisibility-inlines-hidden -o test/CMakeFiles/test-main.dir/util.cc.o -c /Users/clausklein/Workspace/cpp/fmt/test/util.cc",
"file": "/Users/clausklein/Workspace/cpp/fmt/test/util.cc",
"output": "test/CMakeFiles/test-main.dir/util.cc.o"
},
{
"directory": "/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install",
"command": "/usr/local/opt/llvm/bin/clang++-16 -I/Users/clausklein/Workspace/cpp/fmt/include -g -std=c++20 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fvisibility=hidden -fvisibility-inlines-hidden -fmodule-output=/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install/test/fmt.pcm -x c++-module -o test/CMakeFiles/test-module.dir/__/src/fmt.cc.o -c /Users/clausklein/Workspace/cpp/fmt/src/fmt.cc",
"file": "/Users/clausklein/Workspace/cpp/fmt/src/fmt.cc",
"output": "test/CMakeFiles/test-module.dir/__/src/fmt.cc.o"
},
{
"directory": "/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install",
"command": "/usr/local/opt/llvm/bin/clang++-16 -DGTEST_HAS_STD_WSTRING=1 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1 -I/Users/clausklein/Workspace/cpp/fmt/include -isystem /Users/clausklein/Workspace/cpp/fmt/test/gtest/. -g -std=c++20 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fvisibility=hidden -fvisibility-inlines-hidden -fmodule-file=fmt=/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install/test/fmt.pcm -fmodule-file=fmt=/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install/fmt.pcm -o test/CMakeFiles/module-test.dir/module-test.cc.o -c /Users/clausklein/Workspace/cpp/fmt/test/module-test.cc",
"file": "/Users/clausklein/Workspace/cpp/fmt/test/module-test.cc",
"output": "test/CMakeFiles/module-test.dir/module-test.cc.o"
},
{
"directory": "/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install",
"command": "/usr/local/opt/llvm/bin/clang++-16 -DGTEST_HAS_STD_WSTRING=1 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1 -I/Users/clausklein/Workspace/cpp/fmt/include -isystem /Users/clausklein/Workspace/cpp/fmt/test/gtest/. -g -std=c++20 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fvisibility=hidden -fvisibility-inlines-hidden -fmodule-file=fmt=/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install/test/fmt.pcm -fmodule-file=fmt=/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install/fmt.pcm -o test/CMakeFiles/module-test.dir/test-main.cc.o -c /Users/clausklein/Workspace/cpp/fmt/test/test-main.cc",
"file": "/Users/clausklein/Workspace/cpp/fmt/test/test-main.cc",
"output": "test/CMakeFiles/module-test.dir/test-main.cc.o"
},
{
"directory": "/Users/clausklein/Workspace/cpp/fmt/cmake-build-fmt-x86_64-Debug/install",
"command": "/usr/local/opt/llvm/bin/clang++-16 -DGTEST_HAS_STD_WSTRING=1 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1 -isystem /Users/clausklein/Workspace/cpp/fmt/test/gtest/. -g -std=c++20 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fvisibility=hidden -fvisibility-inlines-hidden -o test/gtest/CMakeFiles/gtest.dir/gmock-gtest-all.cc.o -c /Users/clausklein/Workspace/cpp/fmt/test/gtest/gmock-gtest-all.cc",
"file": "/Users/clausklein/Workspace/cpp/fmt/test/gtest/gmock-gtest-all.cc",
"output": "test/gtest/CMakeFiles/gtest.dir/gmock-gtest-all.cc.o"
}
] |
if (FMT_MODULE) | ||
return () | ||
endif () | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Es sind nie die test mit module kompiliert worden bisher!
Danke Carl! |
"fmt::v9::file::~file()", referenced from: | ||
output_redirect::output_redirect(__sFILE*) in libtest-main.a(gtest-extra.cc.o) | ||
output_redirect::~output_redirect() in libtest-main.a(gtest-extra.cc.o) | ||
ld: symbol(s) not found for architecture x86_64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Das sieht so aus, als ob format.o
fehlt.
Der Test hat alle Symbole doppelt: einmal im Modul fmt
and damit attached an das Modul mit anderem Mangling, und ein zweites Mal in der Test-Infrastruktur (libtest-main
mit gtest
und fmt
) als traditioneller Build mit normalem Mangling.
Hallo Daniela, Die test mit
|
See this example, it works without link the
|
Tested with cmake v3.26.3 and clang v16.0.2.
There are still linker problems, see TODO.txt.