From 0e14e48b84fd8f759bb5a0f5261cdb090d1ffe90 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 9 Apr 2019 16:25:03 -0700 Subject: Match multi-word State From a recent test failure: "State:\tD (disk sleep)\n" "disk sleep" does not match \w+. We need to allow spaces. PiperOrigin-RevId: 242762469 Change-Id: Ic8d05a16669412a72c1e76b498373e5b22fe64c4 --- test/syscalls/linux/proc.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/syscalls/linux/proc.cc') diff --git a/test/syscalls/linux/proc.cc b/test/syscalls/linux/proc.cc index 337d9e3f4..2da7006cf 100644 --- a/test/syscalls/linux/proc.cc +++ b/test/syscalls/linux/proc.cc @@ -99,8 +99,11 @@ std::vector saved_argv; // NOLINT void CompareProcessState(absl::string_view state, int pid) { auto status_file = ASSERT_NO_ERRNO_AND_VALUE( GetContents(absl::StrCat("/proc/", pid, "/status"))); - EXPECT_THAT(status_file, ContainsRegex(absl::StrCat("State:.[", state, - "]\\s+\\(\\w+\\)"))); + // N.B. POSIX extended regexes don't support shorthand character classes (\w) + // inside of brackets. + EXPECT_THAT(status_file, + ContainsRegex(absl::StrCat("State:.[", state, + R"EOL(]\s+\([a-zA-Z ]+\))EOL"))); } // Run callbacks while a subprocess is running, zombied, and/or exited. -- cgit v1.2.3