mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 02:14:13 +00:00
Make regression tests invokable from 'go test' (#491)
* incorporate reg-test into "go test" framework * reg-test -> regtest everywhere * update .github/workflows/go.yml
This commit is contained in:
parent
816fd1be90
commit
b06c449384
18610 changed files with 4155 additions and 4131 deletions
2
.github/workflows/go.yml
vendored
2
.github/workflows/go.yml
vendored
|
|
@ -29,4 +29,4 @@ jobs:
|
|||
# In the event of needing to debug failures you can modify `./mlr regtest` verbosity
|
||||
# using `-v`, `-vv`, or `-vvv`. Commit changes to this file and re-push to GitHub
|
||||
# and let the GitHub Actions re-run.
|
||||
run: cd go && go test -v ./... && ./mlr regtest -s 5
|
||||
run: cd go && go test -v miller/src/... && ./mlr regtest -s 5
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -33,7 +33,6 @@ test_parse_trie
|
|||
test_peek_file_reader
|
||||
test_string_builder
|
||||
output-regtest
|
||||
output-reg-test
|
||||
termcvt
|
||||
a.out
|
||||
*.dSYM
|
||||
|
|
|
|||
13
go/README.md
13
go/README.md
|
|
@ -4,9 +4,10 @@ A TL;DR for anyone wanting to compile and run the Go port of Miller:
|
|||
|
||||
* `go build mlr.go` -- produces the `mlr` executable
|
||||
* `go test ./...` -- runs a relatively small number of unit tests
|
||||
* `./mlr regtest` -- new multiplatform regression framework, small-but-growing number of test cases
|
||||
* `./mlr regtest reg-test/cases-pending-go-port` -- needing Go code to be ported from C
|
||||
* `./mlr regtest reg-test/cases-pending-windows` -- for Go code already ported from C but needing some work for Windows
|
||||
* `go test` -- runs the same as `mlr regtest`. Note that (see `mlr regtest -h`) the latter gives you more options.
|
||||
* `./mlr regtest` -- runs `regtest/cases`, which are cases passing on all platforms
|
||||
* `./mlr regtest regtest/cases-pending-go-port` -- needing Go code to be ported from C
|
||||
* `./mlr regtest regtest/cases-pending-windows` -- for Go code already ported from C but needing some work for Windows
|
||||
|
||||
A note on Continuous Integration:
|
||||
|
||||
|
|
@ -24,8 +25,8 @@ A note on Continuous Integration:
|
|||
|
||||
# Port-completion criteria
|
||||
|
||||
* `mlr regtest reg-test/cases*` completes -- either completing/fixing the C/Go source-code discrepancies, or accepting the changes as backward incomptabilities
|
||||
* Double-checking all Miller issues ever, in case I fixed/implemented something but didn't have reg-test coverage
|
||||
* `mlr regtest regtest/cases*` completes -- either completing/fixing the C/Go source-code discrepancies, or accepting the changes as backward incomptabilities
|
||||
* Double-checking all Miller issues ever, in case I fixed/implemented something but didn't have regtest coverage
|
||||
* All `TODO`/`xxx` comments in Go, BNF source code, and case-files are resolved
|
||||
* Release notes including Go-only features, and C/Go backward-incompatibilities
|
||||
* Docs updated at https://miller.readthedocs.io/ (source-controlled at [../docs](../docs/))
|
||||
|
|
@ -202,7 +203,7 @@ nil through the reader/transformer/writer sequence.
|
|||
|
||||
## Software-testing methodology
|
||||
|
||||
See [./reg-test/README.md](./reg-test/README.md).
|
||||
See [./regtest/README.md](./regtest/README.md).
|
||||
|
||||
## Source-code indexing
|
||||
|
||||
|
|
|
|||
7
go/build
7
go/build
|
|
@ -28,19 +28,20 @@ cp mlr mlrgo
|
|||
|
||||
echo ================================================================
|
||||
echo UNIT TESTS
|
||||
go test ./...
|
||||
go test -v miller/src/...
|
||||
# 'go test' (with no arguments) is the same as 'mlr regtest'
|
||||
|
||||
echo
|
||||
echo ================================================================
|
||||
echo REGRESSION TESTS v2 MAIN
|
||||
echo
|
||||
mlr regtest $verbose reg-test/cases reg-test/cases-pending-windows
|
||||
mlr regtest $verbose regtest/cases regtest/cases-pending-windows
|
||||
|
||||
if [ "$do_wips" = "true" ]; then
|
||||
echo
|
||||
echo ================================================================
|
||||
echo REGRESSION TESTS v2 PENDING GO PORT
|
||||
echo
|
||||
mlr regtest $verbose reg-test/cases-pending-go-port
|
||||
mlr regtest $verbose regtest/cases-pending-go-port
|
||||
fi
|
||||
echo
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
go build mlr.go
|
||||
go test ./...
|
||||
mlr regtest reg-test/cases
|
||||
|
||||
go test -v miller/src/...
|
||||
# 'go test' (with no arguments) is the same as 'mlr regtest'
|
||||
|
||||
mlr regtest regtest/cases
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
# Miller regression tests
|
||||
|
||||
There are a few files unit-tested with Go's `testing` package -- a few dozen cases total.
|
||||
|
||||
The vast majority of Miller tests, though -- thousands of cases -- are tested by running scripted invocations of `mlr` with various flags and inputs, comparing against expected output, and checking the exit code back to the shell.
|
||||
|
||||
## How to run the regression tests, in brief
|
||||
|
||||
*Note: while this `README.md` file is within the `go/reg-test/` subdirectory, all paths in this file are written from the perspective of the user being cd'ed into the `go/` directory, i.e. this directory's parent directory.*
|
||||
|
||||
* `mlr regtest --help`
|
||||
|
||||
## Items for the duration of the Go port
|
||||
|
||||
* `mlr regtest -c ...` runs the C version of Miller from the local checkout
|
||||
|
||||
## More details
|
||||
|
||||
TODO: needs to be written up
|
||||
|
||||
## Creating new cases
|
||||
|
||||
TODO: needs to be written up
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --csv cut -f a reg-test/input/rfc-csv/simple.csv-crlf
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --csv --rs crlf cut -f a reg-test/input/rfc-csv/simple.csv-crlf
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --csv --rs lf cut -f a reg-test/input/rfc-csv/simple.csv-crlf
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --from reg-test/input/s.dkvp put 'NR == 2 { $z = 100 }'
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
mlr --from reg-test/input/s.dkvp put 'NR != 2 { $z = 100 }'
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put ' $x > 0.5; $z = "flag"' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put ' !($x > 0.5); $z = "flag"' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put 'filter $x > 0.5; $z = "flag"' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put ' $x > 0.5 {$z = "flag"}' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put 'filter !($x > 0.5); $z = "flag"' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put ' !($x > 0.5) {$z = "flag"}' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "e.*l", "")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "e.*l"i, "")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "e.*"."l", "")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "e.*l", "y123y")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "e.*l"i, "y123y")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "e.*"."l", "y123y")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "([hg])e.*l(.)", "y\1y123\2y")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "([hg])e.*l.", "y\1y123\2y")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "([hg])e.*l(.)", "y\1y123.y")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "a", "aa")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = gsub($x, "a", "aa")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = gsub($x, "A", "Aa")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = gsub($x, "a"i, "Aa")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = gsub($x, "A"i, "Aa")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = gsub($x, "a(.)", "aa\1\1\1")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = sub($x, "a", "")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = gsub($x, "a", "")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = gsub($x, "A", "")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = gsub($x, "a"i, "")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = gsub($x, "A"i, "")' reg-test/input/gsub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab cat reg-test/input/subtab.dkvp
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put -f reg-test/input/subtab1.mlr reg-test/input/subtab.dkvp
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put -f reg-test/input/subtab2.mlr reg-test/input/subtab.dkvp
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put -f reg-test/input/subtab3.mlr reg-test/input/subtab.dkvp
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put -f reg-test/input/subtab4.mlr reg-test/input/subtab.dkvp
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "HE", "")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "HE", "HE")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "HE", "12345")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "LL", "1")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "LL", "12")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "LL", "12345")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "LLO", "")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "LLO", "12")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "LLO", "123")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "LLO", "123456")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "HELLO", "")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "HELLO", "1234")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "HELLO", "12345")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "HELLO", "1234678")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "nonesuch", "")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "nonesuch", "1234")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put '$y = ssub($x, "nonesuch", "1234567890")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[A-Z]+")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[A-Z]*")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[a-z]+")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[a-z]*")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[0-9]+")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[0-9]*")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[ef]+")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[ef]*")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[hi]+")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[hi]*")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[op]+")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract($x, "[op]*")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[A-Z]+", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[A-Z]*", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[a-z]+", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[a-z]*", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[0-9]+", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[0-9]*", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[ef]+", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[ef]*", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[hi]+", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[hi]*", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[op]+", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --oxtab put '$y = regextract_or_else($x, "[op]*", "DEFAULT")' reg-test/input/sub.dat
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --nidx put '$1 = sub($1, "ab(.)d(..)g", "ab<<\1>>d<<\2>>g")' ./reg-test/cases-pending-go-port/c-dsl-filter-pattern-action/0075.input
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --nidx put '$1 = sub($1, "ab(c)?d(..)g", "ab<<\1>>d<<\2>>g")' ./reg-test/cases-pending-go-port/c-dsl-filter-pattern-action/0076.input
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --nidx put '$1 = sub($1, "ab(c)?d(..)g", "ab<<\1>>d<<\2>>g")' ./reg-test/cases-pending-go-port/c-dsl-filter-pattern-action/0077.input
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --nidx put '$1 = sub($1, "ab(c)?d(..)g", "ab<<\1>>d<<\2>>g")' ./reg-test/cases-pending-go-port/c-dsl-filter-pattern-action/0078.input
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr --opprint put -v '@s = NR; $t = @s; $u=@["s"]; $v = $t - $u' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr put -v '@t["u"] = NR; $tu = @["t"]["u"]; emitp all' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr put -v '@t["u"] = NR; $tu = @["t"]["u"]; emitp @*' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr put -v '@["s"] = $x; emitp all' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr put -v '@["t"]["u"] = $y; emitp all' reg-test/input/abixy
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr -n put -f ./reg-test/cases-pending-go-port/c-dsl-lashed-emitp-singles/0001.mlr
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr -n put -f ./reg-test/cases-pending-go-port/c-dsl-lashed-emitp-singles/0002.mlr
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr -n put -f ./reg-test/cases-pending-go-port/c-dsl-lashed-emitp-singles/0003.mlr
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr -n put -f ./reg-test/cases-pending-go-port/c-dsl-lashed-emitp-singles/0004.mlr
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr -n put -f ./reg-test/cases-pending-go-port/c-dsl-lashed-emitp-singles/0005.mlr
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr -n put -f ./reg-test/cases-pending-go-port/c-dsl-lashed-emitp-singles/0006.mlr
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr -n put -f ./reg-test/cases-pending-go-port/c-dsl-lashed-emitp-singles/0007.mlr
|
||||
|
|
@ -1 +0,0 @@
|
|||
mlr -n put -f ./reg-test/cases-pending-go-port/c-dsl-lashed-emitp-singles/0008.mlr
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue