Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created September 27, 2017 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/eff5c8f024685c7b3857e0ab8a94d7e2 to your computer and use it in GitHub Desktop.
Save zoffixznet/eff5c8f024685c7b3857e0ab8a94d7e2 to your computer and use it in GitHub Desktop.
#!/bin/bash
# print out the commands we run and bail out on failures
set -x
set -e
# Check out rakudo into ~/coverakudo. You can change it to any dir you want
rm -fr ~/CPANPRC/coverakudo
git clone https://github.com/rakudo/rakudo ~/CPANPRC/coverakudo
# go to that dir
cd ~/CPANPRC/coverakudo
# Configure
perl Configure.pl --gen-moar --gen-nqp --backends=moar
# Disable the optimizer, so routines we want don't get optimized away
perl -pi -e 's/--optimize=\K3/off/' Makefile
# Build Rakudo
make
# Install Rakudo
make install
# Go to MoarVM dir
#cd nqp/MoarVM
# Check out the branch with coverage support
# git checkout $(git branch -r | grep origin/line_based_coverage | tail -n1)
#rm -fr 3rdparty/libtommath; # remove faulty thing
#git checkout line_based_coverage_pr
# Bring in any latest MoarVM changes from master
#git pull --rebase https://github.com/MoarVM/MoarVM/
# Configure MoarVM
#perl Configure.pl --prefix=../../install/
# Build MoarVM
#make
# Install MoarVM
#make install
# Go back to rakudo dir
#cd ../..
# Just check that we've got coverage now. Should say "WE SUCCEEDED!!"
install/bin/moar --help | grep MVM_COVERAGE_LOG &&
echo 'We SUCCEEDED!!' ||
{ echo 'WE FAILED!!!!'; exit 1; }
# The following steps download `panda` package manager and install
# Inline::Perl5 module that we need for Rakudo stress testing. You may need
# a specially-built Perl 5 for it. You can use `perlbrew` to obtain it.
# See instructions at https://github.com/niner/Inline-Perl5#building
git clone https://github.com/ugexe/zef
export PATH=`pwd`/install/bin:$PATH
cd zef; perl6 -Ilib bin/zef install .
cd ..
export PATH=`pwd`/install/share/perl6/site/bin:$PATH
zef install Inline::Perl5
# Delete coverage directory, if it's there already
rm -fr coverage
# Create coverage dir; we'll store our coverage report here
mkdir coverage
# Turn off auto-bail-out, since stresstests may fail and that's OK
set +e
# Run stresstest. The MVM_COVERAGE_LOG var tells MoarVM where to store
# coverage report files; the `%d` in the filename is necessary to store
# the process IDs of running tests!
export MVM_COVERAGE_LOG='coverage/cover-%d'
make test
make test
make test
prove -e './perl6 -Ilib' t/02-rakudo/07-io-cathandle.t
prove -e './perl6 -Ilib' t/02-rakudo/07-io-cathandle.t
prove -e './perl6 -Ilib' t/02-rakudo/07-io-cathandle.t
make stresstest
make stresstest
make stresstest
#########################
## Note: at least on my box, some stresstest flapped and exited early,
## because apparently disabling the optimizer changes the test results.
## For that reason, to get full coverage either run the stresstest
## several times, or run individual failing test files a few times with
## MVM_COVERAGE_LOG='coverage/cover-%d' make t/spec/THE-TEST-FILE.t
## some test files may end with `.rakudo.moar` extension. Change it to `.t`
#########################
# Bail out on fail
set -e
# Go into directory with all the coverage files
cd coverage
# Find entries we want, make sure they're unique, and store them all in
# a file. This step may take awhile to run, especially if you ran the
# entire stresstest several times
cat * | grep -F 'SETTING::' | sort | uniq > full-cover
rm cover-*
# Go back up
cd ../
# Generate the setting annotations
install/bin/moar --dump CORE.setting.moarvm > setting
# Run the coverage report
./perl6 nqp/MoarVM/tools/parse_coverage_report.p6 \
--annotations=setting coverage/full-cover gen/moar/CORE.setting
scp -r coverage/* zoffix@perl6.party:/var/www/perl6.wtf/web/
# It's ready! All of the files are in coverage/ directory and you can
# start viewing them by opening coverage/index.html in your favourite browser
firefox coverage/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment