diff --git a/cice.setup b/cice.setup index d70aece61..f7ff12bd6 100755 --- a/cice.setup +++ b/cice.setup @@ -504,11 +504,18 @@ EOF0 cat >! ${tsdir}/report_codecov.csh << EOF0 #!/bin/csh -f -#setenv CODECOV_TOKEN "1d09241f-ed9e-47d8-847c-038bab024b53" # consortium cice -#setenv CODECOV_TOKEN "f3236008-0b92-4707-9ad5-ad906f5d2ba7" # apcraig cice -setenv CODECOV_TOKEN "0dcc6066-fdce-47b6-b84a-c55e2a0af4c0" # apcraig test_cice_icepack -set report_name = "${shhash}:${branch}:${machine} ${testsuite}" +# define CODECOV_TOKEN env variable +if !(\$?CODECOV_TOKEN) then + if (-e ~/.codecov_cice_token) then + source ~/.codecov_cice_token + endif + if !(\$?CODECOV_TOKEN) then + echo "\${0}: ERROR, CODECOV_TOKEN env variable not defined" + exit 2 + endif +endif +set report_name = "${shhash}:${branch}:${machine} ${testsuite}" set use_curl = 1 EOF0 diff --git a/configuration/scripts/tests/cice_test_codecov.csh b/configuration/scripts/tests/cice_test_codecov.csh new file mode 100755 index 000000000..0b2d970ec --- /dev/null +++ b/configuration/scripts/tests/cice_test_codecov.csh @@ -0,0 +1,75 @@ +#!/bin/csh + +# This was a script on gordon +# This script should only be run on hardware with the gnu compiler with a +# modified Macros file to turn on the codecov flags +# This should be run interactively because git push will require login information + +#PBS -N cice_test +#PBS -q standard +#PBS -A NRLSS03755018 +#PBS -l application=Regional-Arctic-System-Model +#PBS -l select=1:ncpus=32:mpiprocs=32 +#PBS -l walltime=24:00:00 +#PBS -j oe +#PBS -M anthony.p.craig@gmail.com +#PBS -m be + +#set verbose +module load costinit git + +set scrdir = "~" +set testdir = "~/cice_testing" +set date0 = `date -u "+%y%m%d"` +set date = ${date0}cc + +mkdir -p ${testdir} + +cd ${testdir} + +# Check out current cice master +echo " " +echo "*** checkout current cice master ***" +git clone https://github.com/cice-consortium/cice cice.master.${date} --recursive +cd cice.master.${date} +set hash = `git rev-parse --short HEAD ` +cd ../ + +# Check out test_cice_icepack, remove all code and copy from cice master +# Need to be careful about dot files, particularly .git* files +# This copies in all files via standard file expansion (except dot files at root) +# This also copies in all dot file at the root that do not start with .g (ie. .git*) +echo " " +echo "*** checkout current test_cice_master ***" +git clone https://github.com/apcraig/test_cice_icepack test_cice_icepack.${date} +cd test_cice_icepack.${date} +echo " " +echo "*** remove current files and copy in cice master files ***" +set verbose +git rm -r * >& /dev/null +cp -p -r ../cice.master.${date}/* . +cp -p ../cice.master.${date}/.[a-f,h-z]* . + +# Clean up icepack .git stuff and commit +rm -r -f icepack/.git* +git add . +unset verbose +echo " " +echo "*** git status of changes ***" +git status +echo " " +echo "*** commit changes ***" +git commit -m "update test_cice_icepack master to ${hash}" + +# Push test_cice_icepack +echo " " +echo "*** push changes to test_cice_icepack ***" +git push origin master + +# Run test suite +echo " " +echo "*** run test suite ***" +./cice.setup --suite first_suite,base_suite,travis_suite,decomp_suite,reprosum_suite,quick_suite -m gordon -e gnu --testid T${date} --codecov --queue standard + +# The test suite will wait until all jobs are complete then run report_codecov.csh +# If that fails, you can run report_codecov.csh manually after all jobs are done diff --git a/doc/source/user_guide/ug_testing.rst b/doc/source/user_guide/ug_testing.rst index 52621d612..04b82a401 100644 --- a/doc/source/user_guide/ug_testing.rst +++ b/doc/source/user_guide/ug_testing.rst @@ -668,32 +668,25 @@ Code Coverage Testing The ``--codecov`` feature in **cice.setup** provides a method to diagnose code coverage. This argument turns on special compiler flags including reduced optimization and then invokes the gcov tool. -This option is currently only available with the gnu compiler and on a few systems. +This option is currently only available with the gnu compiler and on a few systems +with modified Macros files. Because codecov.io does not support git submodule analysis right now, a customized repository has to be created to test CICE with Icepack integrated directly. The repository https://github.com/apcraig/Test_CICE_Icepack serves as the current default test repository. In general, to setup the code coverage test in CICE, the current CICE master has -to be copied into the Test_CICE_Icepack repository, then the code coverage tool can -be run on that repository. A sample script to do that would be:: +to be copied into the Test_CICE_Icepack repository, then the full test suite +can be run with the gnu compiler with the ``--codecov`` argument. - git clone https://github.com/cice-consortium/cice cice.master --recursive - - git clone https://github.com/apcraig/test_cice_icepack - cd test_cice_icepack - git rm -r * - cp -p -r ../cice.master/* . - git add . - git commit -m "update to current cice master" - git push origin master - - ./cice.setup --suite first_suite,base_suite,travis_suite,decomp_suite,reprosum_suite,quick_suite -m gordon -e gnu --codecov --testid cc01 - -To use, submit a full test suite using an updated Test_CICE_Icepack version -and the gnu compiler with the ``--codecov`` argument. The test suite will run and then a report will be generated and uploaded to the `codecov.io site `_ by the -**report_codecov.csh** script. +**report_codecov.csh** script. The env variable CODECOV_TOKEN needs to be defined +either in the environment or in a file named **~/.codecov_cice_token**. That +token provides write permission to the Test_CICE_Icepack codecov.io site and is available +by contacting the Consortium team directly. + +A script that carries out the end-to-end testing can be found in +**configuration/scripts/tests/cice_test_codecov.csh** This is a special diagnostic test and does not constitute proper model testing. General use is not recommended, this is mainly used as a diagnostic to periodically