Skip to content

Conversation

@olexandr-konovalov
Copy link
Member

This is in response to the issue #637 by @ChrisJefferson.

This PR adds two ways of testing a GAP package.

The first is called from the shell using

make testpackage PKGNAME=packagename

This is as maximally close to the setting in which we run regression tests as possible - the difference is of course in the local version of GAP and the selection of package. Otherwise, it will run the test three times, each in a new GAP session (without/default/all packages), with assertion level 2, and will produce three log files in the dev/log directory.

The second may be called from the GAP prompt via

TestPackage("pkgname");

In this case assertion level will not be changed, and the test will run only once in the current GAP session.

I've labeled this "DO NOT MERGE" since I should also document this before merging, but I'm submitting the code to get some feedback.

Usage:
make testpackage PKGNAME=<pkgname>

This will run standard tests of the package <pkgname> in the same
way like we run them in our regression testing (though with the
user's selection of packages that may be different). It will write
test output to 3 log files dev/log/testpackageX_timestamp.pkgname
where X=1 with no packages, 2 with all packages and A with default
packages.
@olexandr-konovalov olexandr-konovalov added topic: tests issues or PRs related to tests do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) labels Feb 28, 2016
@olexandr-konovalov
Copy link
Member Author

Example: testing a package with .g file using 'make testpackage':

$ make testpackage PKGNAME=circle
mkdir -p dev/log
( echo 'SetAssertionLevel( 2 ); ReadGapRoot( "tst/testutil.g" ); \
            SaveWorkspace( "wsp.g" );' | ./bin/gap-default64.sh -b -m 100m -o 1g -A -q -x 80 -r  )
true
( echo 'CreatePackageTestsInput( "testpackage.in", \
            "dev/log/testpackage1", \
            "./bin/gap-default64.sh -b -m 100m -o 1g -A -q -x 80 -r  -L wsp.g", "false", "circle" );'\
            | ./bin/gap-default64.sh -b -m 100m -o 1g -A -q -x 80 -r  -L wsp.g > /dev/null )
( chmod 777 testpackage.in; ./testpackage.in; rm testpackage.in )
Testing circle 1.5.4, test=/Users/alexk/GITREPS/gap-fork/pkg/circle/tst/testall.g, all packages=false
( rm wsp.g )
( echo 'SetAssertionLevel( 2 ); ReadGapRoot( "tst/testutil.g" ); \
            SaveWorkspace( "wsp.g" );' | ./bin/gap-default64.sh -b -m 100m -o 1g -q -x 80 -r  )
true
( echo 'CreatePackageTestsInput( "testpackage.in", \
            "dev/log/testpackageA", \
            "./bin/gap-default64.sh -b -m 100m -o 1g -q -x 80 -r  -L wsp.g", "auto", "circle" );'\
            | ./bin/gap-default64.sh -b -m 100m -o 1g -q -x 80 -r  -L wsp.g > /dev/null )
( chmod 777 testpackage.in; ./testpackage.in; rm testpackage.in )
Testing circle 1.5.4, test=/Users/alexk/GITREPS/gap-fork/pkg/circle/tst/testall.g, all packages=auto
( rm wsp.g )
( echo 'SetAssertionLevel( 2 ); ReadGapRoot( "tst/testutil.g" ); \
            SaveWorkspace( "wsp.g" );' | ./bin/gap-default64.sh -b -m 100m -o 1g -A -q -x 80 -r  )
true
( echo 'CreatePackageTestsInput( "testpackage.in", \
            "dev/log/testpackage2", \
            "./bin/gap-default64.sh -b -m 100m -o 1g -A -q -x 80 -r  -L wsp.g", "true", "circle" );'\
            | ./bin/gap-default64.sh -b -m 100m -o 1g -A -q -x 80 -r  -L wsp.g > /dev/null )
( chmod 777 testpackage.in; ./testpackage.in; rm testpackage.in )
Testing circle 1.5.4, test=/Users/alexk/GITREPS/gap-fork/pkg/circle/tst/testall.g, all packages=true
( rm wsp.g )

@olexandr-konovalov
Copy link
Member Author

Example: testing a package with .tst file using TestPackage:

gap> TestPackage("cohomolo");
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Loading  cohomolo 1.6.4 (Computing Cohomology groups and Schur Multipliers)
by Derek Holt (http://homepages.warwick.ac.uk/staff/D.F.Holt/).
Homepage: https://gap-packages.github.io/cohomolo
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
testall.tst
GAP4stones: 119
#I  No errors detected while testing package cohomolo version 1.6.4
#I  using the test file `/Users/alexk/GITREPS/gap-fork/pkg/cohomolo-1.6.4/tst/testall.tst'

@markuspf
Copy link
Member

markuspf commented Mar 3, 2016

This looks good to me.

@olexandr-konovalov olexandr-konovalov removed the do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) label Mar 4, 2016
@olexandr-konovalov
Copy link
Member Author

Thanks @markuspf. I've now added the documentation, so I think this is ready for merge.

markuspf added a commit that referenced this pull request Mar 7, 2016
TestPackage function and 'testpackage' make target
@markuspf markuspf merged commit b081f9d into gap-system:stable-4.8 Mar 7, 2016
@olexandr-konovalov olexandr-konovalov added this to the GAP 4.8.3 milestone Mar 7, 2016
@olexandr-konovalov olexandr-konovalov deleted the test-one-package branch March 17, 2016 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: tests issues or PRs related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants