Add the dump-tables test

- uses acpidump to dump the acpi tables
 - then uses iasl to attempt to disassemble the dump table files.
This commit is contained in:
Mike Gahagan 2018-09-21 15:08:53 -04:00
parent a1232e6851
commit e9dea8a3ac
5 changed files with 168 additions and 0 deletions

View File

@ -0,0 +1,52 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/acpica-tools/dump-tables
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Author, maintainer and description of the test
AUTHOR=Mike Gahagan <mgahagan@redhat.com>
DESCRIPTION=Uses the utilities in acpica-tools to dump the ACPI tables on a system and upload to Beaker.
PACKAGE=acpica-tools
# The name of the test.
export TEST=/CoreOS/acpica-tools/dump-tables
# Version of the test. Used with make tag.
export TESTVERSION=2.0
# data files, .c files, scripts anything needed to either compile the test and/or run it.
FILES=$(METADATA) runtest.sh PURPOSE Makefile
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES) $(FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ *.rpm
rm -f $(METADATA)
rm -rf /mnt/testarea/dump-tables
# Include Common Makefile
include /usr/share/rhts/lib/rhts-make.include
# Generate the testinfo.desc here:
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: $(AUTHOR)" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: $(DESCRIPTION)" >> $(METADATA)
@echo "TestTime: 12m" >> $(METADATA)
@echo "RunFor: $(PACKAGE)" >> $(METADATA)
@echo "Architectures: aarch64 i386 x86_64 ppc64 ppc64le" >> $(METADATA)
@echo "Type: Functional" >> $(METADATA)
@echo "Requires: $(PACKAGE)" >> $(METADATA)
rhts-lint $(METADATA)
# The include package takes care of all the dependencies
# Add any other dependencies there (/kernel/filesystems/xfs/include)

13
tests/dump-tables/PURPOSE Normal file
View File

@ -0,0 +1,13 @@
Uses the utilities in acpica-tools to dump the ACPI tables on a system and upload to Beaker.
The task will do the following:
- Capture the acpi tables currently in use by the running kernel in binary format (acpidump-acpica -b)
- Capture namespace information from the DSDT (acpinames dsdt.dat)
- Capture the acpi tables currently in use by the running kernel hexidecmal encoded (acpidump-acpica -o somefile.hex)
- Decompile the table files from the binary tables and store the resulting source code (iasl -d on each .dat file)
- Archive all of the above and send to Beaker.
Paramaters:
ACPIDUMP_BIN - Set to path/to/alternate-acpidump-binary to use a different acpidump tool from what acpica-tools provides,
set to "_sys_firmware" to bypass use of acpidump completely and dump from /sys/firmware/acpi/tables/ instead
note: using the acpidump binary is not supported on all platforms

90
tests/dump-tables/runtest.sh Executable file
View File

@ -0,0 +1,90 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/acpica-tools/dump-tables
# Description: Uses the utilities in acpica-tools to dump the ACPI tables on a system and upload to Beaker.
# Author: Mike Gahagan <mgahagan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh
. /usr/share/beakerlib/beakerlib.sh
TESTNAME=$(basename $TEST)
OUTPUTDIR=/mnt/testarea/$TESTNAME
log_dir=$OUTPUTDIR/logs
# RHEL uses /usr/bin/acpidump-acpica, Fedora uses /usr/bin/acpidump
#ACPIDUMP_BIN="${ACPIDUMP_BIN:-acpidump-acpica}"
ACPIDUMP_BIN="${ACPIDUMP_BIN:-acpidump}"
PACKAGE="acpica-tools"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
[ $? -eq 0 ] || rlDie "$PACKAGE must be installed!... aborting.."
rlGetDistroRelease
rlGetDistroVariant
rlShowRunningKernel
rlGetPrimaryArch
rlGetSecondaryArch
rlRun "mkdir -p $OUTPUTDIR/{bin,logs,asl,hex}" 0 "Making output directories"
[ $? -eq 0 ] || rlDie "Cannot make output directories!... aborting.."
rlLog "Using acpidump binary: $ACPIDUMP_BIN"
rlPhaseEnd
rlPhaseStartTest
pushd $OUTPUTDIR/bin
if [[ $ACPIDUMP_BIN = "_sys_firmware" ]] ; then
rlLog "Dumping tables from /sys/firmware/acpi/tables..."
find /sys/firmware/acpi/tables/ -type f | while read f ; do
name="$(basename $f | tr '[[:upper:]]' '[[:lower:]]').dat"
cat $f > $name
done
else
rlRun "$ACPIDUMP_BIN -bz" 0 "Dumping binary ACPI info..."
fi
rlRun "acpinames dsdt.dat > ../logs/DSDT-ACPI-namespace.out 2>&1" 0 "Extracting namespace information from DSDT"
rlLog "Decompiling binary files"
for f in $(ls *.dat) ; do
rlRun "iasl -d $f" 0 "Decompiling $f"
done
rlRun "mv *.dsl ../asl" 0 "Moving source files to $OUTPUTDIR/asl"
popd
if [[ $ACPIDUMP_BIN != "_sys_firmware" ]]; then
rlRun "$ACPIDUMP_BIN -o $OUTPUTDIR/hex/$HOSTNAME-ACPI-TABLE.hex" 0 "Dumping hex-encoded ACPI info"
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "tar -Jcf $log_dir/$HOSTNAME-ACPI-TABLE-AML.tar.xz $OUTPUTDIR/bin" 0 "Archiving aml files..."
rlRun "tar -Jcf $log_dir/$HOSTNAME-ACPI-TABLE-ASL.tar.xz $OUTPUTDIR/asl" 0 "Archiving asl files..."
if [ -f $OUTPUTDIR/hex/$HOSTNAME-ACPI-TABLE.hex ]; then
rlRun "cp $OUTPUTDIR/hex/$HOSTNAME-ACPI-TABLE.hex $log_dir" 0 "Copying hex-encoded ACPI info to log directory"
fi
for f in $log_dir/*; do
if [ -f $f ] ; then
rlFileSubmit $f
fi
done
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,12 @@
# Tests that run in classic and atomic
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
- atomic
tests:
- dump-tables
required_packages:
- acpica-tools

View File

@ -2,3 +2,4 @@
- import_playbook: test_grammar.yml
- import_playbook: test_grammar2.yml
- import_playbook: test_converterSample.yml
- import_playbook: test_dump-tables.yml