From f8c6b7c7c032a6b3188fc1ec44f7dff7bce8b67d Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 25 Jul 2023 19:47:38 +0200 Subject: [PATCH] Improve the version error message Use the terminology want/got to determine which version the user is requested and the version the library provides. --- CHANGELOG.md | 1 + src/rt/ovni.c | 10 ++++------ test/emu/ovni/CMakeLists.txt | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd84d3e..69bdf41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Don't rely on /tmp or $TMPDIR in tests. +- Fix misleading message in version check. ## [1.2.1] - 2022-07-25 diff --git a/src/rt/ovni.c b/src/rt/ovni.c index 67bb31b..d706dd0 100644 --- a/src/rt/ovni.c +++ b/src/rt/ovni.c @@ -39,16 +39,14 @@ void ovni_version_check_str(const char *version) /* Match the major */ if (provided[0] != expected[0]) { - die("ovni major version mismatch: found %d (%s), expected %d (%s)", - provided[0], version, - expected[0], OVNI_LIB_VERSION); + die("incompatible ovni major version: wants %s, got %s", + version, OVNI_LIB_VERSION); } /* Only fail if the minor is newer */ if (provided[1] > expected[1]) { - die("ovni minor version too new: found %d (%s), expected %d (%s)", - provided[1], version, - expected[1], OVNI_LIB_VERSION); + die("incompatible ovni minor version: wants %s, got %s", + version, OVNI_LIB_VERSION); } /* Ignore the patch number */ diff --git a/test/emu/ovni/CMakeLists.txt b/test/emu/ovni/CMakeLists.txt index df11ba6..513173a 100644 --- a/test/emu/ovni/CMakeLists.txt +++ b/test/emu/ovni/CMakeLists.txt @@ -11,7 +11,7 @@ test_emu(sort-first-and-full-ring.c SORT test_emu(burst-stats.c REGEX "burst stats: median/avg/max = 33/ 33/ 33 ns") test_emu(mp-simple.c MP) test_emu(version-good.c) -test_emu(version-bad.c SHOULD_FAIL REGEX "version mismatch") +test_emu(version-bad.c SHOULD_FAIL REGEX "incompatible .* version") test_emu(clockgate.c MP SHOULD_FAIL REGEX "detected large clock gate") test_emu(no-cpus.c SHOULD_FAIL REGEX "loom .* has no physical CPUs") test_emu(sort-cpus-by-loom.c MP)