From 0c1d1486ecc7159bfe808cd8d929e2962f53e58e Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Wed, 25 Oct 2017 15:10:41 +0100 Subject: COMPMID-623 Make command line options case insensitive Change-Id: I91093ce5d5c8643ada4ecc12b86f5f4eda9ba234 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/93306 Tested-by: Kaizen Reviewed-by: Georgios Pinitas --- tests/framework/command_line/CommandLineParser.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/framework') diff --git a/tests/framework/command_line/CommandLineParser.cpp b/tests/framework/command_line/CommandLineParser.cpp index 228b18d842..11eb1f3a4d 100644 --- a/tests/framework/command_line/CommandLineParser.cpp +++ b/tests/framework/command_line/CommandLineParser.cpp @@ -56,7 +56,11 @@ void CommandLineParser::parse(int argc, char **argv) for(int i = 1; i < argc; ++i) { - const std::string option{ argv[i] }; + std::string mixed_case_opt{ argv[i] }; + int equal_sign = mixed_case_opt.find('='); + int pos = (equal_sign == -1) ? strlen(argv[i]) : equal_sign; + + const std::string option = tolower(mixed_case_opt.substr(0, pos)) + mixed_case_opt.substr(pos); std::smatch option_matches; if(std::regex_match(option, option_matches, option_regex)) -- cgit v1.2.1