Improve the version error message

Use the terminology want/got to determine which version the user is
requested and the version the library provides.
This commit is contained in:
Rodrigo Arias 2023-07-25 19:47:38 +02:00
parent bb946fa5f6
commit f8c6b7c7c0
3 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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)