Don't use a regex to test the CPU vendor string.

This test will break if there is an unusual character in the vendor
string. Moreover, std::regex is banned in Chromium so the test is
blocking the roll.

Probably all that can meaningfully be tested here is that the vendor
string is non-empty, so do that instead.

Change-Id: I60ea52e1b52c4d8e467518d03088815dcb5e3fce
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1756327
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
This commit is contained in:
Peter Collingbourne 2019-08-15 09:37:31 -07:00 committed by Commit Bot
parent bde5196af5
commit 6225d78906

View File

@ -17,7 +17,6 @@
#include <sys/time.h>
#include <time.h>
#include <regex>
#include <string>
#include "build/build_config.h"
@ -77,8 +76,7 @@ TEST_F(SystemSnapshotWinTest, CPUVendor) {
#if defined(ARCH_CPU_X86_FAMILY)
EXPECT_TRUE(cpu_vendor == "GenuineIntel" || cpu_vendor == "AuthenticAMD");
#elif defined(ARCH_CPU_ARM64)
std::regex cpu_vendor_regex("[a-zA-Z0-9 \\-.]+");
EXPECT_TRUE(std::regex_match(cpu_vendor, cpu_vendor_regex));
EXPECT_FALSE(cpu_vendor.empty());
#else
#error Unsupported Windows Arch
#endif