Add test from https://upstreamfirst.fedorainfracloud.org/trace-cmd
Signed-off-by: Zamir SUN <sztsian@gmail.com>
This commit is contained in:
parent
7bc04f19e2
commit
b42887569d
44
tests/README.md
Normal file
44
tests/README.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
About
|
||||||
|
|
||||||
|
Trace-cmd tests according to the CI wiki specifically the standard test interface in the [spec](https://fedoraproject.org/wiki/Changes/InvokingTests).
|
||||||
|
|
||||||
|
The playbook includes Tier1 level test cases that have been tested in classic contexts and is passing reliably.
|
||||||
|
|
||||||
|
The following steps are used to execute the tests using the standard test interface:
|
||||||
|
|
||||||
|
Test environment
|
||||||
|
|
||||||
|
Make sure you have installed packages from the spec
|
||||||
|
|
||||||
|
`# dnf install ansible python2-dnf libselinux-python standard-test-roles ansible python2-dnf libselinux-python standard-test-roles`
|
||||||
|
|
||||||
|
Run tests for Classic
|
||||||
|
~~~~
|
||||||
|
# export TEST_SUBJECTS=
|
||||||
|
# sudo ansible-playbook --tags=classic tests.yml
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
Snip of the example test run for Classic tests:
|
||||||
|
|
||||||
|
> TASK [standard-test-beakerlib : Run beakerlib tests] *****************************************************************************************************************************************
|
||||||
|
>
|
||||||
|
> changed: [localhost] => (item=sanity)
|
||||||
|
>
|
||||||
|
> TASK [standard-test-beakerlib : Make the master tests summary log artifact] ******************************************************************************************************************
|
||||||
|
>
|
||||||
|
> changed: [localhost] => (item=sanity)
|
||||||
|
>
|
||||||
|
> TASK [standard-test-beakerlib : Check the results] *******************************************************************************************************************************************
|
||||||
|
>
|
||||||
|
> changed: [localhost]
|
||||||
|
>
|
||||||
|
> TASK [standard-test-beakerlib : include_role] ************************************************************************************************************************************************
|
||||||
|
>
|
||||||
|
> TASK [str-common : Pull out the logs from test environment to test runner] *******************************************************************************************************************
|
||||||
|
>
|
||||||
|
> changed: [localhost]
|
||||||
|
>
|
||||||
|
> PLAY RECAP ***********************************************************************************************************************************************************************************
|
||||||
|
>
|
||||||
|
> localhost : ok=27 changed=16 unreachable=0 failed=0
|
||||||
|
>
|
59
tests/sanity/Makefile
Normal file
59
tests/sanity/Makefile
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Description: Basic sanity test for trace-cmd
|
||||||
|
# Author: Ziqian SUN (Zamir) <zsun@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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 3 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.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
export PACKAGE_NAME=trace-cmd
|
||||||
|
export TEST=/kernel/general/ftrace/tools/trace-cmd/sanity
|
||||||
|
export TESTVERSION=0.1
|
||||||
|
|
||||||
|
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||||
|
|
||||||
|
.PHONY: all install download clean
|
||||||
|
|
||||||
|
run: $(FILES) build
|
||||||
|
./runtest.sh
|
||||||
|
|
||||||
|
build:
|
||||||
|
chmod a+x runtest.sh
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -fr *~ tests-*.rpm
|
||||||
|
|
||||||
|
include /usr/share/rhts/lib/rhts-make.include
|
||||||
|
|
||||||
|
$(METADATA): Makefile
|
||||||
|
@echo "Owner: Ziqian SUN (Zamir) <zsun@redhat.com>" > $(METADATA)
|
||||||
|
@echo "Name: $(TEST)" >> $(METADATA)
|
||||||
|
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||||
|
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||||
|
@echo "Description: Basic sanity test for trace-cmd" >> $(METADATA)
|
||||||
|
@echo "TestTime: 30m" >> $(METADATA)
|
||||||
|
@echo "RunFor: trace-cmd" >> $(METADATA)
|
||||||
|
@echo "Requires: @development" >> $(METADATA)
|
||||||
|
@echo "Priority: Normal" >> $(METADATA)
|
||||||
|
@echo "License: GPLv3" >> $(METADATA)
|
||||||
|
@echo "Confidential: no" >> $(METADATA)
|
||||||
|
@echo "Destructive: no" >> $(METADATA)
|
||||||
|
|
||||||
|
rhts-lint $(METADATA)
|
1
tests/sanity/PURPOSE
Normal file
1
tests/sanity/PURPOSE
Normal file
@ -0,0 +1 @@
|
|||||||
|
Basic sanity test for trace-cmd
|
58
tests/sanity/runtest.sh
Executable file
58
tests/sanity/runtest.sh
Executable file
@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Description: Basic sanity test for trace-cmd
|
||||||
|
# Author: Ziqian SUN (Zamir) <zsun@redhat.com>
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Red Hat, Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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 3 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.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
# Include rhts environment
|
||||||
|
. /usr/bin/rhts-environment.sh
|
||||||
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
|
if ! mount | grep -q debugfs ; then
|
||||||
|
mount -t debugfs nodev /sys/kernel/debug
|
||||||
|
fi
|
||||||
|
|
||||||
|
trace-cmd reset
|
||||||
|
rlJournalStart
|
||||||
|
for TRACER in $(cat /sys/kernel/debug/tracing/available_tracers) ; do
|
||||||
|
rlPhaseStartTest "Enable ${TRACER} using trace-cmd"
|
||||||
|
rlRun "trace-cmd start -p ${TRACER}"
|
||||||
|
rlAssertEquals "Check current tracer" "$(cat /sys/kernel/debug/tracing/current_tracer)" "${TRACER}"
|
||||||
|
rlAssertEquals "Check tracing status" "$(cat /sys/kernel/debug/tracing/tracing_on)" "1"
|
||||||
|
rlRun "trace-cmd stop"
|
||||||
|
rlAssertEquals "Check tracing status" "$(cat /sys/kernel/debug/tracing/tracing_on)" "0"
|
||||||
|
rlRun "trace-cmd reset"
|
||||||
|
rlPhaseEnd
|
||||||
|
if [[ "${TRACER}" == "function" ]]; then
|
||||||
|
rlPhaseStartTest "Test trace-cmd show"
|
||||||
|
rlRun "trace-cmd start -p ${TRACER}"
|
||||||
|
rlWatchdog "trace-cmd show | grep -v '^#' > trace-cmd-show-function.log" 5 INT
|
||||||
|
rlAssertGreater "At least one line of trace data" $(cat trace-cmd-show-function.log | wc -l) 1
|
||||||
|
rlRun "trace-cmd stop"
|
||||||
|
rlRun "trace-cmd reset"
|
||||||
|
rlFileSubmit trace-cmd-show-function.log
|
||||||
|
rm -f trace-cmd-show-function.log
|
||||||
|
rlPhaseEnd
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
rlJournalEnd
|
11
tests/tests.yml
Normal file
11
tests/tests.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
- hosts: localhost
|
||||||
|
tags:
|
||||||
|
- classic
|
||||||
|
roles:
|
||||||
|
- role: standard-test-beakerlib
|
||||||
|
tests:
|
||||||
|
- sanity
|
||||||
|
required_packages:
|
||||||
|
- kernel
|
||||||
|
- trace-cmd
|
||||||
|
|
Loading…
Reference in New Issue
Block a user