Skip to content

Commit

Permalink
Merge pull request #1072: Remove GAP stones
Browse files Browse the repository at this point in the history
Remove GAP stones
  • Loading branch information
markuspf authored Jan 25, 2017
2 parents fb590a5 + e70c579 commit 34f3178
Show file tree
Hide file tree
Showing 70 changed files with 801 additions and 1,286 deletions.
25 changes: 16 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ env:

matrix:
include:
# 64bit linux builds with GCC
- os: linux
env: TEST_SUITE=testinstall
compiler: gcc
Expand All @@ -21,20 +22,16 @@ matrix:
apt_packages:
- libgmp-dev

# OS X builds: since those are slow and limited on Travis,
# we only run testinstall for now
- os: osx
env: TEST_SUITE=testtravis
env: TEST_SUITE=testinstall
compiler: clang
addons:
apt_packages:
- libgmp-dev

- os: linux
env: TEST_SUITE=testbugfix
compiler: gcc
addons:
apt_packages:
- libgmp-dev

# test creating the manual
- os: linux
env: TEST_SUITE=makemanuals
compiler: gcc
Expand All @@ -47,10 +44,20 @@ matrix:
- texlive-extra-utils
- texlive-fonts-recommended
- texlive-fonts-extra

# 32bit linux builds with GCC
- os: linux
env: TEST_SUITE=testinstall ABI=32
compiler: gcc
addons:
apt_packages:
- libgmp-dev:i386
- gcc-multilib

- os: linux
env: TEST_SUITE=testtravis ABI=32
compiler: gcc
addons:
addons:
apt_packages:
- libgmp-dev:i386
- gcc-multilib
Expand Down
14 changes: 7 additions & 7 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,23 +322,23 @@ should give the following lines:

If you want to run a quick test of your GAP installation (though this is
not required), you can read in a test script that exercises some GAP's
capabilities. The test requires about 1 GB of memory and runs about one
minute on an Intel Core 2 Duo / 2.53 GHz machine. You will get a large
capabilities. The test requires about 1 GB of memory and should run in
under a minute on an up-to-date desktop computer. You will get a large
number of lines with output about the progress of the tests, for example:

gap> Read( Filename( DirectoriesLibrary( "tst" ), "testinstall.g" ) );

test file GAP4stones time(msec)
test file time(msec)
-------------------------------------------
testing: ..../gap4rX/tst/testinstall/flush.tst
flush.tst 0 57
flush.tst 57
testing: ..../gap4rX/tst/testinstall/varargs.tst
varargs.tst 0 51
varargs.tst 51
[ further lines deleted ]
testing: ..../gap4rX/tst/testinstall/grppcnrm.tst
grppcnrm.tst 9668 14071
grppcnrm.tst 14071
-------------------------------------------
total 8317 44347
total 44347

#I No errors detected while testing

Expand Down
9 changes: 1 addition & 8 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
## and once with all packages loaded. The results are logged to the
## subdirectory `dev/log/'.
##
## The "teststandardrenormalize" target:
## - starts GAP, reads all files `tst/*.tst', and replaces the scaling
## factors in the `STOP_TEST' statements
##
## The "testpackages" target:
## - runs the tests provided by the available packages
##
Expand Down Expand Up @@ -259,9 +255,6 @@ teststandard: compile
ReadGapRoot( "tst/teststandard.g" );' | $(TESTGAP) | \
tee `date -u +dev/log/teststandard2_%Y-%m-%d-%H-%M` )

teststandardrenormalize: compile
( echo 'TestDirectory("tst", rec(renormaliseStones := true));' | $(TESTGAP) )

