summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Peck <bpeck@redhat.com>2014-03-25 12:16:36 -0400
committerBill Peck <bpeck@redhat.com>2014-03-25 12:16:36 -0400
commitec83ff5b2bc45bcc2fe61235251ad96573ef5e41 (patch)
treebec27a11b3f795b729473996709947f0ec6e547b
parent90d8da36aa9f8ba618a21c4584e91eb1e07d21c6 (diff)
downloadtests-ec83ff5b2bc45bcc2fe61235251ad96573ef5e41.tar.gz
tests-ec83ff5b2bc45bcc2fe61235251ad96573ef5e41.tar.xz
tests-ec83ff5b2bc45bcc2fe61235251ad96573ef5e41.zip
Add gdb simple task
-rw-r--r--kernel/misc/gdb-simple/Makefile65
-rw-r--r--kernel/misc/gdb-simple/gdb-commands3
-rwxr-xr-xkernel/misc/gdb-simple/runtest.sh46
3 files changed, 114 insertions, 0 deletions
diff --git a/kernel/misc/gdb-simple/Makefile b/kernel/misc/gdb-simple/Makefile
new file mode 100644
index 0000000..32093b4
--- /dev/null
+++ b/kernel/misc/gdb-simple/Makefile
@@ -0,0 +1,65 @@
+# Example Makefile for RHTS
+# This example is geared towards a test for a specific package
+# It does most of the work for you, but may require further coding
+
+# The toplevel namespace within which the test lives.
+# Kernel is odd in that it is its own top level. Probably wasn't
+# the smartest idea.
+TOPLEVEL_NAMESPACE=
+
+# The name of the package under test:
+# FIXME: you wil need to change this:
+PACKAGE_NAME=kernel
+
+# The path of the test below the package:
+# FIXME: you wil need to change this:
+RELATIVE_PATH=misc/gdb-simple
+
+# Version of the Test. Used with make tag.
+export TESTVERSION=1.2
+
+# The compiled namespace of the test.
+export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
+
+.PHONY: all install download clean
+
+BUILT_FILES= # executables to be built should be added here, they will be generated on the system under test.
+FILES=$(METADATA) Makefile runtest.sh gdb-commands
+
+run: $(FILES) build
+ ./runtest.sh
+
+build: $(BUILT_FILES)
+ chmod a+x ./runtest.sh
+
+clean:
+ rm -f *~ $(BUILT_FILES)
+ rm -rf test/
+
+# You may need to add other taregts e.g. to build executables from source code
+# Add them here:
+
+# Include Common Makefile
+include /usr/share/rhts/lib/rhts-make.include
+
+# Generate the testinfo.desc here:
+$(METADATA): Makefile
+ @touch $(METADATA)
+ @echo "Name: $(TEST)" >> $(METADATA)
+ @echo "Path: $(TEST_DIR)" >> $(METADATA)
+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
+ @echo "Description: Simple kernel + gdb sanity check" >> $(METADATA)
+ @echo "TestTime: 5m" >> $(METADATA)
+ @echo "Releases: -RHEL2.1" >> $(METADATA)
+# @echo "Architectures: ia64" >> $(METADATA)
+ @echo "Destructive: no" >> $(METADATA)
+ @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
+ @echo "Type: Regression" >> $(METADATA)
+ @echo "Type: Releasecriterium" >> $(METADATA)
+ @echo "Type: KernelTier1" >> $(METADATA)
+ @echo "Requires: gdb" >> $(METADATA)
+ @echo "Requires: coreutils" >> $(METADATA)
+ @echo "Requires: @development-tools" >> $(METADATA)
+ @echo "Owner: Mike Gahagan <mgahagan@redhat.com>" >> $(METADATA)
+ @echo "License: Red Hat internal" >> $(METADATA)
+# You may need other fields here; see the documentation
diff --git a/kernel/misc/gdb-simple/gdb-commands b/kernel/misc/gdb-simple/gdb-commands
new file mode 100644
index 0000000..e0f0548
--- /dev/null
+++ b/kernel/misc/gdb-simple/gdb-commands
@@ -0,0 +1,3 @@
+run /etc/aliases
+quit
+
diff --git a/kernel/misc/gdb-simple/runtest.sh b/kernel/misc/gdb-simple/runtest.sh
new file mode 100755
index 0000000..ab4854d
--- /dev/null
+++ b/kernel/misc/gdb-simple/runtest.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# source the test script helpers
+# BUG: This line is intentionally left commented out.
+# When I have the helper packages installed the line below should be
+# uncommented
+ . /usr/bin/rhts-environment.sh
+
+# Commands in this section are provided by test developer.
+# ---------------------------------------------
+
+# Assume the test will fail.
+result=FAIL
+
+# Helper functions
+function result_fail() {
+ export result=FAIL
+ report_result $TEST $result 0
+ exit 0
+}
+function result_pass () {
+ export result=PASS
+ report_result $TEST $result 0
+ exit 0
+}
+
+
+# run the test. Start gdb against /bin/cat and see if can sucessfully
+# attach to it and cat runs to completion.
+
+echo "*** Start of test ***" >> $OUTPUTFILE
+gdb /bin/cat -x gdb-commands >> $OUTPUTFILE 2>&1
+RC=$?
+if [ $RC -eq 0 ] ; then
+ echo "*** gdb test successful ***" >> $OUTPUTFILE
+ result_pass
+else
+ echo "*** gdb test failed ***" >> $OUTPUTFILE
+ result_fail
+fi
+
+# something bad must have happened, otherwise we should not get here.
+echo "Unhandled exception or other problem, results not reliable!" >> $OUTPUTFILE
+result_fail
+
+