Skip to content

Commit

Permalink
Only set primary for gcc on x86_64. (KhronosGroup#30)
Browse files Browse the repository at this point in the history
Due to slightly different compression results from
zlib on arm64 which mean ktxdiff must be used.

Add value of cli_args.primary to command echoed for
re-running a failed subcase so avoid someone going
into a black hole for 2 hours discovering why the
test passes with the echoed command but not when
run via ctests.
  • Loading branch information
MarkCallow authored Sep 16, 2024
1 parent a99bad8 commit 96bdfcd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion clitests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ if(NOT DEFINED KTX_DIFF_PATH)
message(FATAL_ERROR "KTX_DIFF_PATH not defined")
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Even with gcc, zlib yields a slightly different compression
# result on arm64. Yet to be investigated.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CPU_ARCHITECTURE STREQUAL x86_64)
set(CLITEST_ARGS "--primary")
else()
set(CLITEST_ARGS "")
Expand Down
3 changes: 2 additions & 1 deletion clitests/clitest.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ def compare_with_ktxdiff(filepath_expected, filepath_received, tolerance):
messages.extend([" " + msg for msg in subcase_messages])
messages.append(f" Run subcase with:")
ktxdiff_arg = f" -d \"{cli_args.ktxdiff_path}\"" if cli_args.ktxdiff_path else ""
messages.append(f" clitest.py -e \"{cli_args.executable_path}\"{ktxdiff_arg} {cli_args.json_test_file} {ctx.cmdArgs()}")
primary_arg = f" --primary" if cli_args.primary else ""
messages.append(f" clitest.py{primary_arg} -e \"{cli_args.executable_path}\"{ktxdiff_arg} {cli_args.json_test_file} {ctx.cmdArgs()}")
subcases_failed += 1
failed = True

Expand Down
2 changes: 1 addition & 1 deletion clitests/tests/create/raw_zlib.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"description": "Test creation of ZLIB compressed textures.",
"command": "ktx create --testrun ${level[flag]} --raw --format ${subcase} --width 8 --height 8 --levels 1 input/raw/raw_${subcase}_2D_8x8.raw output/create/raw_zlib/output_${subcase}_2D_ZLIB${level[name]}.ktx2",
"status": 0,
"comment": "On MacOS zlib yields a slightly different compression result, but color values should not differ",
"comment": "On arm64 zlib yields a slightly different compression result, but color values should not differ",
"outputTolerance": 0.001,
"outputs": {
"output/create/raw_zlib/output_${subcase}_2D_ZLIB${level[name]}.ktx2": "golden/create/raw_zlib/output_${subcase}_2D_ZLIB${level[name]}.ktx2"
Expand Down
2 changes: 1 addition & 1 deletion clitests/tests/create/sample_zlib.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"description": "Test creation of ZLIB compressed textures with the sample PNG input files.",
"command": "ktx create --testrun ${level[flag]} --format ${subcase[format]} input/png_sample/${subcase[file]}${subcase[ext]} output/create/sample_zlib/${subcase[file]}_ZLIB${level[name]}.ktx2",
"status": 0,
"comment": "On MacOS zlib yields a slightly different compression result, but color values should not differ",
"comment": "On arm64 zlib yields a slightly different compression result, but color values should not differ",
"outputTolerance": 0.001,
"outputs": {
"output/create/sample_zlib/${subcase[file]}_ZLIB${level[name]}.ktx2": "golden/create/sample_zlib/${subcase[file]}_ZLIB${level[name]}.ktx2"
Expand Down

0 comments on commit 96bdfcd

Please sign in to comment.