Report step number when a test case fails

Allow test code to declare a "step number". Report the current step
number when a test fails.
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function
index 1a524a6..d45fd4e 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -393,6 +393,7 @@
     const char *test;
     const char *filename;
     int line_no;
+    unsigned long step;
 }
 test_info;
 
@@ -423,6 +424,19 @@
 /*----------------------------------------------------------------------------*/
 /* Helper Functions */
 
+/** Set the test step number for failure reports.
+ *
+ * Call this function to display "step NNN" in addition to the line number
+ * and file name if a test fails. Typically the "step number" is the index
+ * of a for loop but it can be whatever you want.
+ *
+ * \param step  The step number to report.
+ */
+void test_set_step( unsigned long step )
+{
+    test_info.step = step;
+}
+
 void test_fail( const char *test, int line_no, const char* filename )
 {
     test_info.result = TEST_RESULT_FAILED;