Blame SOURCES/0002-add-README-with-description-of-the-test-suite.patch

cca0c4
From 9c9587feca7413b34498064db19d796e1c402b51 Mon Sep 17 00:00:00 2001
cca0c4
From: Alexander Todorov <atodorov@redhat.com>
cca0c4
Date: Thu, 11 Jun 2015 08:45:37 -0400
cca0c4
Subject: [PATCH 02/55] add README with description of the test suite
cca0c4
cca0c4
---
cca0c4
 README.rst | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
cca0c4
 1 file changed, 72 insertions(+)
cca0c4
 create mode 100644 README.rst
cca0c4
cca0c4
diff --git a/README.rst b/README.rst
cca0c4
new file mode 100644
cca0c4
index 00000000000..a5743ff2f96
cca0c4
--- /dev/null
cca0c4
+++ b/README.rst
cca0c4
@@ -0,0 +1,72 @@
cca0c4
+grubby is a command line tool for updating and displaying information about
cca0c4
+the configuration files for the grub, lilo, elilo (ia64), yaboot (powerpc)
cca0c4
+and zipl (s390) boot loaders. It is primarily designed to be used from scripts
cca0c4
+which install new kernels and need to find information about the current boot
cca0c4
+environment.
cca0c4
+
cca0c4
+
cca0c4
+Testing grubby
cca0c4
+==============
cca0c4
+
cca0c4
+To execute the integrated test suite from inside the source directory run the
cca0c4
+command::
cca0c4
+
cca0c4
+    make test
cca0c4
+
cca0c4
+
cca0c4
+Test Suite Architecture
cca0c4
+------------------------
cca0c4
+
cca0c4
+grubby's test suite is written in Bash. The file `test.sh` contains several
cca0c4
+helper functions and a list of different test scenarios which are exercised
cca0c4
+upon execution. Important functions are:
cca0c4
+
cca0c4
+- oneTest() - test if the configuration generated by the supplied grubby
cca0c4
+  parameters matches a well known configuration file;
cca0c4
+
cca0c4
+- oneDisplayTest() - test grubby features that display some information,
cca0c4
+  checking grubby's output against well known values;
cca0c4
+
cca0c4
+- commandTest() - test if the output of some commands matches the provided
cca0c4
+  text. This function is only used for grub2 testing in a few places.
cca0c4
+
cca0c4
+
cca0c4
+Note: the test suite creates aliases for oneTest() and oneDisplayTest(), which
cca0c4
+are prefixed with the corresponding boot loader name. For example:
cca0c4
+grubTest(). eliloTest(), etc.
cca0c4
+
cca0c4
+The invocation syntax is::
cca0c4
+
cca0c4
+    testFunction config_file results_file --grubby --options
cca0c4
+
cca0c4
+For example the line::
cca0c4
+
cca0c4
+    grubTest grub.1 updargs/g1.1 --update-kernel=DEFAULT --args="root=/dev/hda1"
cca0c4
+    
cca0c4
+means execute the command::
cca0c4
+
cca0c4
+    ./grubby --grub --config-file tests/grub.1 --update-kernel=DEFAULT \
cca0c4
+    --args="root=/dev/hda1"
cca0c4
+
cca0c4
+and compare the resulting configuration with the file
cca0c4
+`tests/results/updargs/g1.1`.
cca0c4
+
cca0c4
+
cca0c4
+The line::
cca0c4
+
cca0c4
+    grubDisplayTest grub.1 defaultindex/0 --default-index
cca0c4
+
cca0c4
+means execute::
cca0c4
+
cca0c4
+    ./grubby --grub --config-file tests/grub.1 --default-index
cca0c4
+
cca0c4
+and compare the output with the file `tests/results/defaultindex/0`.
cca0c4
+
cca0c4
+Writing New Test Cases
cca0c4
+----------------------
cca0c4
+
cca0c4
+To write a new test case for grubby you need a config file which matches the
cca0c4
+initial test conditions (either existing one or a new one), provide a 
cca0c4
+results file (likely a new one) which contains the expected configuration or
cca0c4
+output and finally add a call to the test function(s) using the desired grubby
cca0c4
+parameters in an appropriate section of `test.sh`.
cca0c4
-- 
cca0c4
2.17.1
cca0c4