tests/drivers/pci_enum: move to ztest and run in HW when possible

This test case just exercises the PCI enumeration and there is no real
way to test success/failure other than running it and the kernel not
crashing.

Moved to ztest.

Retag so it is actually ran on QEMU/x86 and galileo once we deploy in
the HW pool. Note this means that we need to force CONFIG_PCI on
Qemu/x86, which can run this testcase.

Change-Id: I85b64800f7d989357927b4a25777041047293b34
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
This commit is contained in:
Inaky Perez-Gonzalez 2016-11-02 09:16:11 -07:00 committed by Anas Nashif
commit bcb6ed95e7
8 changed files with 18 additions and 40 deletions

View file

@ -1,5 +1,9 @@
BOARD ?= qemu_x86
MDEF_FILE = prj.mdef
# In QEMU x86, we have to force CONFIG_PCI being defined, as the defconfig does not have it.
ifeq ($(BOARD), qemu_x86)
CONF_FILE = prj_$(BOARD).conf
else
CONF_FILE = prj.conf
endif
include ${ZEPHYR_BASE}/Makefile.inc

View file

@ -1,3 +1,4 @@
CONFIG_STDOUT_CONSOLE=y
CONFIG_PCI_ENUMERATION=y
CONFIG_PCI_DEBUG=y
CONFIG_ZTEST=y

View file

@ -1,5 +0,0 @@
% Application : PCI enumeration application
% TASK NAME PRIO ENTRY STACK GROUPS
% ===========================================
TASK TASKA 7 task_enum_pci 1024 [EXE]

View file

@ -0,0 +1,5 @@
CONFIG_PCI=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_PCI_ENUMERATION=y
CONFIG_PCI_DEBUG=y
CONFIG_ZTEST=y

View file

@ -1,5 +0,0 @@
# @testcase dynamic
# @targets \
# board:(galileo|qemu_x86|qemu_cortex_m3)
#
# @eval console-rx %(console)s:20 Enumeration complete on %(bsp)s

View file

@ -1,3 +1,3 @@
include $(ZEPHYR_BASE)/tests/Makefile.test
ccflags-y += -I${ZEPHYR_BASE}/include/drivers
obj-y = pci_enum.o

View file

@ -15,12 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <zephyr.h>
#include <stdint.h>
#include <misc/printk.h>
#include <ztest.h>
#include <pci/pci.h>
void pci_enumerate(void)
static void pci_enumerate(void)
{
struct pci_dev_info info = {
.function = PCI_FUNCTION_ANY,
@ -39,28 +37,8 @@ void pci_enumerate(void)
}
}
#ifdef CONFIG_MICROKERNEL
static int done;
void task_enum_pci(void)
void test_main(void)
{
if (done) {
task_yield();
}
pci_enumerate();
printk("Enumeration complete on %s", CONFIG_ARCH);
done = 1;
ztest_test_suite(pci_test, ztest_unit_test(pci_enumerate));
ztest_run_test_suite(pci_test);
}
#else /* CONFIG_NANOKERNEL */
void main(void)
{
pci_enumerate();
printk("Enumeration complete on %s", CONFIG_ARCH);
}
#endif /* CONFIG_MICROKERNEL */

View file

@ -1,4 +1,4 @@
[test]
build_only = true
tags = samples
filter = CONFIG_PCI
platform_whitelist = qemu_x86 galileo