NO_FILES_WARNING="Warning: No input files specified (try \`sv2v --help\`)"
NO_FILES_WARNING="Warning: No input files specified (try \`sv2v --help\`)"
PACKAGE_WARNING="Warning: Source includes packages but no modules. Please convert packages alongside the modules that use them."
INTERFACE_WARNING="Warning: Source includes an interface but the output is empty because there are no modules without any interface ports. Please convert interfaces alongside the modules that instantiate them."
INTERFACE_WARNING="Warning: Source includes an interface but output is empty because there is no top-level module which has no ports which are interfaces."
PORT_CONN_ATTR_WARNING="attr.sv:6:11: Warning: Ignored port connection attributes (* foo *)(* bar *)."
PORT_CONN_ATTR_WARNING="attr.sv:6:11: Warning: Ignored port connection attributes (* foo *)(* bar *)."
test_default(){
test_default(){
runAndCapture interface.sv module.sv package.sv
runAndCapture \
interface.sv module.sv \
package.sv class.sv \
localparam.sv task.sv function.sv
assertTrue "default conversion should succeed"$result
assertTrue "default conversion should succeed"$result
assertNotNull "stdout should not be empty""$stdout"
assertNotNull "stdout should not be empty""$stdout"
assertNull "stderr should be empty""$stderr"
assertNull "stderr should be empty""$stderr"
...
@@ -26,46 +28,49 @@ test_port_conn_attr() {
...
@@ -26,46 +28,49 @@ test_port_conn_attr() {
assertEquals "stderr should should have warning""$PORT_CONN_ATTR_WARNING""$stderr"
assertEquals "stderr should should have warning""$PORT_CONN_ATTR_WARNING""$stderr"
}
}
test_only_package(){
no_modules_test(){
runAndCapture package.sv
file=$1
warning="$2"
runAndCapture $file
assertTrue "conversion should succeed"$result
assertTrue "conversion should succeed"$result
assertNull "stdout should be empty""$stdout"
assertNull "stdout should be empty""$stdout"
assertEquals "stderr should have warning""$PACKAGE_WARNING""$stderr"
assertEquals "stderr should have warning""$warning""$stderr"
}
test_only_package_verbose(){
runAndCapture -v$file
runAndCapture -v package.sv
assertTrue "conversion should succeed"$result
assertTrue "conversion should succeed"$result
assertNotNull "stdout should not be empty""$stdout"
assertNotNull "stdout should not be empty""$stdout"
assertEquals "stderr should have warning""$PACKAGE_WARNING""$stderr"
assertEquals "stderr should have warning""$warning""$stderr"
}
}
test_only_interface(){
test_only_interface(){
runAndCapture interface.sv
no_modules_test interface.sv "$INTERFACE_WARNING"
assertTrue "conversion should succeed"$result
assertNull "stdout should be empty""$stdout"
assertEquals "stderr should have warning""$INTERFACE_WARNING""$stderr"
}
}
test_only_interface_verbose(){
basic_no_modules_test(){
runAndCapture -v interface.sv
kind=$1
assertTrue "conversion should succeed"$result
warning="Warning: Source includes a $kind but no modules. Such elements are elaborated into the modules that use them. Please convert all sources in one invocation."
assertNotNull "stdout should not be empty""$stdout"
no_modules_test $kind.sv "$warning"
assertEquals "stderr should have warning""$INTERFACE_WARNING""$stderr"
}
}
test_only_localparam(){
test_only_package(){
runAndCapture localparam.sv
basic_no_modules_test package
assertTrue "conversion should succeed"$result
assertNull "stdout should be empty""$stdout"
assertNull "stderr should be empty""$stderr"
}
}
test_only_localparam_verbose(){
test_only_class(){
runAndCapture -v localparam.sv
basic_no_modules_test class
assertTrue "conversion should succeed"$result
}
assertNotNull "stdout should not be empty""$stdout"