Browse Source

Hide non-deterministic data from from traceback in tests

Alois Mahdal 6 years ago
parent
commit
a00a52dba2
1 changed files with 10 additions and 3 deletions
  1. 10
    3
      tests/basic/TF_RUN

+ 10
- 3
tests/basic/TF_RUN View File

76
         inv_xpath:o_err)
76
         inv_xpath:o_err)
77
             echo 'Invalid expression'
77
             echo 'Invalid expression'
78
             echo 'Traceback (most recent call last):'
78
             echo 'Traceback (most recent call last):'
79
-            echo '  File "/usr/libexec/shellfu-bash-pxpath/pxpath", line 54, in <module>'
79
+            echo '  File _SOME_FILE_, line _SOME_LINE_, in <module>'
80
             echo '    matches = context.xpathEvalExpression(expr)'
80
             echo '    matches = context.xpathEvalExpression(expr)'
81
-            echo '  File "/usr/lib64/python2.7/site-packages/libxml2.py", line 7346, in xpathEvalExpression'
81
+            echo '  File _SOME_FILE_, line _SOME_LINE_, in xpathEvalExpression'
82
             echo "    if ret is None:raise xpathError('xmlXPathEvalExpression() failed')"
82
             echo "    if ret is None:raise xpathError('xmlXPathEvalExpression() failed')"
83
             echo 'libxml2.xpathError: xmlXPathEvalExpression() failed'
83
             echo 'libxml2.xpathError: xmlXPathEvalExpression() failed'
84
             ;;
84
             ;;
112
 
112
 
113
 runtest() {
113
 runtest() {
114
     local xpath
114
     local xpath
115
+    local r_es=0
115
     mkdir -p "test" "result/$name"
116
     mkdir -p "test" "result/$name"
116
     mkxml > "test.xml"
117
     mkxml > "test.xml"
117
     xpath=$(mka xpath)
118
     xpath=$(mka xpath)
122
         io_adir)        pxpath "$xpath" oracle ;;
123
         io_adir)        pxpath "$xpath" oracle ;;
123
         io_pipe)        <"test.xml" pxpath "$xpath" - ;;
124
         io_pipe)        <"test.xml" pxpath "$xpath" - ;;
124
         *)  pxpath  "$xpath" "test.xml" ;;
125
         *)  pxpath  "$xpath" "test.xml" ;;
125
-    esac
126
+    esac >out.cache 2>err.cache; r_es=$?
127
+    cat out.cache
128
+    <err.cache sed '
129
+        /^  File /s/File ".*",/File _SOME_FILE_,/
130
+        /^  File /s/line [1-9][0-9]*,/line _SOME_LINE_,/
131
+    ' >&2
132
+    return $r_es
126
 }
133
 }
127
 
134
 
128
 tf_do_subtest() {
135
 tf_do_subtest() {