replace copy-pasted code by calling create_cgal_test --no-run for demos

This commit is contained in:
Sylvain Pion 2007-03-09 22:58:30 +00:00
parent cd1a040d2e
commit 1f088ecde2
1 changed files with 7 additions and 64 deletions

View File

@ -318,75 +318,12 @@ sub CreateDemoTestDirs()
foreach $DIR (glob("*")) {
if ( -d $DIR ) {
system('cp', '-r', "$DIR", "../test/${DIR}_Demo");
open(CGAL_TEST,">../test/${DIR}_Demo/cgal_test");
print CGAL_TEST <<'EOF';
#! /bin/sh
# This is a script for the CGAL test suite. Such a script must obey
# the following rules:
#
# - the name of the script is cgal_test
# - for every target two one line messages are written to the file 'error.txt'
# the first one indicates if the compilation was successful
# the second one indicates if the execution was successful
# if one of the two was not successful, the line should start with 'ERROR:'
# - running the script should not require any user interaction
# - the script should clean up object files and executables
ERRORFILE=error.txt
#---------------------------------------------------------------------#
# compile
#---------------------------------------------------------------------#
compile()
{
if eval 'make CGAL_MAKEFILE=$CGAL_MAKEFILE \
TESTSUITE_CXXFLAGS="$TESTSUITE_CXXFLAGS" \
TESTSUITE_LDFLAGS="$TESTSUITE_LDFLAGS" all' >compiler_output 2>&1 ; then
echo " succesful compilation " >> $ERRORFILE
cat compiler_output
else
echo " ERROR: compilation " >> $ERRORFILE
eval "2>&1 make CGAL_MAKEFILE=$CGAL_MAKEFILE clean > /dev/null "
eval 'make -k CGAL_MAKEFILE=$CGAL_MAKEFILE \
TESTSUITE_CXXFLAGS="$TESTSUITE_CXXFLAGS" \
TESTSUITE_LDFLAGS="$TESTSUITE_LDFLAGS" all'
fi
rm compiler_output
eval "2>&1 make CGAL_MAKEFILE=$CGAL_MAKEFILE clean > /dev/null "
}
#---------------------------------------------------------------------#
# remove the previous error file
#---------------------------------------------------------------------#
rm -f $ERRORFILE
touch $ERRORFILE
#---------------------------------------------------------------------#
# compile and run the tests
#---------------------------------------------------------------------#
compile
EOF
close(CGAL_TEST);
chmod 0755, "../test/${DIR}_Demo/cgal_test";
}
}
chdir '..';
}
#---------------------------------------------------------------#
# create cgal_test script in tests
#---------------------------------------------------------------#
sub create_test()
{
system("$DEVELSCRIPTSDIR/create_cgal_test") == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test failed";
}
#---------------------------------------------------------------#
# make_testscripts and generate makefiles in test and examples
#---------------------------------------------------------------#
@ -432,7 +369,13 @@ sub make_testscripts()
system("$SCRIPTSDIR/cgal_create_makefile", $options) == 0 or die "Execution of $SCRIPTSDIR/cgal_create_makefile failed";
}
if ( ! -f 'cgal_test' ) {
create_test();
$_ = $DIR;
# chomp;
if (/_Demo$/) {
system("$DEVELSCRIPTSDIR/create_cgal_test", "--no-run") == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test --no-run failed";
} else {
system("$DEVELSCRIPTSDIR/create_cgal_test") == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test failed";
}
}
chdir '..';
}