I want to test 2 C programs to check it's coverage (line coverage and branch coverage).
I am using gcovr in linux system.
To do this, I have written a Perl Script that will call gcc
compiler and read input from the file, then gives test for the coverage of C program.
I have many test suites in the form of files that are given to C program, I am using Perl to automate the input and get the coverage using gcovr
.
Of course I've used system
command , and backtics in perl to call gcc
and gcovr
.
The first C program runs well, because the input to the program is read from arguments given.
But for the second C program, I got confused, because the program only accepts input from keyboard or simply put "it is using scanf
".
So, how can we provide input to C programs that only accepts input from keyboard (scanf
) through terminal linux or using perl with system
command ?