From 9b2fec3be17d065898706245ddee7c6e020b9f6e Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 25 Feb 2020 02:01:21 +0100 Subject: testsuite/gna: add test for #1145 --- testsuite/gna/issue1145/count.vhdl | 22 ++++++++++++++++++++++ testsuite/gna/issue1145/empty.txt | 5 +++++ testsuite/gna/issue1145/ghdl_test.txt | 10 ++++++++++ testsuite/gna/issue1145/tb.vhdl | 26 ++++++++++++++++++++++++++ testsuite/gna/issue1145/testsuite.sh | 16 ++++++++++++++++ 5 files changed, 79 insertions(+) create mode 100644 testsuite/gna/issue1145/count.vhdl create mode 100644 testsuite/gna/issue1145/empty.txt create mode 100644 testsuite/gna/issue1145/ghdl_test.txt create mode 100644 testsuite/gna/issue1145/tb.vhdl create mode 100755 testsuite/gna/issue1145/testsuite.sh (limited to 'testsuite/gna') diff --git a/testsuite/gna/issue1145/count.vhdl b/testsuite/gna/issue1145/count.vhdl new file mode 100644 index 000000000..a515dd1de --- /dev/null +++ b/testsuite/gna/issue1145/count.vhdl @@ -0,0 +1,22 @@ +library std; +use std.textio.all; + +entity count is +end entity count; + +architecture tb of count is +begin + p_test : process is + variable v_line : line; + variable nlines : natural := 0; + begin + while not endfile(input) loop + readline(input, v_line); + nlines := nlines + 1; + end loop; + + report natural'image (nlines); + + wait; + end process; +end architecture; diff --git a/testsuite/gna/issue1145/empty.txt b/testsuite/gna/issue1145/empty.txt new file mode 100644 index 000000000..804598449 --- /dev/null +++ b/testsuite/gna/issue1145/empty.txt @@ -0,0 +1,5 @@ +1 +2 +3 + +5 diff --git a/testsuite/gna/issue1145/ghdl_test.txt b/testsuite/gna/issue1145/ghdl_test.txt new file mode 100644 index 000000000..238f43adf --- /dev/null +++ b/testsuite/gna/issue1145/ghdl_test.txt @@ -0,0 +1,10 @@ +114,-76,-317,-192,-243,261,99,37,10,-267,-429,-77,133,-117,-760,-363,-294,586,179,-62,-414,-188,-196,351,1,2,0,0,0 +-141,-91,-22,441,448,180,-38,-141,-331,211,214,633,-268,-77,207,1347,999,-216,-241,-206,-62,687,664,74,1,2,0,0,0 +-92,161,541,265,507,-808,-36,173,813,-509,-59,-682,17,545,1826,-875,-893,-1493,-38,308,380,-571,-341,-482,1,2,0,0,0 +181,88,676,-1484,-1635,-413,25,-83,-1470,235,461,876,500,-217,-675,-1357,-1164,1060,-213,8,-18,1511,1070,-455,1,2,1,0,0 +-278,154,2919,650,-35,-2073,-190,-389,-2376,-110,550,2684,-58,-51,856,1775,860,-395,-848,-813,-1922,3408,3586,1359,1,2,0,0,0 +86,578,1208,-1260,-635,-1180,-338,488,1747,642,1115,-2076,-171,855,3564,-1449,-1067,-3147,-90,908,2039,-1723,-1117,-1933,1,2,0,0,0 +467,-198,-806,-1601,-1615,907,332,177,-266,-652,-1178,-91,630,-361,-2452,-1816,-1546,2127,333,-226,-1315,484,219,678,1,2,0,0,0 +-123,-185,-735,561,741,788,15,-154,-48,323,199,468,-427,-146,64,1835,1469,-203,-187,-129,377,313,217,-171,1,2,0,0,0 +-80,92,508,404,401,-661,-35,61,330,-363,-83,-252,32,332,1070,-463,-522,-898,-9,114,-122,-372,-153,88,1,2,0,0,0 +87,29,118,-570,-630,6,36,25,-284,21,-47,78,156,-150,-650,-415,-271,633,46,-49,-96,312,214,-45,1,2,0,0,0 diff --git a/testsuite/gna/issue1145/tb.vhdl b/testsuite/gna/issue1145/tb.vhdl new file mode 100644 index 000000000..397a37e72 --- /dev/null +++ b/testsuite/gna/issue1145/tb.vhdl @@ -0,0 +1,26 @@ +library std; +use std.textio.all; + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity tb_ghdl_test is +end entity tb_ghdl_test; + +architecture tb of tb_ghdl_test is +begin + p_test : process is + file f_in : text; + variable v_line : line; + begin + file_open(f_in, "ghdl_test.txt", read_mode); + + while not endfile(f_in) loop + readline(f_in, v_line); + report v_line.all; + end loop; + + wait; + end process; +end architecture; diff --git a/testsuite/gna/issue1145/testsuite.sh b/testsuite/gna/issue1145/testsuite.sh new file mode 100755 index 000000000..9a9f45ebd --- /dev/null +++ b/testsuite/gna/issue1145/testsuite.sh @@ -0,0 +1,16 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze tb.vhdl +elab_simulate tb_ghdl_test + +analyze count.vhdl +elab count + +simulate count < ghdl_test.txt | grep -q " 10" +simulate count < empty.txt | grep -q " 5" + +clean + +echo "Test successful" -- cgit v1.2.3