From 5b7b4ce1d1163beb41b7c76db428c285d6989a62 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 7 Apr 2021 19:13:41 +0100 Subject: staging: comedi: tests: example_test: Rename to 'comedi_example_test' Rename the "example_test" module to "comedi_example_test" to make the name more relevant to Comedi. Cc: Spencer E. Olson Signed-off-by: Ian Abbott Link: https://lore.kernel.org/r/20210407181342.1117754-6-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/tests/Makefile | 3 +- .../comedi/drivers/tests/comedi_example_test.c | 72 ++++++++++++++++++++++ .../staging/comedi/drivers/tests/example_test.c | 72 ---------------------- 3 files changed, 74 insertions(+), 73 deletions(-) create mode 100644 drivers/staging/comedi/drivers/tests/comedi_example_test.c delete mode 100644 drivers/staging/comedi/drivers/tests/example_test.c (limited to 'drivers') diff --git a/drivers/staging/comedi/drivers/tests/Makefile b/drivers/staging/comedi/drivers/tests/Makefile index b5d8e13d4162..a7883e406c43 100644 --- a/drivers/staging/comedi/drivers/tests/Makefile +++ b/drivers/staging/comedi/drivers/tests/Makefile @@ -3,5 +3,6 @@ # ccflags-$(CONFIG_COMEDI_DEBUG) := -DDEBUG -obj-$(CONFIG_COMEDI_TESTS) += example_test.o ni_routes_test.o +obj-$(CONFIG_COMEDI_TESTS) += comedi_example_test.o +obj-$(CONFIG_COMEDI_TESTS) += ni_routes_test.o CFLAGS_ni_routes_test.o := -DDEBUG diff --git a/drivers/staging/comedi/drivers/tests/comedi_example_test.c b/drivers/staging/comedi/drivers/tests/comedi_example_test.c new file mode 100644 index 000000000000..e5aaaeab7bdd --- /dev/null +++ b/drivers/staging/comedi/drivers/tests/comedi_example_test.c @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* vim: set ts=8 sw=8 noet tw=80 nowrap: */ +/* + * comedi/drivers/tests/comedi_example_test.c + * Example set of unit tests. + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2016 Spencer E. Olson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include + +#include "unittest.h" + +/* *** BEGIN fake board data *** */ +struct comedi_device { + const char *board_name; + int item; +}; + +static struct comedi_device dev = { + .board_name = "fake_device", +}; + +/* *** END fake board data *** */ + +/* *** BEGIN fake data init *** */ +static void init_fake(void) +{ + dev.item = 10; +} + +/* *** END fake data init *** */ + +static void test0(void) +{ + init_fake(); + unittest(dev.item != 11, "negative result\n"); + unittest(dev.item == 10, "positive result\n"); +} + +/* **** BEGIN simple module entry/exit functions **** */ +static int __init unittest_enter(void) +{ + static const unittest_fptr unit_tests[] = { + test0, + NULL, + }; + + exec_unittests("example", unit_tests); + return 0; +} + +static void __exit unittest_exit(void) { } + +module_init(unittest_enter); +module_exit(unittest_exit); + +MODULE_AUTHOR("Spencer Olson "); +MODULE_DESCRIPTION("Comedi unit-tests example"); +MODULE_LICENSE("GPL"); +/* **** END simple module entry/exit functions **** */ diff --git a/drivers/staging/comedi/drivers/tests/example_test.c b/drivers/staging/comedi/drivers/tests/example_test.c deleted file mode 100644 index 7010f6ef322d..000000000000 --- a/drivers/staging/comedi/drivers/tests/example_test.c +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* vim: set ts=8 sw=8 noet tw=80 nowrap: */ -/* - * comedi/drivers/tests/example_test.c - * Example set of unit tests. - * - * COMEDI - Linux Control and Measurement Device Interface - * Copyright (C) 2016 Spencer E. Olson - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include - -#include "unittest.h" - -/* *** BEGIN fake board data *** */ -struct comedi_device { - const char *board_name; - int item; -}; - -static struct comedi_device dev = { - .board_name = "fake_device", -}; - -/* *** END fake board data *** */ - -/* *** BEGIN fake data init *** */ -static void init_fake(void) -{ - dev.item = 10; -} - -/* *** END fake data init *** */ - -static void test0(void) -{ - init_fake(); - unittest(dev.item != 11, "negative result\n"); - unittest(dev.item == 10, "positive result\n"); -} - -/* **** BEGIN simple module entry/exit functions **** */ -static int __init unittest_enter(void) -{ - static const unittest_fptr unit_tests[] = { - test0, - NULL, - }; - - exec_unittests("example", unit_tests); - return 0; -} - -static void __exit unittest_exit(void) { } - -module_init(unittest_enter); -module_exit(unittest_exit); - -MODULE_AUTHOR("Spencer Olson "); -MODULE_DESCRIPTION("Comedi unit-tests example"); -MODULE_LICENSE("GPL"); -/* **** END simple module entry/exit functions **** */ -- cgit v1.2.3