tools/tracing/rtla/tests/unit/actions.c
Source file repositories/reference/linux-study-clean/tools/tracing/rtla/tests/unit/actions.c
File Facts
- System
- Linux kernel
- Corpus path
tools/tracing/rtla/tests/unit/actions.c- Extension
.c- Size
- 11876 bytes
- Lines
- 394
- 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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
check.hsignal.h../../src/actions.h
Detected Declarations
function actions_fixture_setupfunction actions_fixture_teardownfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TESTfunction START_TEST
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#define _GNU_SOURCE
#include <check.h>
#include <signal.h>
#include "../../src/actions.h"
static struct actions actions_fixture;
static void actions_fixture_setup(void)
{
actions_init(&actions_fixture);
}
static void actions_fixture_teardown(void)
{
actions_destroy(&actions_fixture);
}
START_TEST(test_actions_init)
{
struct actions actions;
actions_init(&actions);
ck_assert_int_eq(actions.len, 0);
ck_assert_int_eq(actions.size, action_default_size);
ck_assert(!actions.continue_flag);
ck_assert_ptr_eq(actions.trace_output_inst, NULL);
}
END_TEST
START_TEST(test_actions_destroy)
{
struct actions actions;
actions_init(&actions);
actions_destroy(&actions);
}
END_TEST
START_TEST(test_actions_reallocate)
{
struct actions actions;
int i;
actions_init(&actions);
ck_assert_int_eq(actions.len, 0);
ck_assert_int_eq(actions.size, action_default_size);
/* Fill size of actions array */
for (i = 0; i < action_default_size; i++)
actions_add_continue(&actions);
ck_assert_int_eq(actions.len, action_default_size);
ck_assert_int_eq(actions.size, action_default_size);
/* Add one more action to trigger reallocation */
actions_add_continue(&actions);
ck_assert_int_eq(actions.len, action_default_size + 1);
ck_assert_int_eq(actions.size, action_default_size * 2);
actions_destroy(&actions);
}
END_TEST
START_TEST(test_actions_add_trace_output)
{
actions_add_trace_output(&actions_fixture, "trace_output.txt");
ck_assert_int_eq(actions_fixture.len, 1);
ck_assert_int_eq(actions_fixture.list[0].type, ACTION_TRACE_OUTPUT);
ck_assert_str_eq(actions_fixture.list[0].trace_output, "trace_output.txt");
ck_assert(actions_fixture.present[ACTION_TRACE_OUTPUT]);
}
END_TEST
START_TEST(test_actions_add_signal)
{
actions_add_signal(&actions_fixture, SIGINT, 1234);
ck_assert_int_eq(actions_fixture.len, 1);
ck_assert_int_eq(actions_fixture.list[0].type, ACTION_SIGNAL);
ck_assert_int_eq(actions_fixture.list[0].signal, SIGINT);
ck_assert_int_eq(actions_fixture.list[0].pid, 1234);
ck_assert(actions_fixture.present[ACTION_SIGNAL]);
}
Annotation
- Immediate include surface: `check.h`, `signal.h`, `../../src/actions.h`.
- Detected declarations: `function actions_fixture_setup`, `function actions_fixture_teardown`, `function START_TEST`, `function START_TEST`, `function START_TEST`, `function START_TEST`, `function START_TEST`, `function START_TEST`, `function START_TEST`, `function START_TEST`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.