summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRitesh Khadgaray <khadgaray@gmail.com>2020-10-16 12:17:49 -0700
committerRitesh Khadgaray <khadgaray@gmail.com>2020-10-16 13:18:09 -0700
commit853603a54eb8fb88c41277436495aee7998d2423 (patch)
tree5692283a0a12b11d4ddb032afa6dc3755e116be8 /test
parent07f8d12c6e8976989ac3fc96723893382483a820 (diff)
downloadnix-853603a54eb8fb88c41277436495aee7998d2423.zip
update require_kernel_version to handle "_" in version string
test code breaks on fedora 33 ``` $ cargo test failures: ---- sys::test_socket::recvfrom::udp_offload::gro stdout ---- thread 'sys::test_socket::recvfrom::udp_offload::gro' panicked at 'called `Result::unwrap()` on an `Err` value: ParseError("Extra junk after valid version: _64")', test/sys/test_socket.rs:292:13 ``` this is due underscore in release string( arch/x86_64), which is not supported by semver. ``` $ uname -r 5.8.14-300.fc33.x86_64 ``` Replace the underscore with hypen to provide a consistent sematic.
Diffstat (limited to 'test')
-rw-r--r--test/test.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/test.rs b/test/test.rs
index 8ad09b6a..37c81f94 100644
--- a/test/test.rs
+++ b/test/test.rs
@@ -95,7 +95,11 @@ cfg_if! {
let uname = nix::sys::utsname::uname();
- let mut version = Version::parse(uname.release()).unwrap();
+ // Linux may report version as 4.18.el8_2.x86_64 or 5.18.200-fc33.x86_64
+ // semver sematics does not support underscore. Replace this with hypen.
+ let mut version = Version::parse(
+ &uname.release().to_string().replace("_", "-")
+ ).unwrap();
//Keep only numeric parts
version.pre.clear();