blob: 774dd893378586ac6df33f20a58e50c398afb08d [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Joe Hershberger11dd7cc2015-05-20 14:27:28 -05002/*
3 * (C) Copyright 2015
4 * Joe Hershberger, National Instruments, joe.hershberger@ni.com
Joe Hershberger11dd7cc2015-05-20 14:27:28 -05005 */
6
7#ifndef __TEST_SUITES_H__
8#define __TEST_SUITES_H__
9
Simon Glassed38aef2020-05-10 11:40:03 -060010struct cmd_tbl;
Simon Glass81cbe1c2017-11-25 11:57:29 -070011struct unit_test;
Simon Glass6685ece2025-01-20 14:25:58 -070012struct unit_test_state;
Simon Glass81cbe1c2017-11-25 11:57:29 -070013
Simon Glass78fd76b2025-01-20 14:25:33 -070014/* 'command' functions normally called do_xxx where xxx is the command name */
Simon Glass6685ece2025-01-20 14:25:58 -070015typedef int (*ut_cmd_func)(struct unit_test_state *uts, struct cmd_tbl *cmd,
16 int flags, int argc, char *const argv[]);
Simon Glass78fd76b2025-01-20 14:25:33 -070017
Simon Glass81cbe1c2017-11-25 11:57:29 -070018/**
19 * cmd_ut_category() - Run a category of unit tests
20 *
Simon Glass6685ece2025-01-20 14:25:58 -070021 * @uts: Unit-test state, which must be ready for use, i.e. ut_init_state()
22 * has been called. The caller is responsible for calling
23 * ut_uninit_state() after this function returns
Simon Glass81cbe1c2017-11-25 11:57:29 -070024 * @name: Category name
Philippe Reynes1f99f842019-12-17 19:07:04 +010025 * @prefix: Prefix of test name
Simon Glass81cbe1c2017-11-25 11:57:29 -070026 * @tests: List of tests to run
27 * @n_ents: Number of tests in @tests
Heinrich Schuchardtd41a3822018-08-27 22:04:10 +020028 * @argc: Argument count provided. Must be >= 1. If this is 1 then all
Simon Glass81cbe1c2017-11-25 11:57:29 -070029 * tests are run, otherwise only the one named @argv[1] is run.
30 * @argv: Arguments: argv[1] is the test to run (if @argc >= 2)
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010031 * Return: 0 if OK, CMD_RET_FAILURE on failure
Simon Glass81cbe1c2017-11-25 11:57:29 -070032 */
Simon Glass6685ece2025-01-20 14:25:58 -070033int cmd_ut_category(struct unit_test_state *uts, const char *name,
34 const char *prefix, struct unit_test *tests, int n_ents,
Simon Glassed38aef2020-05-10 11:40:03 -060035 int argc, char *const argv[]);
Simon Glass81cbe1c2017-11-25 11:57:29 -070036
Simon Glass6685ece2025-01-20 14:25:58 -070037int do_ut_bootstd(struct unit_test_state *uts, struct cmd_tbl *cmdtp, int flag,
38 int argc, char *const argv[]);
Simon Glassed38aef2020-05-10 11:40:03 -060039int do_ut_optee(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
Simon Glass6685ece2025-01-20 14:25:58 -070040int do_ut_overlay(struct unit_test_state *uts, struct cmd_tbl *cmdtp, int flag,
41 int argc, char *const argv[]);
Joe Hershberger9dc1d712015-05-20 14:27:29 -050042
Joe Hershberger11dd7cc2015-05-20 14:27:28 -050043#endif /* __TEST_SUITES_H__ */