testpackages: compile
mkdir -p dev/log
( echo 'SetAssertionLevel( 2 ); ReadGapRoot( "tst/testutil.g" ); \
Expand Down Expand Up @@ -499,7 +492,7 @@ tags:

.PHONY: clean clean_$(CLEANME) clean_gap clean_gap_$(CLEANME) clean_gmp clean_gmp_$(CLEANME) distclean
.PHONY: compile config default extern manuals packages rebuild removewin setconfig static strip
.PHONY: testinstall testinstall.g testmanuals testpackages testpackagesload testpackagesvars teststandard teststandardrenormalize
.PHONY: testinstall testinstall.g testmanuals testpackages testpackagesload testpackagesvars teststandard
.PHONY: cygwin removewin winbinp
.PHONY: bootstrap-pkg-minimal bootstrap-pkg-full
.PHONY: check tags
3 changes: 0 additions & 3 deletions dev/manualchapters
Original file line number Diff line number Diff line change
Expand Up @@ -1897,9 +1897,6 @@ look worse than others)
+1AK,JJM Installation instructions still refers to zoo archives, explains how
to get GAP for Mac OS and does not reflect recent changes in the build
process (gmp and readline options) - this should be cleaned up.
+1AK Related issue: update number of GAP4stones in testinstall.g and testall.g
(a preliminary update has been already made by AK after GAP 4.5.2, do
another one before the final release)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Chapter 76: GAP Packages
% File: ./gappkg.xml (line 11)
Expand Down
7 changes: 1 addition & 6 deletions doc/dev/testing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,7 @@ The following additional issues are related to testing
when a new version of ⪆ is to be released.
<List>
<Item>
Use renormaliseStones option of TestDirectory to
run the standard tests and renormalize the scaling factors in the
<C>STOP_TEST</C> statements of the files in the <C>tst</C> directory.
</Item>
<Item>
After these updates, repeat all tests.
Run all tests.
</Item>
</List>
</Section>
Expand Down
6 changes: 3 additions & 3 deletions doc/ref/debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,12 @@ found in the <F>tst</F> directory of the &GAP; distribution.
<#Include Label="[1]{testinstall.g}">

<Log><![CDATA[
test file GAP4stones time(msec)
test file time(msec)
-------------------------------------------
testing: ................/gap4r5/tst/zlattice.tst
zlattice.tst 0 0
zlattice.tst 0
testing: ................/gap4r5/tst/gaussian.tst
gaussian.tst 0 10
gaussian.tst 10
[ further lines deleted ]
]]></Log>

Expand Down
20 changes: 5 additions & 15 deletions lib/profile.g
Original file line number Diff line number Diff line change
Expand Up @@ -1023,13 +1023,13 @@ end);
#############################################################################
##
#F START_TEST( <id> ) . . . . . . . . . . . . . . . . . . . start test file
#F STOP_TEST( <file>, <fac> ) . . . . . . . . . . . . . . . stop test file
#F STOP_TEST( <file> ) . . . . . . . . . . . . . . . . . . . stop test file
##
## <#GAPDoc Label="StartStopTest">
## <ManSection>
## <Heading>Starting and stopping test</Heading>
## <Func Name="START_TEST" Arg='id'/>
## <Func Name="STOP_TEST" Arg='file, fac'/>
## <Func Name="STOP_TEST" Arg='file'/>
##
## <Description>
## <Ref Func="START_TEST"/> and <Ref Func="STOP_TEST"/> may be optionally
Expand All @@ -1052,16 +1052,10 @@ end);
## and should be finished with a line
## <P/>
## <Log><![CDATA[
## gap> STOP_TEST( "filename", 10000 );
## gap> STOP_TEST( "filename" );
## ]]></Log>
## <P/>
## Here the string <C>"filename"</C> should give the name of the test file.
## The number is a proportionality factor that is used to output a
## <Q>&GAP;stone</Q> speed ranking after the file has been completely
## processed.
## For the files provided with the distribution this scaling is roughly
## equalized to yield the same numbers as produced by the test file
## <F>tst/combinat.tst</F>.
## <P/>
## Note that the functions in <F>tst/testutil.g</F> temporarily replace
## <Ref Func="STOP_TEST"/> before they call <Ref Func="Test"/>.
Expand All @@ -1086,7 +1080,7 @@ START_TEST := function( name )
fi;
end;

