Skip to content

Create an usable tool for local hash testing

Dr. Jaska requested to merge drjaska/hashtest into master

This branch copies current sv_game gitlab pipeline from .gitlab-ci.yml into a separate shell script which can be ran locally on UNIX systems. Tested ~100 times on Debian Testing and it seems to accurately replicate Gitlab CI's results.

.gitlab-ci.yml doesn't house shell commands for sv_game hashtest anymore, it now just calls this script with an exported expected hash value.

The script has slight modifications to the flow. It first tests all executable dependencies, defines a cleanup function and uses signal handling to run it on EXIT INTerrupt QUIT TERMinate. Instead of downloading pre-built binaries or cloning engine and gmqcc into xonotic-data.pk3dir it downloads/clones them into xonotic-data.pk3dir/.tmp/ which will clean itself when git cleans ignored files. If they are not cleaned before the script is reran then they are re-used if the binaries' creation date is current day. If not they are redownloaded or existing repositories are updated and recompiled. The script parses the expected hash from .gitlab-ci.yml if no EXPECT env var has been exported so hashes do not need to be updated in 2 places. Afterwards the hash prints at the very end now have colors green for matching hashes and red for unmatching hashes, no need to look at return code or compare number by number. All downloaded files are cached for a day to prevent unnecessary network traffic or even getting rate limited due to frequent testing.

Edited by Dr. Jaska

Merge request reports