[Mesa-dev] [PATCH 5/5] src/glsl/glcpp: wire up glcpp-test to make check

Gaetan Nadon memsize at videotron.ca
Mon Jan 30 09:03:36 PST 2012


On 12-01-30 11:53 AM, Gaetan Nadon wrote:
> On 12-01-30 01:09 AM, Matt Turner wrote:
>> ---
>>  src/glsl/glcpp/Makefile.am      |    2 ++
>>  src/glsl/glcpp/tests/glcpp-test |    6 +++++-
>>  2 files changed, 7 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am
>> index 198908c..68f55dc 100644
>> --- a/src/glsl/glcpp/Makefile.am
>> +++ b/src/glsl/glcpp/Makefile.am
>> @@ -24,6 +24,8 @@
>>  noinst_LTLIBRARIES = libglcpp.la
>>  check_PROGRAMS = glcpp
>>  
>> +TESTS = tests/glcpp-test
>> +
>>  AM_CPPFLAGS = \
>>  	-I$(top_srcdir)/src/mesa \
>>  	-I$(top_srcdir)/src/mapi \
>> diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test
>> index 1db7523..1f37139 100755
>> --- a/src/glsl/glcpp/tests/glcpp-test
>> +++ b/src/glsl/glcpp/tests/glcpp-test
>> @@ -34,10 +34,14 @@ total=0
>>  pass=0
>>  clean=0
>>  
>> +builddir=`pwd`
> This looks very suspicious. The builddir variable is an Automake
> variable which should not be changed by the makefile. At a glance it
> looks like $(top_builddir)/glcpp should do the job. So far I have not
Sorry, I meant $(top_builddir)/src/glsl/glcpp or whatever the correct
location is.
> encountered any situation that would require such hazardous endeavour.
>
> I am not sure if you are using the Automake Support for test suites
> (http://www.gnu.org/software/automake/manual/automake.html#Tests), but
> if you are, note that srcdir is also en environment variable that is
> available to the test programs. I don't think builddir is, but I don't
> think it is needed anyway as the test cases are run in $builddir.
You'd also have better chances of getting distcheck to build correctly.
>
> You may want to look at libxcbcommon for a good example of coding test
> suites, in the spirit of not reinventing the wheel.
>
> The other patches look ok to me, not knowing the code, of course.
>> +testdir=`dirname $0`
>> +cd $testdir
>> +
>>  echo "====== Testing for correctness ======"
>>  for test in *.c; do
>>      echo -n "Testing $test..."
>> -    ../glcpp < $test > $test.out 2>&1
>> +    $builddir/glcpp < $test > $test.out 2>&1
>>      total=$((total+1))
>>      if cmp $test.expected $test.out >/dev/null 2>&1; then
>>  	echo "PASS"



More information about the mesa-dev mailing list