STOP_TEST := function( file, fac )
STOP_TEST := function( file, args... )
local time;

if not IsBound( GAPInfo.TestData.START_TIME ) then
Expand All @@ -1095,11 +1089,7 @@ STOP_TEST := function( file, fac )
fi;
time:= Runtime() - GAPInfo.TestData.START_TIME;
Print( GAPInfo.TestData.START_NAME, "\n" );
if time <> 0 and IsInt( fac ) then
Print( "GAP4stones: ", QuoInt( fac, time ), "\n" );
else
Print( "GAP4stones: infinity\n" );
fi;
Print( "msecs: ", time, "\n" );
SetAssertionLevel( GAPInfo.TestData.AssertionLevel );
SetInfoLevel( InfoPerformance, GAPInfo.TestData.InfoPerformanceLevel );
Unbind( GAPInfo.TestData.AssertionLevel );
Expand Down
125 changes: 14 additions & 111 deletions lib/test.gi
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,6 @@ end);
## <Item>Rather than returning <K>true</K> or <K>false</K>, exit GAP with the return value
## of GAP set to success or fail, depending on if all tests passed (defaults to <K>false</K>).
## </Item>
## <Mark><C>stonesLimit</C></Mark>
## <Item>Only try tests which take less than <C>stonesLimit</C> stones (defaults to infinity)</Item>
## <Mark><C>renormaliseStones</C></Mark>
## <Item>Re-normalise the stones number given in every tst files's 'STOP_TEST'</Item>
## </List>
##
## </Description>
Expand All @@ -544,72 +540,21 @@ end);
## suppressStatusMessage := false: do not print status messages after the test
## recursive := true : Search through directories recursively
## exitGAP := false : Exit GAP, setting exit value depending on if tests succeeded
## stonesLimit := infinity: Set limit (in GAPstones) on longest test to be run.
## renormaliseStones := false: Edit tst files to re-normalise the gapstones stored in every file.
##
##

