tests/dmesg: use fixed offset time argument in test.
This commit is contained in:
parent
48c4f78088
commit
b90751119d
@ -118,8 +118,6 @@ impl DeltaFormatter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_datetime(s: &str) -> UResult<DateTime<FixedOffset>> {
|
pub fn parse_datetime(s: &str) -> UResult<DateTime<FixedOffset>> {
|
||||||
#[cfg(feature = "fixed-boot-time")]
|
|
||||||
set_fixed_timezone();
|
|
||||||
match parse_datetime::parse_datetime(s) {
|
match parse_datetime::parse_datetime(s) {
|
||||||
Ok(date_time) => Ok(date_time),
|
Ok(date_time) => Ok(date_time),
|
||||||
Err(_) => Err(USimpleError::new(1, format!("invalid time value \"{s}\""))),
|
Err(_) => Err(USimpleError::new(1, format!("invalid time value \"{s}\""))),
|
||||||
@ -184,11 +182,3 @@ fn boot_time_from_utmpx() -> Option<DateTime<FixedOffset>> {
|
|||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "fixed-boot-time")]
|
|
||||||
static SET_TZ: OnceLock<()> = OnceLock::new();
|
|
||||||
|
|
||||||
#[cfg(feature = "fixed-boot-time")]
|
|
||||||
fn set_fixed_timezone() {
|
|
||||||
*SET_TZ.get_or_init(|| std::env::set_var("TZ", "Asia/Jakarta"))
|
|
||||||
}
|
|
||||||
|
@ -152,8 +152,8 @@ fn test_since_until() {
|
|||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("--kmsg-file")
|
.arg("--kmsg-file")
|
||||||
.arg("kmsg.input")
|
.arg("kmsg.input")
|
||||||
.arg("--since=\"2024-11-19 17:47:32\"")
|
.arg("--since=\"2024-11-19 17:47:32 +0700\"")
|
||||||
.arg("--until=\"2024-11-19 18:55:52\"")
|
.arg("--until=\"2024-11-19 18:55:52 +0700\"")
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only_fixture("test_since_until.expected");
|
.stdout_only_fixture("test_since_until.expected");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user