-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test manualexamples #1082
Test manualexamples #1082
Conversation
First stab at addressing #1076 |
@markuspf thanks. Have you seen my last comment in #1076 btw? Immediate remark: this
refers to lines in the test file. One should now go there to figure out from which source file this example is taken (if this is recorded at all). To the contrary, the current setup refers to the actual location of the manual example, avoiding such indirection. IMHO this is an important feature. |
@markuspf cf. |
c86fcba
to
ef42f42
Compare
Current coverage is 56.88% (diff: 100%)@@ master #1082 diff @@
==========================================
Files 433 434 +1
Lines 224901 224996 +95
Methods 3447 3447
Messages 0 0
Branches 0 0
==========================================
+ Hits 127806 127989 +183
+ Misses 97095 97007 -88
Partials 0 0
|
ef42f42
to
c9c7948
Compare
This is starting to look better after I hit it repeatedly with a hammer. |
This fragility is making me really sad. |
239fddb
to
10f9aa5
Compare
There are still a few tests that fail, maybe we should ignore these failures in travis and just add the improved coverage to codecov though. Feel free to chase up the remaining diffs... |
First, off: Thanks for working on this. As @alex-konovalov already pointed out, some of those test failures are spurious, either due to randomness, irrelevant side effects, etc. etc. I think we really should try to fix these properly. Becaue what Alex has been doing manually (i.e. curating the test results with a lot of manual work) simply does not scale. So, it would indeed be good if people could help to improve this. Some things that will help:
Hmm... Markus, could you perhaps hack this some more, and add two more travis tests, with (Note: I would try it on my local machine, but I am afraid that my set of packages is vastly different from what is bundled with GAP; in fact, for me |
It seems that a ton of diffs are also caused by Oh wait: You are not restarting GAP after every chapter, are you? That would explain a big bunch of these diffs... |
I am indeed not restarting GAP for every test. I have a hacked up version of TestDirectory that can use |
Just as a point, I've had to make a separate hack based on |
Well, if you have working code, fine.. though what I would do is create a shell script which loops over the test files and starts GAP with each of them. This could then also use a workspace to speed up things a bit. Of course a little bit extra work is needed if we don't want to abort the script after the first chapter with failures. This could then also be used on Windows (if we wanted to), while Anyway, whatever works is fine by me. |
|
||
# RS := rec(changeSources := true); | ||
# WS := rec(compareFunction := "uptowhitespace"); | ||
# WSRS := rec(changeSources := true, compareFunction := "uptowhitespace"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these comments about?
## | ||
|
||
# This code extracts the examples from manuals chapter-wise and | ||
# stores this in a workspace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does it store anything in a workspace?
Print("Extracting manual examples...\n"); | ||
Read(Filename(DirectoriesLibrary("doc/ref"), "makedocreldata.g")); | ||
|
||
GAPInfo.ManualDataRef.pathtodoc := DirectoriesLibrary("doc/ref"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick: DirectoriesLibrary("doc/ref");
occurs twice, perhaps reorder and use GAPInfo.ManualDataRef.pathtodoc
in the Read
? Not that it matters much...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course keeping the Read
as it is can be convenient when debugging this file, as it allows one to copy&paste that line into a GAP session.
So an alternative would be to get rid of GAPInfo.ManualDataRef.pathtodoc
(or is it used outside of this script). There is only one place here using it...
PrintTo(output, "#### Reference manual, Chapter ",i," ####\n", | ||
"gap> START_TEST(\"", chname, "\");\n"); | ||
for a in ch do | ||
AppendTo(output, "\n#LOC# ", a[2], a[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another minor nitpick: You switch between PrintTo
and AppendTo
. I think they do the same for streams anyway, but using both might confuse somebody who doesn't know that...
Read(Filename(DirectoriesLibrary("doc/ref"), "makedocreldata.g")); | ||
|
||
GAPInfo.ManualDataRef.pathtodoc := DirectoriesLibrary("doc/ref"); | ||
GAPInfo.ManualDataRef.pathtoroot := DirectoriesLibrary(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is not used at all, why set it at all?
Mostly these things are leftovers from banging my head against how to build manuals and examples. I am also not quite sure whether there is currently consensus on #1076 at all... |
@@ -33,6 +30,8 @@ WriteExamplesTst := function(directory) | |||
output := OutputTextFile( Concatenation(directory, "/", chname), false ); | |||
SetPrintFormattingStatus( output, false ); | |||
|
|||
# PrintTo will *overwrite* the file if it exists, making sure | |||
# we don't concatenate the same test into a file multiple times |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is incorrect. It is it the false
in the call to OutputTextFile
which takes care of that. Other than that, PRINT_TO_STREAM
and APPEND_TO_STREAM
are doing exactly the same thing (see PR #1093). Note that the GAP manual even states that PrintTo
and AppendTo
for streams both append -- of course, if you think about it, they have no other choice, since that's how streams work -- there is no way to "delete" the content of a stream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Orgh. Sorry, shows how much attention I paid reading the documentation (which I did), and remembering my code (which I obviously didn't).
fa4d7f5
to
bec76dd
Compare
@@ -10,7 +10,7 @@ matrix: | |||
after_success: | |||
- bash <(curl -s https://codecov.io/bash) | |||
- os: linux | |||
env: TEST_SUITE=testtravis CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="-fprofile-arcs" | |||
env: TEST_SUITE=testmanuals CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="-fprofile-arcs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be an additional travis run? I.e. not replace the testtravis run on Linux.
One of the test failures is fixed in master, another will be fixed by PR #1100. Might want to rebase once the latter is merged. And of course @alex-konovalov mentioned an upcoming alternate implementation, looking forward to that, too :-). |
@markuspf BTW, how about replacing that |
Also, the last test run for this died with this error on Travis:
|
bec76dd
to
3e19ab0
Compare
else | ||
case $TEST_SUITE in | ||
makemanuals) | ||
if [[ $TRAVIS_OS_NAME = 'linux' ]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason for this check? We only run makemanuals
on linux anyway, right?
then | ||
make manuals | ||
cat doc/*/make_manuals.out | ||
if [ `cat doc/*/make_manuals.out | grep -c "manual.lab written"` != '3' ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the use of cat
, and not just grep rep -c "manual.lab written doc/*/make_manuals.out
?
(Oh wait, that's old code, OK.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, but this must've been there before, copied and pasted through the centuries. I can change it though while I am at it.
for ch in tst/testmanuals/*.tst | ||
do | ||
COVNAME="coverage.`basename $ch .tst`" | ||
sh bin/gap.sh -q --cover $COVNAME <<GAPInput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my system with a new SSD, it takes 1.5 seconds to start GAP. Even if it's fully cached in RAM. I do not know how long it takes on Travis, but I wouldn't be surprised if it was slower there. We do this 80 times or so, hence just starting GAP that often costs us 2 minutes or more.
So I would really consider using a workspace here, like we do in the make
targets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better: You could move this call after the esac
, and loop over all coverage*
files in GAP. I.e. it would be the same code for the testmanuals
code as for all the other testFOO
targets.
done | ||
cd bin/x86* ; gcov -o . ../../src/* | ||
cd ../.. | ||
;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest moving these two commands after the esac
. It's always the same -- and it doesn't hurt if we run it for the makemanuals
target, too does it?
cd ../.. | ||
fi; | ||
|
||
sh bin/gap.sh -q <<GAPInput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, we call gap twice per iteration? Then it is 4 minutes :-).
Though perhaps we could move this second invocation out of the loop, turning it into a single invocation, where GAP loops over the coverage.*.tst
files? This way, we turn ~80 GAP starts into a single one.
OutputJsonCoverage("coverage", "coverage.json"); | ||
for ch in tst/testmanuals/*.tst | ||
do | ||
COVNAME="coverage.`basename $ch .tst`" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, why the tst suffix? That would suggest the files are .tst
files, which they are not, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify this is to remove the tst suffix from the chapterX.tst
filename (which are .tst
files) to make a filename for a coverage file which then is not a .tst
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are of course right, I misparsed this, sorry
315fe8d
to
4727bf2
Compare
This should be ready now. Test fails until #1106 is merged. |
4727bf2
to
526885e
Compare
@@ -63,3 +63,7 @@ | |||
|
|||
/tags | |||
/src/TAGS | |||
src/TAGS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just find it strange that all paths above start with /
and paths below without /
, and we have both tags
and tags
.
526885e
to
6177b24
Compare
* Extracts the examples from the reference manual chapter by chapter into separate `.tst` files * Runs each of the created `.tst` files in a separate GAP process * Creates coverage reports, which are uploaded to codecov.io.
6177b24
to
421cf25
Compare
This is not yet finished, and rather hacky. Feel free to comment though.
At the moment a lot of the tests fail because of screen width problems etc.