InstallGlobalFunction( "TestDirectory", function(arg)
local basedirs, nopts, opts, files, newfiles, filestones, filetimes,
f, c, i, recurseFiles, StringEnd, getStones, setStones,
startTime, time, stones, testResult, testTotal,
totalTime, totalStones, STOP_TEST_CPY, stopPos,
count, prod;

local basedirs, nopts, opts, files, newfiles, filetimes,
f, c, i, recurseFiles,
startTime, time, testResult, testTotal,
totalTime, STOP_TEST_CPY;

testTotal := true;
totalTime := 0;
totalStones := 0;
count := 0;
prod := 1;

STOP_TEST_CPY := STOP_TEST;
STOP_TEST := function(arg) end;

StringEnd := function(str, postfix)
return Length(str) >= Length(postfix) and str{[Length(str)-Length(postfix)+1..Length(str)]} = postfix;
end;

getStones := function(file)
local lines, l, start, finish, stones;

lines := SplitString(StringFile(file.name),"\n");
for l in lines do
if PositionSublist(l, "STOP_TEST") <> fail then
# Try our best to get the stones out!
start := PositionSublist(l, ",");
finish := PositionSublist(l, ")");
stones := EvalString(l{[start+1..finish-1]});
if IsInt(stones) then
return stones;
fi;
fi;
od;
return 0;
end;

setStones := function(file, newstones)
local lines, l, start, finish, stones;
lines := SplitString(StringFile(file.name), "\n");
for i in [1..Length(lines)] do
if PositionSublist(lines[i], "STOP_TEST") <> fail then
# Try our best to get the stones out!
start := PositionSublist(lines[i], ",");
finish := PositionSublist(lines[i], ")");
stones := EvalString(lines[i]{[start+1..finish-1]});
if IsInt(stones) then
lines[i] := Concatenation(lines[i]{[1..start]}," ",String(newstones),
lines[i]{[finish..Length(lines[i])]});
FileString(file.name, Concatenation(List(lines, x -> Concatenation(x,"\n"))));
else
Print("Unable to parse STOP_TEST in ", file.name);
fi;
fi;
od;
end;



if IsString(arg[1]) or IsDirectory(arg[1]) then
basedirs := [arg[1]];
else
Expand All @@ -628,8 +573,6 @@ InstallGlobalFunction( "TestDirectory", function(arg)
showProgress := true,
suppressStatusMessage := false,
exitGAP := false,
stonesLimit := infinity,
renormaliseStones := false
);

for c in RecFields(nopts) do
Expand Down Expand Up @@ -657,7 +600,9 @@ InstallGlobalFunction( "TestDirectory", function(arg)
Add(testrecs, rec(name := t, shortName := shortName));
od;
Append(files, testrecs);
recursedirs := Filtered(dircontents, x -> IsDirectoryPath(x) and not(StringEnd(x,"/.")) and not(StringEnd(x,"/..")));
recursedirs := Filtered(dircontents, x -> IsDirectoryPath(x)
and not EndsWith(x,"/.")
and not EndsWith(x,"/.."));
for d in recursedirs do
recurseFiles(d, basedir);
od;
Expand All @@ -676,22 +621,10 @@ InstallGlobalFunction( "TestDirectory", function(arg)
fi;
od;

filestones := List(files, getStones);

# Sort fastest to slowest
SortParallel(filestones, files);

stopPos := PositionProperty(filestones, x -> x >= opts.stonesLimit);
if stopPos <> fail then
filestones := filestones{[1..stopPos-1]};
files := files{[1..stopPos-1]};
fi;


SortBy(files, f -> f.name);

if opts.showProgress then
Print( "Architecture: ", GAPInfo.Architecture, "\n\n",
"test file GAP4stones time(msec)\n",
"-------------------------------------------\n" );
Print( "Architecture: ", GAPInfo.Architecture, "\n\n" );
fi;

for i in [1..Length(files)] do
Expand All @@ -716,48 +649,18 @@ InstallGlobalFunction( "TestDirectory", function(arg)

time := Runtime() - startTime;
filetimes[i] := time;
if time > 100 and filestones[i] > 1000 then
stones := QuoInt(filestones[i], time);
totalTime := totalTime + time;
totalStones := totalStones + filestones[i];
prod := prod * stones;
count := count + 1;
else
stones := 0;
fi;
totalTime := totalTime + time;

if opts.showProgress then
Print( String( files[i].shortName, -20 ),
String( stones, 8 ),
String( time, 15 ) );
if i < Length(filestones) and filestones[i+1] > 0 and totalTime > 0 then
#Print(totalTime,":", filestones[i+1],":" ,10^3,":",totalStones,":" );
Print(" ( next ~", Int( (totalTime * filestones[i+1] )/10^3/totalStones), " sec )" );
fi;
Print("\n");
Print( String( time, 8 ), " msec for ", files[i].shortName, "\n" );
fi;
od;

STOP_TEST := STOP_TEST_CPY;

Print("-------------------------------------------\n");
if count = 0 then
count:= 1;
fi;
Print("-----------------------------------\n");
Print( "total",
String( RootInt( prod, count ), 23 ),
String( totalTime, 15 ), "\n\n" );


if opts.renormaliseStones then
for i in [1..Length(files)] do
if filetimes[i] < 5 then
setStones(files[i], 1);
else
setStones(files[i], filetimes[i] * 10000);
fi;
od;
fi;
String( totalTime, 8 ), " msec\n\n" );

if not opts.suppressStatusMessage then
if testTotal then
Expand Down
Loading

0 comments on commit 34f3178

Please sign in to comment.