Skip to content

Commit

Permalink
Switch testing tool to fhtagn #8 + updated GoAWK + fixed Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Jun 1, 2023
1 parent 8e30aa7 commit 6e961ac
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 33 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/run-tests.yml
Expand Up @@ -8,9 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0 ]
# os: [ macos-10.15 ]
# os: [ ubuntu-18.04, ubuntu-20.04, macos-11.0 ]
os: [ ubuntu-20.04, ubuntu-22.04, macos-11.0, macos-12, macos-13 ]
steps:
- uses: actions/checkout@v2

Expand Down
55 changes: 25 additions & 30 deletions Makesurefile
@@ -1,35 +1,33 @@
# vim: syntax=bash
@options timing

@define TUSH_REPO='https://github.com/adolfopa/tush'
@define FHTAGN_VERSION='520262aa81bdd22f75ae0c93fe99acbbb5ae92c4'
@define FHTAGN_URL="https://github.com/xonixx/fhtagn/raw/$FHTAGN_VERSION/fhtagn.awk"
@define JSONTestSuite_REPO='https://github.com/nst/JSONTestSuite'
@define GOAWK_VERSION='1.21.0'
@define GOAWK_VERSION='1.22.0'
@define GOAWK="goawk$GOAWK_VERSION"
@define AWK='awk'

@goal soft_folder_created @private
@reached_if [[ -d "soft" ]]
mkdir soft

@goal tush_installed @private
@depends_on soft_folder_created
@reached_if [[ -f "soft/tush/bin/tush-check" ]]
echo
echo "Fetching tush..."
echo

cd "soft"
@define FHTAGN="soft/fhtagn.awk"

@goal fhtagn_installed @private
@depends_on soft_folder_created
@reached_if [[ -x "$FHTAGN" ]]
if command -v wget >/dev/null
then
wget $TUSH_REPO/archive/master.tar.gz -O./tush.tar.gz
tar xzvf ./tush.tar.gz
rm ./tush.tar.gz
mv tush-master tush
wget "$FHTAGN_URL" -O"$FHTAGN"
elif command -v curl >/dev/null
then
curl -L "$FHTAGN_URL" -o "$FHTAGN"
else
git clone --depth 1 $TUSH_REPO.git
rm -r tush/.git
echo "can't dl fhtagn"
exit 2
fi
chmod +x "$FHTAGN"

@goal JSONTestSuite_installed @private
@depends_on soft_folder_created
Expand All @@ -49,9 +47,6 @@
@depends_on JSONTestSuite_installed
./run_json_test_suit.awk

@goal soft_installed @private
@depends_on tush_installed

@goal cleaned_soft @private
@reached_if [[ ! -d "soft" ]]
rm -r "soft"
Expand All @@ -69,14 +64,13 @@
bash --version| head -n 1

@goal prepared4tests @private
@depends_on tush_installed debug
@depends_on fhtagn_installed debug

@lib
run_tush() {
run_test_file() {
local f="$1"
export PATH="$PATH:$MYDIR/soft/tush/bin"

if DIFF="diff --strip-trailing-cr" tush-check "$f"
if "./$FHTAGN" "$f"
then
echo "TESTS PASSED : $f"
else
Expand All @@ -88,32 +82,33 @@
@goal @glob '*.tush' @private
@depends_on prepared4tests
@use_lib
run_tush "$ITEM"
run_test_file "$ITEM"

@goal tested_json_suite
@doc tests json suite
@doc 'tests json suite'
@depends_on prepared4tests
@depends_on JSONTestSuite_installed
@use_lib
run_tush "run_json_test_suit.tush.txt"
run_test_file "run_json_test_suit.tush.txt"

@goal tested
@doc run tests
@doc 'run tests'
@depends_on '*.tush'

@define COVERPROFILE="/tmp/cov.txt"

@goal cov_deleted @private
rm -f "$COVERPROFILE"

@goal tested_cov
@goal coverage
@doc 'run tests with coverage'
@depends_on installed_goawk
@depends_on cov_deleted
./makesure tested -D AWK="/home/xonix/proj/goawk/goawk -covermode=set -coverappend -coverprofile=$COVERPROFILE"
./makesure tested -D AWK="$(pwd)/soft/$GOAWK -covermode=set -coverappend -coverprofile=$COVERPROFILE"
go tool cover -html="$COVERPROFILE"

@goal default
@doc same as tested
@doc 'same as tested'
@depends_on tested

@goal notrace @glob '*.awk'
Expand Down

0 comments on commit 6e961ac

Please sign in to comment.