tools/tracing/rtla/tests/unit/osnoise_top_cli.c

Source file repositories/reference/linux-study-clean/tools/tracing/rtla/tests/unit/osnoise_top_cli.c

File Facts

System
Linux kernel
Corpus path
tools/tracing/rtla/tests/unit/osnoise_top_cli.c
Extension
.c
Size
10699 bytes
Lines
504
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

// SPDX-License-Identifier: GPL-2.0

#define _GNU_SOURCE
#include <check.h>
#include <stdio.h>
#include <stdlib.h>
#include <sched.h>
#include <limits.h>
#include <unistd.h>
#include <sys/sysinfo.h>

#include "cli_params_assert.h"
#include "../../src/cli.h"

#define PARSE_ARGS(...) char *argv[] = { __VA_ARGS__, NULL  };\
			int argc = sizeof(argv) / sizeof(char *) - 1;\
			struct common_params *params =\
				osnoise_top_parse_args(argc, argv);\
			struct osnoise_params *osn_params __maybe_unused =\
				to_osnoise_params(params)

/* Tracing Options */

START_TEST(test_period_short)
{
	PARSE_ARGS("osnoise", "top", "-p", "100000");

	ck_assert_int_eq(osn_params->period, 100000);
}
END_TEST

START_TEST(test_period_long)
{
	PARSE_ARGS("osnoise", "top", "--period", "100000");

	ck_assert_int_eq(osn_params->period, 100000);
}
END_TEST

START_TEST(test_runtime_short)
{
	PARSE_ARGS("osnoise", "top", "-r", "95000");

	ck_assert_int_eq(osn_params->runtime, 95000);
}
END_TEST

START_TEST(test_runtime_long)
{
	PARSE_ARGS("osnoise", "top", "--runtime", "95000");

	ck_assert_int_eq(osn_params->runtime, 95000);
}
END_TEST

START_TEST(test_stop_short)
{
	PARSE_ARGS("osnoise", "top", "-s", "20");

	ck_assert_int_eq(params->stop_us, 20);
}
END_TEST

START_TEST(test_stop_long)
{
	PARSE_ARGS("osnoise", "top", "--stop", "20");

	ck_assert_int_eq(params->stop_us, 20);
}
END_TEST

START_TEST(test_stop_total_short)
{
	PARSE_ARGS("osnoise", "top", "-S", "20");

	ck_assert_int_eq(params->stop_total_us, 20);
}
END_TEST

START_TEST(test_stop_total_long)
{
	PARSE_ARGS("osnoise", "top", "--stop-total", "20");

	ck_assert_int_eq(params->stop_total_us, 20);
}
END_TEST

START_TEST(test_threshold_short)
{
	PARSE_ARGS("osnoise", "top", "-T", "5");

Annotation

Implementation Notes