Browse Source

Merge pull request #96926 from Dowsley/user-provided-arguments-fix

Ignore `--test` flag when it is an user-provided argument
Thaddeus Crews 7 tháng trước cách đây
mục cha
commit
f45d2f8f6c
1 tập tin đã thay đổi với 5 bổ sung0 xóa
  1. 5 0
      main/main.cpp

+ 5 - 0
main/main.cpp

@@ -864,6 +864,11 @@ void Main::test_cleanup() {
 
 int Main::test_entrypoint(int argc, char *argv[], bool &tests_need_run) {
 	for (int x = 0; x < argc; x++) {
+		// Early return to ignore a possible user-provided "--test" argument.
+		if ((strlen(argv[x]) == 2) && ((strncmp(argv[x], "--", 2) == 0) || (strncmp(argv[x], "++", 2) == 0))) {
+			tests_need_run = false;
+			return EXIT_SUCCESS;
+		}
 		if ((strncmp(argv[x], "--test", 6) == 0) && (strlen(argv[x]) == 6)) {
 			tests_need_run = true;
 #ifdef TESTS_ENABLED