From 1d651cd2846f0f2271c3db71e73920f5fde9bd5e Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 16 Aug 2021 17:01:24 +0000 Subject: [PATCH] Adding in standard tier0 tests folder: - The tier0 functional test where failing to kick off. Adding in tests folder with ansible test. Resolves: rhbz#1975886 Signed-off-by: Chris White --- tests/README | 2 ++ tests/smoke/runtest.sh | 48 ++++++++++++++++++++++++++++++++++++++++++ tests/tests.yaml | 48 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 tests/README create mode 100644 tests/smoke/runtest.sh create mode 100644 tests/tests.yaml diff --git a/tests/README b/tests/README new file mode 100644 index 0000000..ac5c48c --- /dev/null +++ b/tests/README @@ -0,0 +1,2 @@ +initial tests: +build the pacakge and run the test suite on the SUT's sysfs directory diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh new file mode 100644 index 0000000..30d2214 --- /dev/null +++ b/tests/smoke/runtest.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Get to the test directory +cd ../source/ + +#build the source tree to get the tests +./configure +make + +#go to the test directory +cd test + +#run the get_module test on every loaded module, if any command exits non-zero, +#fail the test +for i in `awk '{print $1}' /proc/modules` +do + ./get_module $i + if [ $? -ne 0 ] + then + echo "GET MODULE FAILED ON $i" + exit 1 + fi +done + +#run the get_device test on pci and usb busses +for i in `ls /sys/bus/pci/devices` +do + ./get_device pci $i + if [ $? -ne 0 ] + then + echo "GET DEVICE FAILED ON PCI DEV $i" + exit 1 + fi +done + +for i in `ls /sys/bus/usb/devices` +do + ./get_device usb $i + if [ $? -ne 0 ] + then + echo "GET DEVICE FAILED ON USB DEV $i" + exit 1 + fi +done + +#If we get here all tests passed, exit 0 +exit 0 + diff --git a/tests/tests.yaml b/tests/tests.yaml new file mode 100644 index 0000000..ffe2d62 --- /dev/null +++ b/tests/tests.yaml @@ -0,0 +1,48 @@ +--- +- hosts: localhost + tags: + - classic + tasks: + - name: Add executor host + add_host: + name: executor + ansible_connection: local + ansible_host: 127.0.0.1 + ansible_ssh_connection: local + + - name: Install build requires + delegate_to: executor + shell: dnf -y install autoconf automake + +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-source + +- hosts: localhost + tags: + - classic + tasks: + - name: Copy spec file to remote machine + copy: + src: "{{ playbook_dir }}/../sysfsutils.spec" + dest: /tmp/sysfsutils.spec + + - name: Install build deps + shell: dnf -y build-dep /tmp/sysfsutils.spec + +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-basic + tests: + - smoke + required_packages: + - gcc + - sed + - make + - gawk + - autoconf + - m4