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

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