summaryrefslogtreecommitdiff
path: root/libc-test/test/linux_kernel_version.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-21 12:54:30 +0000
committerbors <bors@rust-lang.org>2022-12-21 12:54:30 +0000
commitc59ca735304319dd4face349f49fb77f2164b544 (patch)
treed3e0cae2f2f21b4caf17e19d52b39e69967c724c /libc-test/test/linux_kernel_version.rs
parent45b431a79ec7f72c245fb0631f2d05a9f16ca5a8 (diff)
parent88d6a1fd9b4b62729bd55a76e727f5f1d0aeef20 (diff)
downloadrust-libc-c59ca735304319dd4face349f49fb77f2164b544.tar.gz
Auto merge of #3041 - devnexen:linux_kernel_version, r=JohnTitor
adding KERNEL_VERSION macro for linux.
Diffstat (limited to 'libc-test/test/linux_kernel_version.rs')
-rw-r--r--libc-test/test/linux_kernel_version.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/libc-test/test/linux_kernel_version.rs b/libc-test/test/linux_kernel_version.rs
new file mode 100644
index 0000000000..c5687edad5
--- /dev/null
+++ b/libc-test/test/linux_kernel_version.rs
@@ -0,0 +1,17 @@
+//! Compare libc's KERNEL_VERSION macro against a specific kernel version.
+
+extern crate libc;
+
+#[cfg(
+ target_os = "linux",
+)]
+mod t {
+ use libc;
+
+ #[test]
+ fn test_kernel_version() {
+ unsafe {
+ assert_eq!(libc::KERNEL_VERSION(6, 0, 0), 393216);
+ }
+ }
+}