Allow 'Log Test Case Status' to pay heed to ffdc_dir_path_style.

ffdc_dir_path_style allows for a different scheme for FFDC locations
and names.  It isn't always prudent to write logs to the same path
as the git repo.

Change-Id: Id69b5aff678f81f4cb35675e131d7555d8545405
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/openbmc_ffdc.py b/lib/openbmc_ffdc.py
index 36c011c..314cacf 100644
--- a/lib/openbmc_ffdc.py
+++ b/lib/openbmc_ffdc.py
@@ -55,13 +55,6 @@
 
     grp.rprint_timen("Collecting FFDC.")
 
-    # Note: Several subordinate functions like 'Get Test Dir and Name' and
-    # 'Header Message' expect global variable FFDC_TIME to be set.
-    cmd_buf = ["Get Current Time Stamp"]
-    grp.rdpissuing_keyword(cmd_buf)
-    FFDC_TIME = BuiltIn().run_keyword(*cmd_buf)
-    BuiltIn().set_global_variable("${FFDC_TIME}", FFDC_TIME)
-
     # Get default values for arguments.
     ffdc_dir_path, ffdc_prefix = set_ffdc_defaults(ffdc_dir_path, ffdc_prefix)
     grp.rprint_var(ffdc_dir_path)
@@ -111,6 +104,13 @@
     will remain unchanged.
     """
 
+    # Note: Several subordinate functions like 'Get Test Dir and Name' and
+    # 'Header Message' expect global variable FFDC_TIME to be set.
+    cmd_buf = ["Get Current Time Stamp"]
+    grp.rdpissuing_keyword(cmd_buf)
+    FFDC_TIME = BuiltIn().run_keyword(*cmd_buf)
+    BuiltIn().set_global_variable("${FFDC_TIME}", FFDC_TIME)
+
     ffdc_dir_path_style = BuiltIn().get_variable_value(
         "${ffdc_dir_path_style}")
 
@@ -156,6 +156,9 @@
             else:
                 ffdc_prefix = FFDC_TIME + "_"
 
+    BuiltIn().set_global_variable("${FFDC_DIR_PATH}", ffdc_dir_path)
+    BuiltIn().set_global_variable("${FFDC_PREFIX}", ffdc_prefix)
+
     return ffdc_dir_path, ffdc_prefix
 
 ###############################################################################
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index 4911469..5a6f5ba 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -176,6 +176,17 @@
     ...  logs/test_history.txt
     ...  Format   Date:Test suite:Test case:Status
     ...  20160909214053719992:Test Warmreset:Test WarmReset via REST:FAIL
+
+    ${FFDC_DIR_PATH_STYLE}=  Get Variable Value  ${FFDC_DIR_PATH_STYLE}
+    ...  ${EMPTY}
+    ${FFDC_DIR_PATH}=  Get Variable Value  ${FFDC_DIR_PATH}  ${EMPTY}
+
+    Run Keyword If  '${FFDC_DIR_PATH}' == '${EMPTY}'  Set FFDC Defaults
+
+    Run Keyword If  '${FFDC_DIR_PATH_STYLE}' == '${1}'  Run Keywords
+    ...  Set Global Variable  ${FFDC_LOG_PATH}  ${FFDC_DIR_PATH}  AND
+    ...  Set Global Variable  ${TEST_HISTORY}  ${FFDC_DIR_PATH}test_history.txt
+
     Create Directory   ${FFDC_LOG_PATH}
 
     ${exist}=   Run Keyword and Return Status
@@ -184,6 +195,8 @@
     Run Keyword If  '${exist}' == '${False}'
     ...   Create File  ${TEST_HISTORY}
 
+    Rpvars  TEST_HISTORY
+
     ${cur_time}=      Get Current Time Stamp
 
     Append To File    ${TEST_HISTORY}