From 2771ae49c89f14c7b5ad935d8c62e2d8a4c74952 Mon Sep 17 00:00:00 2001 From: Zilin Chen Date: Thu, 6 Feb 2020 12:50:13 +1100 Subject: [PATCH] tests: migrate to new testing script (partially) also see #350 for what's missing [skip lemma] --- .travis.yml | 13 +-- cogent/Makefile | 11 +- cogent/tests/README.md | 2 +- cogent/tests/tests/case/config.yaml | 4 +- cogent/tests/tests/if-condition/config.yaml | 25 ++++ cogent/tests/tests/let/config.yaml | 22 ++++ cogent/tests/tests/letbang/config.yaml | 20 ++++ cogent/tests/tests/misc/config.yaml | 107 ++++++++++++++++++ cogent/tests/tests/patterns/config.yaml | 21 ++++ cogent/tests/tests/polymorphic/config.yaml | 18 +++ cogent/tests/tests/simple/config.yaml | 14 +++ .../tests/tests/{misc => simple}/lib.cogent | 0 cogent/tests/tests/subtyping/config.yaml | 4 +- cogent/tests/tests/take-put/config.yaml | 54 +++++++++ cogent/tests/tests/tickets/config.yaml | 65 +++++++++++ cogent/tests/tests/tuples/config.yaml | 18 +++ cogent/tests/tests/unboxed/config.yaml | 21 ++++ cogent/tests/tests/wip/config.yaml | 9 ++ 18 files changed, 409 insertions(+), 19 deletions(-) create mode 100644 cogent/tests/tests/if-condition/config.yaml create mode 100644 cogent/tests/tests/let/config.yaml create mode 100644 cogent/tests/tests/letbang/config.yaml create mode 100644 cogent/tests/tests/misc/config.yaml create mode 100644 cogent/tests/tests/patterns/config.yaml create mode 100644 cogent/tests/tests/polymorphic/config.yaml create mode 100644 cogent/tests/tests/simple/config.yaml rename cogent/tests/tests/{misc => simple}/lib.cogent (100%) create mode 100644 cogent/tests/tests/take-put/config.yaml create mode 100644 cogent/tests/tests/tickets/config.yaml create mode 100644 cogent/tests/tests/tuples/config.yaml create mode 100644 cogent/tests/tests/unboxed/config.yaml create mode 100644 cogent/tests/tests/wip/config.yaml diff --git a/.travis.yml b/.travis.yml index 5fe7541e6..78d0ebec7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ # This file is modified by Zilin Chen, based on the template generated by https://github.com/hvr/multi-ghc-travis language: c +python: + - "3.7" sudo: required dist: trusty @@ -78,6 +80,7 @@ before_install: - export ALEXVER=3.1.7 - export HAPPYVER=1.19.5 - export PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$REPO/cogent/$SANDBOX/bin:$PATH + - pip install termcolor ruamel.yaml install: # Get AutoCorres @@ -168,15 +171,7 @@ script: # Check if Cogent has been correctly installed - which cogent || travis_terminate 1 # - echo 'Running tests' - - make test-pp - - make test-tc - - make test-ds - - make test-an - - make test-mn - - make test-cg - - make test-gcc - - make test-aq - - make test-flags + - make test-compiler # - echo 'Typechecking libgum' - make test-libgum # - echo 'Building Cogent examples' diff --git a/cogent/Makefile b/cogent/Makefile index d5598fbf4..38234fd86 100644 --- a/cogent/Makefile +++ b/cogent/Makefile @@ -1,4 +1,4 @@ -.PHONY: build configure install +.PHONY: build configure install test-compiler ## Silent by default V = @@ -100,10 +100,11 @@ tests/include/%_dummy.h: tests/%.cogent .test-setup: $(Q)mkdir -p tests/include -test-compiler: test-clean .test-cogent \ - test-tc test-ds test-an test-mn test-cg test-gcc \ - test-pp test-aq \ - test-hs +test-compiler: .test-cogent + ./tests/run-test-suite.py \ + # test-tc test-ds test-an test-mn test-cg test-gcc \ + # test-pp test-aq \ + # test-hs tests: test-compiler \ test-tc-proof test-shallow-proof test-ee diff --git a/cogent/tests/README.md b/cogent/tests/README.md index 3f946c7f5..c928b061c 100644 --- a/cogent/tests/README.md +++ b/cogent/tests/README.md @@ -129,7 +129,7 @@ Run the script with `-h` or `--help` for a more detailed explanation. ## Dependancies The test script depends on the following python modules: -* [ruamel](https://yaml.readthedocs.io/en/latest/) +* [ruamel.yaml](https://yaml.readthedocs.io/en/latest/) * [termcolor](https://pypi.org/project/termcolor/) ## Future improvements/feature suggestions diff --git a/cogent/tests/tests/case/config.yaml b/cogent/tests/tests/case/config.yaml index 122f61082..aacce9d29 100644 --- a/cogent/tests/tests/case/config.yaml +++ b/cogent/tests/tests/case/config.yaml @@ -1,4 +1,4 @@ -- test_name: case-pass +- test_name: pass-case files: - pass_case-default.cogent - pass_case-default-constructor.cogent @@ -11,7 +11,7 @@ flags: - "-g" -- test_name: case-fail +- test_name: fail-case files: - fail_unmatched-case.cogent expected_result: fail diff --git a/cogent/tests/tests/if-condition/config.yaml b/cogent/tests/tests/if-condition/config.yaml new file mode 100644 index 000000000..4f1c07d12 --- /dev/null +++ b/cogent/tests/tests/if-condition/config.yaml @@ -0,0 +1,25 @@ +- test_name: pass-if + files: + - pass_if-prmt-int.cogent + - pass_multiway-if.cogent + - pass_multiway-if-linear.cogent + expected_result: pass + flags: + - -g + +- test_name: fail-if + files: + - fail_herp-if-non-arith.cogent + - fail_multiway-if-linear.cogent + - fail_multiway-if-no-else.cogent + - fail_multiway-if-one-branch.cogent + expected_result: fail + flags: + - -t + +- test_name: reftypes-if + files: + - wip_herp-if-if.cogent + expected_result: wip + flags: + - -g diff --git a/cogent/tests/tests/let/config.yaml b/cogent/tests/tests/let/config.yaml new file mode 100644 index 000000000..0013cd240 --- /dev/null +++ b/cogent/tests/tests/let/config.yaml @@ -0,0 +1,22 @@ +- test_name: pass-let + files: + - pass_let-if.cogent + - pass_simple-let.cogent + expected_result: pass + flags: + - -g + +- test_name: fail-let + files: + - fail_let-upcast.cogent + expected_result: fail + flags: + - -t + +- test_name: wip-let + files: + - wip_let-let.cogent + expected_result: wip + flags: + - -g + diff --git a/cogent/tests/tests/letbang/config.yaml b/cogent/tests/tests/letbang/config.yaml new file mode 100644 index 000000000..aed515f24 --- /dev/null +++ b/cogent/tests/tests/letbang/config.yaml @@ -0,0 +1,20 @@ +- test_name: pass-letbang + files: + - pass_anormal-letbang.cogent + - pass_deep-letbang-on-tag-union.cogent + - pass_inline-func-letbang.cogent + - pass_letbang.cogent + - pass_letbang-cond-type-annot.cogent + - pass_letbang-not-escape-fix.cogent + - pass_letbang-not-used-in-subexpr.cogent + expected_result: pass + flags: + - -g + +- test_name: fail-letbang + files: + - fail_extra_letbang.cogent + - fail_letbang-not-escape.cogent + expected_result: fail + flags: + - -t diff --git a/cogent/tests/tests/misc/config.yaml b/cogent/tests/tests/misc/config.yaml new file mode 100644 index 000000000..b88ef5898 --- /dev/null +++ b/cogent/tests/tests/misc/config.yaml @@ -0,0 +1,107 @@ +- test_name: pass-misc + files: + - pass_abs-para-ty-cg.cogent + - pass_app-comp-1.cogent + - pass_app-comp-2.cogent + - pass_basic-features.cogent + - pass_bitwise.cogent + - pass_bool-type.cogent + - pass_capture.cogent + - pass_char-is-u8.cogent + - pass_code-in-return.cogent + - pass_compare-bool.cogent + - pass_compl.cogent + - pass_constant-with-digit.cogent + - pass_corres-setup.cogent + - pass_cpp.cogent + - pass_debug.cogent + - pass_differing-num-con-args-1.cogent + - pass_differing-num-con-args.cogent + - pass_error-comparison.cogent + - pass_explicit-var-upcast.cogent + - pass_ext2-mount.cogent + - pass_ex-variants.cogent + - pass_fun-type-synonym.cogent + - pass_handle-return.cogent + - pass_hs-variants.cogent + - pass_implicit-literal-upcast.cogent + - pass_inline-pragma.cogent + - pass_large-code.cogent + - pass_lax-wildcard.cogent + - pass_lots_of_absfun.cogent + - pass_member.cogent + - pass_multi-arg-cons.cogent + - pass_nested-comments.cogent + - pass_nested-err-handling.cogent + - pass_non-dec-ints.cogent + - pass_param-synonym-expand.cogent + - pass_partial-typeapp.cogent + - pass_phantom.cogent + - pass_prim-int-upcast.cogent + - pass_promote-variant.cogent + - pass_return-funtype.cogent + - pass_reuse-var.cogent + - pass_scoped-type-var.cogent + - pass_serialise-simple.cogent + - pass_sinkfloat-test-0.cogent + - pass_type-annot-expr.cogent + - pass_typedef.cogent + - pass_type-holes-1.cogent + - pass_undefined.cogent + - pass_underscore-wildcard.cogent + - pass_unicode-literals.cogent + - pass_unify-if.cogent + - pass_unknown-underscore-type.cogent + - pass_useability-in-default.cogent + - pass_warn-shadow-var.cogent + - pass_warn-unused-local-bind.cogent + - pass_weakening1.cogent + - pass_weakening2.cogent + - include_pass_cpp.cogent + expected_result: pass + flags: + - -g + +- test_name: fail-misc + files: + - fail_char-expr.cogent + - fail_compare_bool_int.cogent + - fail_compare_non_prim_type.cogent + - fail_conflict-fieldname.cogent + - fail_conflict-fieldname-nested.cogent + - fail_const-parse.cogent + - fail_datacons-arg-number-diff.cogent + - fail_discard-linear.cogent + - fail_double-use-linear-ur.cogent + - fail_dup-type.cogent + - fail_dup-type-var.cogent + - fail_dup-val.cogent + - fail_dup-val-sig.cogent + - fail_ex-variant-dup-pvars.cogent + - fail_linear-used-multi-times.cogent + - fail_lin-underscore-2.cogent + - fail_lin-underscore.cogent + - fail_non-shareable-const.cogent + - fail_out-of-scope-typevar.cogent + - fail_readonly-escape.cogent + - fail_scoped-type-var.cogent + - fail_too-many-type-args.cogent + - fail_to-raw-type.cogent + - fail_typeapp-ill-formed.cogent + - fail_ur-field-names.cogent + - fail_ur-more-fields.cogent + - fail_var-already-used.cogent + - fail_warn-unused-local-bind.cogent + expected_result: fail + flags: + - -t + +- test_name: wip-misc + files: + - fixme_abstract-const.cogent + - fixme_guards.cogent + - shouldfail_const-not-const.cogent + - shouldfail_overlapping_pcons.cogent + expected_result: wip + flags: + - -t diff --git a/cogent/tests/tests/patterns/config.yaml b/cogent/tests/tests/patterns/config.yaml new file mode 100644 index 000000000..fc3755aa3 --- /dev/null +++ b/cogent/tests/tests/patterns/config.yaml @@ -0,0 +1,21 @@ +- test_name: pass-patterns + files: + - pass_biased-pattern-1.cogent + - pass_biased-pattern-1-compare.cogent + - pass_biased-pattern-2.cogent + - pass_biased-pattern-2-compare.cogent + - pass_biased-pattern-3.cogent + - pass_biased-pattern-3-compare.cogent + - pass_pattern-in-parens.cogent + expected_result: pass + flags: + - -g + +- test_name: fail-patterns + files: + - fail_char-pattern.cogent + - fail_conflict-pattern-var-1.cogent + - fail_conflict-pattern-var-2.cogent + expected_result: fail + flags: + - -t diff --git a/cogent/tests/tests/polymorphic/config.yaml b/cogent/tests/tests/polymorphic/config.yaml new file mode 100644 index 000000000..357fa440d --- /dev/null +++ b/cogent/tests/tests/polymorphic/config.yaml @@ -0,0 +1,18 @@ +- test_name: pass-polymorphic + files: + - pass_poly-simple.cogent + expected_result: pass + flags: + - -g + +- test_name: fail-polymorphic + files: + - fail_dup-poly-var.cogent + - fail_flags_ffi-gen-poly + - fail_poly-const.cogent + - fail_poly-put-all.cogent + - fail_poly-take-all.cogent + - fail_poly-take-f1.cogent + expected_result: fail + flags: + - -t diff --git a/cogent/tests/tests/simple/config.yaml b/cogent/tests/tests/simple/config.yaml new file mode 100644 index 000000000..3c89bbd8c --- /dev/null +++ b/cogent/tests/tests/simple/config.yaml @@ -0,0 +1,14 @@ +- test_name: pass-simple + files: + - pass_simple-arith.cogent + - pass_simple-con.cogent + - pass_simple-cpp.cogent + - pass_simple-fun.cogent + - pass_simple-if.cogent + - pass_simple-obj.cogent + - pass_simple-split.cogent + - pass_simple-string-lit.cogent + - pass_simple-struct.cogent + expected_result: pass + flags: + - -g diff --git a/cogent/tests/tests/misc/lib.cogent b/cogent/tests/tests/simple/lib.cogent similarity index 100% rename from cogent/tests/tests/misc/lib.cogent rename to cogent/tests/tests/simple/lib.cogent diff --git a/cogent/tests/tests/subtyping/config.yaml b/cogent/tests/tests/subtyping/config.yaml index 4688a5d52..2d6b35fc0 100644 --- a/cogent/tests/tests/subtyping/config.yaml +++ b/cogent/tests/tests/subtyping/config.yaml @@ -1,4 +1,4 @@ -- test_name: subtyping-tests +- test_name: pass-subtyping files: - pass_none-subtyping.cogent - pass_subtyping-con-promote.cogent @@ -12,4 +12,4 @@ - sinkfloat_promotion_test.cogent expected_result: pass flags: - - --typecheck \ No newline at end of file + - -t diff --git a/cogent/tests/tests/take-put/config.yaml b/cogent/tests/tests/take-put/config.yaml new file mode 100644 index 000000000..d1d21ddec --- /dev/null +++ b/cogent/tests/tests/take-put/config.yaml @@ -0,0 +1,54 @@ + +- test_name: pass-take-put + files: + - pass_put-and-take.cogent + - pass_put-discardable-field.cogent + - pass_put-nonlinear-more-than-once.cogent + - pass_put-untaken-nonlinear.cogent + - pass_put-wildcard-promote.cogent + - pass_simple-put.cogent + - pass_simple-take.cogent + - pass_simple-take-put.cogent + - pass_take-put-all.cogent + - pass_take-put-return-fail.cogent + - pass_take-put-variant.cogent + - pass_take-put-verbose.cogent + - pass_wf-take-idem-1.cogent + - pass_wf-take-idem-2.cogent + - pass_wf-take-put-tc-1.cogent + - pass_wf-take-put-tc-2.cogent + - pass_wf-take-put-tc-3.cogent + - pass_yet-another-take-put.cogent + expected_result: pass + flags: + - -g + +- test_name: fail-take-put + files: + - fail_lax-take-put.cogent + - fail_no-need-to-take-all.cogent + - fail_taken-inner.cogent + - fail_take-nonexist-field.cogent + - fail_take-put-parser-1.cogent + - fail_take-put-parser-2.cogent + - fail_take-put-parser-3.cogent + - fail_take-put-parser-4.cogent + - fail_take-taken-fld.cogent + - fail_use-nonlinear-taken-field.cogent + - fail_wf-take-nonexisting-field.cogent + - fail_wf-take-nothing-nonrec.cogent + - fail_wf-take-something-nonrec.cogent + - fail_wf-take-tyvar.cogent + - shouldfail_put-linear-more-than-once.cogent + - shouldfail_take-linear-more-than-once.cogent + - shouldfail_take-nonlinear-more-than-once.cogent + expected_result: fail + flags: + - -t + +- test_name: shouldfail-take-put + files: + - shouldfail_take-same-fields.cogent + expected_result: wip + flags: + - -t diff --git a/cogent/tests/tests/tickets/config.yaml b/cogent/tests/tests/tickets/config.yaml new file mode 100644 index 000000000..112dd797b --- /dev/null +++ b/cogent/tests/tests/tickets/config.yaml @@ -0,0 +1,65 @@ +- test_name: pass-tickets + files: + - pass_ticket-224.cogent + - pass_ticket-226.cogent + - pass_ticket-22.cogent + - pass_ticket-23.cogent + - pass_ticket-28.cogent + - pass_ticket-296-D-value-in-one-case-branch.cogent + - pass_ticket-298-banged-tcon-with-arguments-lambda-2.cogent + - pass_ticket-298-banged-tcon-with-arguments-lambda.cogent + - pass_ticket-29.cogent + - pass_ticket-306.cogent + - pass_ticket-309.cogent + - pass_ticket-30-nested-take.cogent + - pass_ticket-30-take-all.cogent + - pass_ticket-30-take-reorder.cogent + - pass_ticket-63.cogent + - pass_ticket-84.cogent + - pass_ticket-e22-1.cogent + - pass_ticket-e22-2.cogent + - pass_ticket-e22-3.cogent + - pass_ticket-e22-4.cogent + - pass_ticket-e22-5.cogent + - pass_ticket-e22-6.cogent + - pass_ticket-e22-7.cogent + - pass_ticket-e25.cogent + - pass_ticket-e29-ascribed.cogent + - pass_ticket-e29-inferred.cogent + - pass_ticket-e30.cogent + - pass_ticket-e31-2.cogent + - pass_ticket-e31.cogent + - pass_ticket-e47-1.cogent + - pass_ticket-e47.cogent + expected_result: pass + flags: + - -g + +- test_name: fail-tickets + files: + - fail_ticket-38.cogent + - fail_ticket-e198.cogent + - fail_ticket-e28-banged.cogent + - fail_ticket-e28-func.cogent + - fail_ticket-e28-var.cogent + - fail_ticket-e31-3-bad.cogent + - fail_ticket-e31-3-good.cogent + - fail_ticket-e36.cogent + expected_result: fail + flags: + - -t + +- test_name: wip-tickets + files: + - fixme_ticket-262.cogent + - wip_ticket-259-1.cogent + - wip_ticket-260.cogent + - wip_ticket-261.cogent + - wip_ticket-281.cogent + - wip_ticket-92-1.cogent + - wip_ticket-92-2.cogent + - wip_ticket-92-3.cogent + - wip_ticket-e29.cogent + expected_result: wip + flags: + - -t diff --git a/cogent/tests/tests/tuples/config.yaml b/cogent/tests/tests/tuples/config.yaml new file mode 100644 index 000000000..5f716563a --- /dev/null +++ b/cogent/tests/tests/tuples/config.yaml @@ -0,0 +1,18 @@ +- test_name: pass-tuples + files: + - pass_big-tuple.cogent + - pass_instantiate-nested-tuples.cogent + - pass_match-tuples-sort.cogent + - pass_n-tuple.cogent + - pass_subtyping-tuples.cogent + - pass_typeinfer-sinkfloats-tuples.cogent + expected_result: pass + flags: + - -g + +- test_name: fail-tuples + files: + - fail_tuple-equiv.cogent + expected_result: fail + flags: + - -t diff --git a/cogent/tests/tests/unboxed/config.yaml b/cogent/tests/tests/unboxed/config.yaml new file mode 100644 index 000000000..a2d7e76f1 --- /dev/null +++ b/cogent/tests/tests/unboxed/config.yaml @@ -0,0 +1,21 @@ +- test_name: pass-unboxed + files: + - pass_nested-unboxed-rec.cogent + - pass_parse-param-and-unboxed-rec.cogent + - pass_unboxed-abstype.cogent + - pass_unboxed-assign.cogent + - pass_unboxed-promote.cogent + - pass_unboxed-rec-copy.cogent + - pass_unboxed-record-1.cogent + - pass_unboxed-record-2.cogent + expected_result: pass + flags: + - -g + +- test_name: fail-unboxed + files: + - fail_unboxed-member.cogent + - fail_unbox-everything.cogent + expected_result: fail + flags: + - -t diff --git a/cogent/tests/tests/wip/config.yaml b/cogent/tests/tests/wip/config.yaml new file mode 100644 index 000000000..8292da78f --- /dev/null +++ b/cogent/tests/tests/wip/config.yaml @@ -0,0 +1,9 @@ +- test_name: wip + files: + - wip_ent-defns.cogent + - wip_ent-defns.ed + - wip_reflect-if.cogent + - wip_share-variants.cogent + expected_result: wip + flags: + - -t