tools/testing/selftests/sched_ext/runner.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/sched_ext/runner.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/sched_ext/runner.c
Extension
.c
Size
5961 bytes
Lines
256
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

switch (opt) {
		case 'q':
			quiet = true;
			break;
		case 's':
			print_skipped = true;
			break;
		case 'l':
			list = true;
			break;
		case 't':
			filter = optarg;
			break;
		default:
			fprintf(stderr, help_fmt, basename(argv[0]));
			return opt != 'h';
		}
	}

	if (optind < argc) {
		fprintf(stderr, "Unexpected argument '%s'. Use -t to filter tests.\n",
			argv[optind]);
		return 1;
	}

	if (filter) {
		for (i = 0; i < __scx_num_tests; i++) {
			if (!should_skip_test(&__scx_tests[i], filter))
				break;
		}
		if (i == __scx_num_tests) {
			fprintf(stderr, "No tests matched filter '%s'\n", filter);
			fprintf(stderr, "Available tests (use -l to list):\n");
			for (i = 0; i < __scx_num_tests; i++)
				fprintf(stderr, "  %s\n", __scx_tests[i].name);
			return 1;
		}
	}

	for (i = 0; i < __scx_num_tests; i++) {
		enum scx_test_status status;
		struct scx_test *test = &__scx_tests[i];

		if (exit_req)
			break;

		if (list) {
			printf("%s\n", test->name);
			if (i == (__scx_num_tests - 1))
				return 0;
			continue;
		}

		if (filter && should_skip_test(test, filter)) {
			/*
			 * Printing the skipped tests and their preambles can
			 * add a lot of noise to the runner output. Printing
			 * this is only really useful for CI, so let's skip it
			 * by default.
			 */
			if (print_skipped) {
				print_test_preamble(test, quiet);
				print_test_result(test, SCX_TEST_SKIP, ++testnum);
			}
			continue;
		}

		print_test_preamble(test, quiet);
		status = run_test(test);
		print_test_result(test, status, ++testnum);
		switch (status) {
		case SCX_TEST_PASS:
			passed++;
			break;
		case SCX_TEST_SKIP:
			skipped_tests[skipped++] = test->name;
			break;
		case SCX_TEST_FAIL:
			failed_tests[failed++] = test->name;
			break;
		}
	}
	printf("\n\n=============================\n\n");
	printf("RESULTS:\n\n");
	printf("PASSED:  %u\n", passed);
	printf("SKIPPED: %u\n", skipped);
	printf("FAILED:  %u\n", failed);
	if (skipped > 0) {
		printf("\nSkipped tests:\n");
		for (i = 0; i < skipped; i++)

Annotation

Implementation Notes