From ac6caf17e36f90669156a48e8ffa8d8e315a2690 Mon Sep 17 00:00:00 2001
From: Fuad Ismail <fuad1502@gmail.com>
Date: Sun, 17 Nov 2024 09:56:01 +0700
Subject: [PATCH] tests/dmesg: add kmsg-file option with nonexistent file test.

---
 tests/by-util/test_dmesg.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/by-util/test_dmesg.rs b/tests/by-util/test_dmesg.rs
index 129fa0e..08e398a 100644
--- a/tests/by-util/test_dmesg.rs
+++ b/tests/by-util/test_dmesg.rs
@@ -9,6 +9,17 @@ fn test_invalid_arg() {
     new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
 }
 
+#[test]
+fn test_kmsg_nonexistent_file() {
+    new_ucmd!()
+        .arg("--kmsg-file")
+        .arg("definitely-nonexistent-file")
+        .fails()
+        .code_is(1)
+        .no_stdout()
+        .stderr_is("dmesg: cannot open definitely-nonexistent-file: No such file or directory\n");
+}
+
 #[test]
 fn test_kmsg_json() {
     new_ucmd!()