ret = t->callback();
}
- if (!strcmp(res->autotest, "version_autotest"))
- ret = test_version();
- if (!strcmp(res->autotest, "eal_fs_autotest"))
- ret = test_eal_fs();
- if (!strcmp(res->autotest, "debug_autotest"))
- ret = test_debug();
- if (!strcmp(res->autotest, "pci_autotest"))
- ret = test_pci();
- if (!strcmp(res->autotest, "prefetch_autotest"))
- ret = test_prefetch();
- if (!strcmp(res->autotest, "byteorder_autotest"))
- ret = test_byteorder();
- if (!strcmp(res->autotest, "per_lcore_autotest"))
- ret = test_per_lcore();
- if (!strcmp(res->autotest, "atomic_autotest"))
- ret = test_atomic();
- if (!strcmp(res->autotest, "malloc_autotest"))
- ret = test_malloc();
- if (!strcmp(res->autotest, "spinlock_autotest"))
- ret = test_spinlock();
- if (!strcmp(res->autotest, "memory_autotest"))
- ret = test_memory();
- if (!strcmp(res->autotest, "memzone_autotest"))
- ret = test_memzone();
- if (!strcmp(res->autotest, "rwlock_autotest"))
- ret = test_rwlock();
- if (!strcmp(res->autotest, "mbuf_autotest"))
- ret = test_mbuf();
- if (!strcmp(res->autotest, "logs_autotest"))
- ret = test_logs();
- if (!strcmp(res->autotest, "errno_autotest"))
- ret = test_errno();
- if (!strcmp(res->autotest, "hash_autotest"))
- ret = test_hash();
- if (!strcmp(res->autotest, "hash_perf_autotest"))
- ret = test_hash_perf();
- if (!strcmp(res->autotest, "lpm_autotest"))
- ret = test_lpm();
- if (!strcmp(res->autotest, "lpm6_autotest"))
- ret = test_lpm6();
- if (!strcmp(res->autotest, "cpuflags_autotest"))
- ret = test_cpuflags();
- if (!strcmp(res->autotest, "cmdline_autotest"))
- ret = test_cmdline();
- if (!strcmp(res->autotest, "tailq_autotest"))
- ret = test_tailq();
- if (!strcmp(res->autotest, "multiprocess_autotest"))
- ret = test_mp_secondary();
- if (!strcmp(res->autotest, "memcpy_autotest"))
- ret = test_memcpy();
- if (!strcmp(res->autotest, "string_autotest"))
- ret = test_string_fns();
- if (!strcmp(res->autotest, "eal_flags_autotest"))
- ret = test_eal_flags();
- if (!strcmp(res->autotest, "alarm_autotest"))
- ret = test_alarm();
- if (!strcmp(res->autotest, "interrupt_autotest"))
- ret = test_interrupt();
- if (!strcmp(res->autotest, "cycles_autotest"))
- ret = test_cycles();
- if (!strcmp(res->autotest, "ring_autotest"))
- ret = test_ring();
- if (!strcmp(res->autotest, "table_autotest"))
- ret = test_table();
- if (!strcmp(res->autotest, "ring_perf_autotest"))
- ret = test_ring_perf();
- if (!strcmp(res->autotest, "timer_autotest"))
- ret = test_timer();
- if (!strcmp(res->autotest, "timer_perf_autotest"))
- ret = test_timer_perf();
-#ifdef RTE_LIBRTE_PMD_BOND
- if (!strcmp(res->autotest, "link_bonding_autotest"))
- ret = test_link_bonding();
-#endif
- if (!strcmp(res->autotest, "mempool_autotest"))
- ret = test_mempool();
- if (!strcmp(res->autotest, "mempool_perf_autotest"))
- ret = test_mempool_perf();
- if (!strcmp(res->autotest, "memcpy_perf_autotest"))
- ret = test_memcpy_perf();
- if (!strcmp(res->autotest, "func_reentrancy_autotest"))
- ret = test_func_reentrancy();
- if (!strcmp(res->autotest, "red_autotest"))
- ret = test_red();
- if (!strcmp(res->autotest, "sched_autotest"))
- ret = test_sched();
- if (!strcmp(res->autotest, "meter_autotest"))
- ret = test_meter();
- if (!strcmp(res->autotest, "kni_autotest"))
- ret = test_kni();
- if (!strcmp(res->autotest, "power_autotest"))
- ret = test_power();
- if (!strcmp(res->autotest, "common_autotest"))
- ret = test_common();
- if (!strcmp(res->autotest, "ivshmem_autotest"))
- ret = test_ivshmem();
- if (!strcmp(res->autotest, "distributor_autotest"))
- ret = test_distributor();
- if (!strcmp(res->autotest, "distributor_perf_autotest"))
- ret = test_distributor_perf();
- if (!strcmp(res->autotest, "devargs_autotest"))
- ret = test_devargs();
-#ifdef RTE_LIBRTE_PMD_RING
- if (!strcmp(res->autotest, "ring_pmd_autotest"))
- ret = test_pmd_ring();
-#endif /* RTE_LIBRTE_PMD_RING */
-
-#ifdef RTE_LIBRTE_ACL
- if (!strcmp(res->autotest, "acl_autotest"))
- ret = test_acl();
-#endif /* RTE_LIBRTE_ACL */
-#ifdef RTE_LIBRTE_KVARGS
- if (!strcmp(res->autotest, "kvargs_autotest"))
- ret |= test_kvargs();
-#endif /* RTE_LIBRTE_KVARGS */
-
if (ret == 0)
printf("Test OK\n");
else
int commands_init(void)
{
struct test_command *t;
- char builtin_commands[] =
- "pci_autotest#memory_autotest#"
- "per_lcore_autotest#spinlock_autotest#"
- "rwlock_autotest#atomic_autotest#"
- "byteorder_autotest#prefetch_autotest#"
- "cycles_autotest#logs_autotest#"
- "memzone_autotest#ring_autotest#"
- "mempool_autotest#mbuf_autotest#"
- "timer_autotest#malloc_autotest#"
- "memcpy_autotest#hash_autotest#"
- "lpm_autotest#debug_autotest#"
- "lpm6_autotest#"
- "errno_autotest#tailq_autotest#"
- "string_autotest#multiprocess_autotest#"
- "cpuflags_autotest#eal_flags_autotest#"
- "alarm_autotest#interrupt_autotest#"
- "version_autotest#eal_fs_autotest#"
- "cmdline_autotest#func_reentrancy_autotest#"
-#ifdef RTE_LIBRTE_PMD_BOND
- "link_bonding_autotest#"
-#endif
- "mempool_perf_autotest#hash_perf_autotest#"
- "memcpy_perf_autotest#ring_perf_autotest#"
- "red_autotest#meter_autotest#sched_autotest#"
- "memcpy_perf_autotest#kni_autotest#"
- "ivshmem_autotest#"
- "devargs_autotest#table_autotest#"
-#ifdef RTE_LIBRTE_ACL
- "acl_autotest#"
-#endif
- "power_autotest#"
- "timer_perf_autotest#"
-#ifdef RTE_LIBRTE_PMD_RING
- "ring_pmd_autotest#"
-#endif
-#ifdef RTE_LIBRTE_KVARGS
- "kvargs_autotest#"
-#endif
- "common_autotest#"
- "distributor_autotest#distributor_perf_autotest";
+ char builtin_commands[] = "";
char *commands, *ptr;
int commands_len = strlen(builtin_commands) + 1;
{ "test_memory_flags", no_action },
{ "test_file_prefix", no_action },
{ "test_no_huge_flag", no_action },
+#ifdef RTE_LIBRTE_IVSHMEM
{ "test_ivshmem", test_ivshmem },
+#endif
};
if (recursive_call == NULL)
int main(int argc, char **argv);
int test_pci(void);
-int test_memory(void);
-int test_per_lcore(void);
-int test_spinlock(void);
-int test_rwlock(void);
-int test_atomic(void);
-int test_byteorder(void);
-int test_prefetch(void);
-int test_cycles(void);
-int test_logs(void);
-int test_memzone(void);
-int test_ring(void);
-int test_table(void);
-int test_ring_perf(void);
-int test_mempool(void);
-int test_mempool_perf(void);
-int test_mbuf(void);
-int test_timer(void);
-int test_timer_perf(void);
-int test_malloc(void);
-int test_memcpy(void);
-int test_memcpy_perf(void);
-int test_hash(void);
-int test_hash_perf(void);
-int test_lpm(void);
-int test_lpm6(void);
-int test_debug(void);
-int test_errno(void);
-int test_tailq(void);
-int test_string_fns(void);
+int test_pci_run;
+
int test_mp_secondary(void);
-int test_cpuflags(void);
-int test_eal_flags(void);
-int test_alarm(void);
-int test_interrupt(void);
-int test_version(void);
-int test_eal_fs(void);
-int test_cmdline(void);
-int test_func_reentrancy(void);
-int test_red(void);
-int test_sched(void);
-int test_meter(void);
-int test_acl(void);
-int test_kni(void);
-int test_power(void);
-int test_common(void);
-int test_pmd_ring(void);
-int test_ivshmem(void);
-int test_distributor(void);
-int test_distributor_perf(void);
-int test_kvargs(void);
-int test_devargs(void);
-int test_link_bonding(void);
-int test_pci_run;
+int test_ivshmem(void);
typedef int (test_callback)(void);
TAILQ_HEAD(test_commands_list, test_command);
return 0;
}
-int
+static int
test_acl(void)
{
if (test_invalid_parameters() < 0)
return 0;
}
-#else
-
-int
-test_acl(void)
-{
- printf("This binary was not compiled with ACL support!\n");
- return 0;
-}
+static struct test_command acl_cmd = {
+ .command = "acl_autotest",
+ .callback = test_acl,
+};
+REGISTER_TEST_COMMAND(acl_cmd);
#endif /* RTE_LIBRTE_ACL */
return 0;
}
-int
+static int
test_alarm(void)
{
int count = 0;
return 0;
}
+static struct test_command alarm_cmd = {
+ .command = "alarm_autotest",
+ .callback = test_alarm,
+};
+REGISTER_TEST_COMMAND(alarm_cmd);
return 0;
}
-int
+static int
test_atomic(void)
{
rte_atomic16_init(&a16);
return 0;
}
+static struct test_command atomic_cmd = {
+ .command = "atomic_autotest",
+ .callback = test_atomic,
+};
+REGISTER_TEST_COMMAND(atomic_cmd);
* size (16, 32, 64 bits)
*/
-int
+static int
test_byteorder(void)
{
uint16_t res_u16;
return 0;
}
+
+static struct test_command byteorder_cmd = {
+ .command = "byteorder_autotest",
+ .callback = test_byteorder,
+};
+REGISTER_TEST_COMMAND(byteorder_cmd);
#include "test.h"
#include "test_cmdline.h"
-int
+#ifdef RTE_LIBRTE_CMDLINE
+static int
test_cmdline(void)
{
-#ifdef RTE_LIBRTE_CMDLINE
printf("Testind parsing ethernet addresses...\n");
if (test_parse_etheraddr_valid() < 0)
return -1;
printf("Testing library functions...\n");
if (test_cmdline_lib() < 0)
return -1;
-#else
- printf("The cmdline library is not included in this build\n");
-#endif
return 0;
}
+static struct test_command cmdline_cmd = {
+ .command = "cmdline_autotest",
+ .callback = test_cmdline,
+};
+REGISTER_TEST_COMMAND(cmdline_cmd);
+#endif
return 0;
}
-int
+static int
test_common(void)
{
int ret = 0;
return ret;
}
+
+static struct test_command common_cmd = {
+ .command = "common_autotest",
+ .callback = test_common,
+};
+REGISTER_TEST_COMMAND(common_cmd);
* - Check if register and CPUID functions fail properly
*/
-int
+static int
test_cpuflags(void)
{
int result;
return 0;
}
+
+static struct test_command cpuflags_cmd = {
+ .command = "cpuflags_autotest",
+ .callback = test_cpuflags,
+};
+REGISTER_TEST_COMMAND(cpuflags_cmd);
* of cycles is correct with regard to the frequency of the timer.
*/
-int
+static int
test_cycles(void)
{
unsigned i;
return 0;
}
+
+static struct test_command cycles_cmd = {
+ .command = "cycles_autotest",
+ .callback = test_cycles,
+};
+REGISTER_TEST_COMMAND(cycles_cmd);
return 0;
}
-int
+static int
test_debug(void)
{
rte_dump_stack();
return -1;
return 0;
}
+
+static struct test_command debug_cmd = {
+ .command = "debug_autotest",
+ .callback = test_debug,
+};
+REGISTER_TEST_COMMAND(debug_cmd);
}
}
-int
+static int
test_devargs(void)
{
struct rte_devargs_list save_devargs_list;
devargs_list = save_devargs_list;
return -1;
}
+
+static struct test_command devargs_cmd = {
+ .command = "devargs_autotest",
+ .callback = test_devargs,
+};
+REGISTER_TEST_COMMAND(devargs_cmd);
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
-int
+static int
test_distributor(void)
{
static struct rte_distributor *d;
return -1;
}
-#else
-
-#include <stdio.h>
-
-int
-test_distributor(void)
-{
- printf("Distributor is not enabled in configuration\n");
- return 0;
-}
-
+static struct test_command distributor_cmd = {
+ .command = "distributor_autotest",
+ .callback = test_distributor,
+};
+REGISTER_TEST_COMMAND(distributor_cmd);
#endif
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
-int
+static int
test_distributor_perf(void)
{
static struct rte_distributor *d;
return 0;
}
-#else
-
-#include <stdio.h>
-
-int
-test_distributor_perf(void)
-{
- printf("Distributor is not enabled in configuration\n");
- return 0;
-}
-
+static struct test_command distributor_perf_cmd = {
+ .command = "distributor_perf_autotest",
+ .callback = test_distributor_perf,
+};
+REGISTER_TEST_COMMAND(distributor_perf_cmd);
#endif
return 0;
}
-int
+static int
test_eal_flags(void)
{
int ret = 0;
return ret;
}
-#else
-/* Baremetal version
- * Multiprocess not applicable, so just return 0 always
- */
-int
-test_eal_flags(void)
-{
- printf("Multi-process not possible for baremetal, cannot test EAL flags\n");
- return 0;
-}
-
+static struct test_command eal_flags_cmd = {
+ .command = "eal_flags_autotest",
+ .callback = test_eal_flags,
+};
+REGISTER_TEST_COMMAND(eal_flags_cmd);
#endif
return -1;
}
-int
+static int
test_eal_fs(void)
{
if (test_parse_sysfs_value() < 0)
return -1;
return 0;
}
-#else
-/* baremetal does not have a filesystem */
-int
-test_eal_fs(void)
-{
- return 0;
-}
+
+static struct test_command eal_fs_cmd = {
+ .command = "eal_fs_autotest",
+ .callback = test_eal_fs,
+};
+REGISTER_TEST_COMMAND(eal_fs_cmd);
#endif
#include "test.h"
-int
+static int
test_errno(void)
{
const char *rte_retval;
return 0;
}
+
+static struct test_command errno_cmd = {
+ .command = "errno_autotest",
+ .callback = test_errno,
+};
+REGISTER_TEST_COMMAND(errno_cmd);
/**
* Main entry of func_reentrancy test
*/
-int
+static int
test_func_reentrancy(void)
{
uint32_t case_id;
return 0;
}
+
+static struct test_command func_reentrancy_cmd = {
+ .command = "func_reentrancy_autotest",
+ .callback = test_func_reentrancy,
+};
+REGISTER_TEST_COMMAND(func_reentrancy_cmd);
/*
* Do all unit and performance tests.
*/
-int test_hash(void)
+static int
+test_hash(void)
{
if (test_add_delete() < 0)
return -1;
return 0;
}
-#else /* RTE_LIBRTE_HASH */
-
-int
-test_hash(void)
-{
- printf("The Hash library is not included in this build\n");
- return 0;
-}
+static struct test_command hash_cmd = {
+ .command = "hash_autotest",
+ .callback = test_hash,
+};
+REGISTER_TEST_COMMAND(hash_cmd);
#endif /* RTE_LIBRTE_HASH */
/*
* Do all unit and performance tests.
*/
-int test_hash_perf(void)
+static int
+test_hash_perf(void)
{
if (run_all_tbl_perf_tests() < 0)
return -1;
return -1;
return 0;
}
-#else /* RTE_LIBRTE_HASH */
-
-int
-test_hash_perf(void)
-{
- printf("The Hash library is not included in this build\n");
- return 0;
-}
+static struct test_command hash_perf_cmd = {
+ .command = "hash_perf_autotest",
+ .callback = test_hash_perf,
+};
+REGISTER_TEST_COMMAND(hash_perf_cmd);
#endif /* RTE_LIBRTE_HASH */
/**
* Main function of testing interrupt.
*/
-int
+static int
test_interrupt(void)
{
int ret = -1;
return ret;
}
+static struct test_command interrupt_cmd = {
+ .command = "interrupt_autotest",
+ .callback = test_interrupt,
+};
+REGISTER_TEST_COMMAND(interrupt_cmd);
return -1;
}
-#else /* RTE_LIBRTE_IVSHMEM */
-int
-test_ivshmem(void)
-{
- printf("This binary was not compiled with IVSHMEM support!\n");
- return 0;
-}
+static struct test_command ivshmem_cmd = {
+ .command = "ivshmem_autotest",
+ .callback = test_ivshmem,
+};
+REGISTER_TEST_COMMAND(ivshmem_cmd);
#endif /* RTE_LIBRTE_IVSHMEM */
return ret;
}
-int
+static int
test_kni(void)
{
int ret = -1;
return ret;
}
-#else /* RTE_LIBRTE_KNI */
-
-int
-test_kni(void)
-{
- printf("The KNI library is not included in this build\n");
- return 0;
-}
-
+static struct test_command kni_cmd = {
+ .command = "kni_autotest",
+ .callback = test_kni,
+};
+REGISTER_TEST_COMMAND(kni_cmd);
#endif /* RTE_LIBRTE_KNI */
return -1;
}
-int test_kvargs(void)
+static int
+test_kvargs(void)
{
printf("== test valid case ==\n");
if (test_valid_kvargs() < 0)
return -1;
return 0;
}
+
+static struct test_command kvargs_cmd = {
+ .command = "kvargs_autotest",
+ .callback = test_kvargs,
+};
+REGISTER_TEST_COMMAND(kvargs_cmd);
};
-int
+static int
test_link_bonding(void)
{
return unit_test_suite_runner(&link_bonding_test_suite);
}
+
+static struct test_command link_bonding_cmd = {
+ .command = "link_bonding_autotest",
+ .callback = test_link_bonding,
+};
+REGISTER_TEST_COMMAND(link_bonding_cmd);
* - Send logs with different types and levels, some should not be displayed.
*/
-int
+static int
test_logs(void)
{
/* enable these logs type */
return 0;
}
+
+static struct test_command logs_cmd = {
+ .command = "logs_autotest",
+ .callback = test_logs,
+};
+REGISTER_TEST_COMMAND(logs_cmd);
* Do all unit and performance tests.
*/
-int
+static int
test_lpm(void)
{
unsigned i;
return global_status;
}
-#else /* RTE_LIBRTE_LPM */
-
-int
-test_lpm(void)
-{
- printf("The LPM library is not included in this build\n");
- return 0;
-}
-
+static struct test_command lpm_cmd = {
+ .command = "lpm_autotest",
+ .callback = test_lpm,
+};
+REGISTER_TEST_COMMAND(lpm_cmd);
#endif /* RTE_LIBRTE_LPM */
/*
* Do all unit and performance tests.
*/
-int
+static int
test_lpm6(void)
{
unsigned i;
return global_status;
}
-#else /* RTE_LIBRTE_LPM */
-
-int
-test_lpm6(void)
-{
- printf("The LPM library is not included in this build\n");
- return 0;
-}
-
+static struct test_command lpm6_cmd = {
+ .command = "lpm6_autotest",
+ .callback = test_lpm6,
+};
+REGISTER_TEST_COMMAND(lpm6_cmd);
#endif /* RTE_LIBRTE_LPM */
return 0;
}
-int
+static int
test_malloc(void)
{
unsigned lcore_id;
return 0;
}
+
+static struct test_command malloc_cmd = {
+ .command = "malloc_autotest",
+ .callback = test_malloc,
+};
+REGISTER_TEST_COMMAND(malloc_cmd);
#endif
-int
+static int
test_mbuf(void)
{
RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != 64);
}
return 0;
}
+
+static struct test_command mbuf_cmd = {
+ .command = "mbuf_autotest",
+ .callback = test_mbuf,
+};
+REGISTER_TEST_COMMAND(mbuf_cmd);
return 0;
}
-int
+static int
test_memcpy(void)
{
int ret;
return -1;
return 0;
}
+
+static struct test_command memcpy_cmd = {
+ .command = "memcpy_autotest",
+ .callback = test_memcpy,
+};
+REGISTER_TEST_COMMAND(memcpy_cmd);
}
-int
+static int
test_memcpy_perf(void)
{
int ret;
return -1;
return 0;
}
+
+static struct test_command memcpy_perf_cmd = {
+ .command = "memcpy_perf_autotest",
+ .callback = test_memcpy_perf,
+};
+REGISTER_TEST_COMMAND(memcpy_perf_cmd);
* - Try to read all memory; it should not segfault.
*/
-int
+static int
test_memory(void)
{
uint64_t s;
return 0;
}
+
+static struct test_command memory_cmd = {
+ .command = "memory_autotest",
+ .callback = test_memory,
+};
+REGISTER_TEST_COMMAND(memory_cmd);
return (0);
}
-int
+static int
test_mempool(void)
{
rte_atomic32_init(&synchro);
return 0;
}
+
+static struct test_command mempool_cmd = {
+ .command = "mempool_autotest",
+ .callback = test_mempool,
+};
+REGISTER_TEST_COMMAND(mempool_cmd);
return 0;
}
-int
+static int
test_mempool_perf(void)
{
rte_atomic32_init(&synchro);
return 0;
}
+
+static struct test_command mempool_perf_cmd = {
+ .command = "mempool_perf_autotest",
+ .callback = test_mempool_perf,
+};
+REGISTER_TEST_COMMAND(mempool_perf_cmd);
return 0;
}
-int
+static int
test_memzone(void)
{
const struct rte_memzone *memzone1;
return 0;
}
+
+static struct test_command memzone_cmd = {
+ .command = "memzone_autotest",
+ .callback = test_memzone,
+};
+REGISTER_TEST_COMMAND(memzone_cmd);
/**
* test main entrance for library meter
*/
-int
+static int
test_meter(void)
{
if(tm_test_srtcm_config() != 0 )
}
-#else /* RTE_LIBRTE_METER */
-
-int
-test_meter(void)
-{
- printf("The meter library is not included in this build\n");
- return 0;
-}
+static struct test_command meter_cmd = {
+ .command = "meter_autotest",
+ .callback = test_meter,
+};
+REGISTER_TEST_COMMAND(meter_cmd);
#endif /* RTE_LIBRTE_METER */
return run_object_creation_tests();
}
-#else
-
-/* Baremetal version
- * Multiprocess not applicable, so just return 0 always
- */
-int
-test_mp_secondary(void)
-{
- printf("Multi-process not applicable for baremetal\n");
- return 0;
-}
-
+static struct test_command multiprocess_cmd = {
+ .command = "multiprocess_autotest",
+ .callback = test_mp_secondary,
+};
+REGISTER_TEST_COMMAND(multiprocess_cmd);
#endif
return 0;
}
+
+static struct test_command pci_cmd = {
+ .command = "pci_autotest",
+ .callback = test_pci,
+};
+REGISTER_TEST_COMMAND(pci_cmd);
return 0;
}
-int
+static int
test_per_lcore(void)
{
unsigned lcore_id;
return 0;
}
+
+static struct test_command per_lcore_cmd = {
+ .command = "per_lcore_autotest",
+ .callback = test_per_lcore,
+};
+REGISTER_TEST_COMMAND(per_lcore_cmd);
return 0;
}
-int
+static int
test_pmd_ring(void)
{
mp = rte_mempool_create("mbuf_pool", NB_MBUF,
return 0;
}
-#else
-
-int
-test_pmd_ring(void)
-{
- return 0;
-}
-
+static struct test_command ring_pmd_cmd = {
+ .command = "ring_pmd_autotest",
+ .callback = test_pmd_ring,
+};
+REGISTER_TEST_COMMAND(ring_pmd_cmd);
#endif
return 0;
}
-int
+static int
test_power(void)
{
int ret = -1;
return -1;
}
-#else /* RTE_LIBRTE_POWER */
-
-int
-test_power(void)
-{
- printf("The power library is not included in this build\n");
- return 0;
-}
-
+static struct test_command power_cmd = {
+ .command = "power_autotest",
+ .callback = test_power,
+};
+REGISTER_TEST_COMMAND(power_cmd);
#endif /* RTE_LIBRTE_POWER */
* The test always return success.
*/
-int
+static int
test_prefetch(void)
{
int a;
return 0;
}
+
+static struct test_command prefetch_cmd = {
+ .command = "prefetch_autotest",
+ .callback = test_prefetch,
+};
+REGISTER_TEST_COMMAND(prefetch_cmd);
return 0;
}
-int test_red(void)
+static int
+test_red(void)
{
uint32_t num_tests = 0;
uint32_t num_pass = 0;
return (ret);
}
-#else
-
-int
-test_red(void)
-{
- printf("The SCHED library is not included in this build\n");
- return 0;
-}
-
+static struct test_command red_cmd = {
+ .command = "red_autotest",
+ .callback = test_red,
+};
+REGISTER_TEST_COMMAND(red_cmd);
#endif
return ret;
}
-int
+static int
test_ring(void)
{
/* some more basic operations */
return 0;
}
+
+static struct test_command ring_cmd = {
+ .command = "ring_autotest",
+ .callback = test_ring,
+};
+REGISTER_TEST_COMMAND(ring_cmd);
}
}
-int
+static int
test_ring_perf(void)
{
struct lcore_pair cores;
}
return 0;
}
+
+static struct test_command ring_perf_cmd = {
+ .command = "ring_perf_autotest",
+ .callback = test_ring_perf,
+};
+REGISTER_TEST_COMMAND(ring_perf_cmd);
return 0;
}
-int
+static int
test_rwlock(void)
{
int i;
return 0;
}
+
+static struct test_command rwlock_cmd = {
+ .command = "rwlock_autotest",
+ .callback = test_rwlock,
+};
+REGISTER_TEST_COMMAND(rwlock_cmd);
/**
* test main entrance for library sched
*/
-int
+static int
test_sched(void)
{
struct rte_mempool *mp = NULL;
return 0;
}
-#else /* RTE_LIBRTE_SCHED */
-
-int
-test_sched(void)
-{
- printf("The Scheduler library is not included in this build\n");
- return 0;
-}
+static struct test_command sched_cmd = {
+ .command = "sched_autotest",
+ .callback = test_sched,
+};
+REGISTER_TEST_COMMAND(sched_cmd);
#endif /* RTE_LIBRTE_SCHED */
* Test rte_eal_get_lcore_state() in addition to spinlocks
* as we have "waiting" then "running" lcores.
*/
-int
+static int
test_spinlock(void)
{
int ret = 0;
return ret;
}
+
+static struct test_command spinlock_cmd = {
+ .command = "spinlock_autotest",
+ .callback = test_spinlock,
+};
+REGISTER_TEST_COMMAND(spinlock_cmd);
return 0;
}
-int
+static int
test_string_fns(void)
{
if (test_rte_snprintf() < 0 ||
return -1;
return 0;
}
+
+static struct test_command string_cmd = {
+ .command = "string_autotest",
+ .callback = test_string_fns,
+};
+REGISTER_TEST_COMMAND(string_cmd);
*/
-#ifndef RTE_LIBRTE_TABLE
-
-#include "test.h"
-
-int
-test_table(void)
-{
- return 0;
-}
-
-#else
+#ifdef RTE_LIBRTE_TABLE
#include <rte_byteorder.h>
#include <rte_hexdump.h>
}
-int
+static int
test_table(void)
{
int status, failures;
return 0;
}
+static struct test_command table_cmd = {
+ .command = "table_autotest",
+ .callback = test_table,
+};
+REGISTER_TEST_COMMAND(table_cmd);
#endif
} while (0)
/* Function definitions */
-int test_table(void);
uint64_t pipeline_test_hash(
void *key,
__attribute__((unused)) uint32_t key_size,
return 0;
}
-int
+static int
test_tailq(void)
{
int ret = 0;
ret |= test_tailq_deprecated();
return ret;
}
+
+static struct test_command tailq_cmd = {
+ .command = "tailq_autotest",
+ .callback = test_tailq,
+};
+REGISTER_TEST_COMMAND(tailq_cmd);
return 0;
}
-int
+static int
test_timer(void)
{
unsigned i;
return 0;
}
-#else
-
-int
-test_timer(void)
-{
- return 0;
-}
-
+static struct test_command timer_cmd = {
+ .command = "timer_autotest",
+ .callback = test_timer,
+};
+REGISTER_TEST_COMMAND(timer_cmd);
#endif
#define do_delay() rte_pause()
#endif
-int
+static int
test_timer_perf(void)
{
unsigned iterations = 100;
return 0;
}
-#else
-
-int
-test_timer_perf(void)
-{
- return 0;
-}
-
+static struct test_command timer_perf_cmd = {
+ .command = "timer_perf_autotest",
+ .callback = test_timer_perf,
+};
+REGISTER_TEST_COMMAND(timer_perf_cmd);
#endif
#include "test.h"
-int
+static int
test_version(void)
{
const char *version = rte_version();
return -1;
return 0;
}
+
+static struct test_command version_cmd = {
+ .command = "version_autotest",
+ .callback = test_version,
+};
+REGISTER_TEST_COMMAND(version_cmd);