tools/testing/selftests/bpf/test_progs.h

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/test_progs.h

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/test_progs.h
Extension
.h
Size
15135 bytes
Lines
571
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

struct test_filter {
	char *name;
	char **subtests;
	int subtest_cnt;
};

struct test_filter_set {
	struct test_filter *tests;
	int cnt;
};

struct test_selector {
	struct test_filter_set whitelist;
	struct test_filter_set blacklist;
	bool *num_set;
	int num_set_len;
};

struct subtest_state {
	char *name;
	size_t log_cnt;
	char *log_buf;
	int error_cnt;
	bool skipped;
	bool filtered;
	bool should_tmon;

	FILE *stdout_saved;
};

struct test_state {
	bool tested;
	bool force_log;

	int error_cnt;
	int skip_cnt;
	int sub_succ_cnt;

	struct subtest_state *subtest_states;
	int subtest_num;

	size_t log_cnt;
	char *log_buf;

	FILE *stdout_saved;
};

extern int env_verbosity;

struct test_env {
	struct test_selector test_selector;
	struct test_selector subtest_selector;
	struct test_selector tmon_selector;
	bool verifier_stats;
	bool debug;
	enum verbosity verbosity;

	bool jit_enabled;
	bool has_testmod;
	bool get_test_cnt;
	bool list_test_names;

	struct prog_test_def *test; /* current running test */
	struct test_state *test_state; /* current running test state */
	struct subtest_state *subtest_state; /* current running subtest state */

	FILE *stdout_saved;
	FILE *stderr_saved;
	int nr_cpus;
	FILE *json;

	int succ_cnt; /* successful tests */
	int sub_succ_cnt; /* successful sub-tests */
	int fail_cnt; /* total failed tests + sub-tests */
	int skip_cnt; /* skipped tests */
	int not_built_cnt; /* tests not built */

	int saved_netns_fd;
	int workers; /* number of worker process */
	int worker_id; /* id number of current worker, main process is -1 */
	pid_t *worker_pids; /* array of worker pids */
	int *worker_socks; /* array of worker socks */
	int *worker_current_test; /* array of current running test for each worker */

	pthread_t main_thread;
	int secs_till_notify;
	int secs_till_kill;
	timer_t watchdog; /* watch for stalled tests/subtests */
	enum { WD_NOTIFY, WD_KILL } watchdog_state;
};

Annotation

Implementation Notes