mirror of https://github.com/zachjs/sv2v.git
add optional error message patterns to error test suite
This commit is contained in:
parent
5891a0eb7d
commit
e94c0346e8
|
|
@ -1,3 +1,4 @@
|
|||
// pattern: bad default_nettype: "invalid"
|
||||
`default_nettype invalid
|
||||
module top;
|
||||
assign foo = 0;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// pattern: implicit declaration of "foo" but default_nettype is none
|
||||
`default_nettype none
|
||||
module top;
|
||||
assign foo = 0;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// pattern: enum conversion has duplicate vals
|
||||
module top;
|
||||
typedef enum {
|
||||
A = 0,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// pattern: unexpected token 'highz1'
|
||||
module top;
|
||||
wire (highz0, highz1) x;
|
||||
endmodule
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// pattern: cannot convert expression to LHS
|
||||
module top;
|
||||
logic x;
|
||||
assign {<< {x, 2'b00}} = 3'b101;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// pattern: cannot convert expression to LHS
|
||||
module top;
|
||||
logic x, y, z;
|
||||
assign {<< {x, '{y:y, z:z}}} = 3'b101;
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
// pattern: Could not find file "does_not_exist\.sv", included from "missing_include\.sv"
|
||||
`include "does_not_exist.sv"
|
||||
|
|
|
|||
|
|
@ -1,10 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
validateOutput() {
|
||||
stdout_len=`wc -l < $SHUNIT_TMPDIR/stdout`
|
||||
assertEquals "stdout should be empty" 0 $stdout_len
|
||||
stderr=`cat $SHUNIT_TMPDIR/stderr`
|
||||
assertNotNull "stderr should not be empty" "$stderr"
|
||||
line=`head -n1 $1`
|
||||
if [[ "$line" =~ \/\/\ pattern:\ .* ]]; then
|
||||
pattern=${line:12}
|
||||
if [[ ! "$stderr" =~ $pattern ]]; then
|
||||
fail "error message doesn't match\nexpected: $pattern\nactual: $stderr"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
addTest() {
|
||||
test=$1
|
||||
eval "test_$test() { \
|
||||
$SV2V $test.sv 2> /dev/null > /dev/null; \
|
||||
$SV2V $test.sv 2> $SHUNIT_TMPDIR/stderr > $SHUNIT_TMPDIR/stdout; \
|
||||
assertFalse \"conversion should have failed\" \$?; \
|
||||
validateOutput $test.sv; \
|
||||
}"
|
||||
suite_addTest test_$test
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// pattern: Undefined macro: SOMETHING
|
||||
`SOMETHING
|
||||
module top;
|
||||
endmodule
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
// pattern: `endif directive outside of an `if/`endif block
|
||||
`endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue