From 241553c9d8dcc63b555346d8ebb4d953356a8e8c Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Tue, 14 Jul 2020 12:14:58 +0100 Subject: [PATCH 1/2] ppx_tests: preprocess output to remove file id We primarily just want to check in the ppx unit tests that the error message is correct. The line number information varies by compiler version, so we just preprocess to remove that. In the longer term, this can be fixed more systematically by using the toplevel_expect_tests package (suggested by @jeremiedimino) but this PR unblocks the release. --- ppx_test/errors/cenum_id_payload.ml.expected | 1 - .../errors/cenum_invalid_type.ml.expected | 1 - .../errors/cenum_no_attribute.ml.expected | 1 - .../errors/cenum_not_a_variant.ml.expected | 1 - .../cenum_unknown_attribute.ml.expected | 1 - .../cstruct_attribute_payload.ml.expected | 1 - .../cstruct_duplicate_field.ml.expected | 1 - ppx_test/errors/cstruct_len_int32.ml.expected | 1 - .../errors/cstruct_len_not_int.ml.expected | 1 - ppx_test/errors/cstruct_len_zero.ml.expected | 1 - .../errors/cstruct_multiple_len.ml.expected | 1 - .../errors/cstruct_not_a_record.ml.expected | 1 - .../cstruct_not_an_identifier.ml.expected | 1 - .../cstruct_several_attributes.ml.expected | 1 - .../errors/cstruct_unknown_endian.ml.expected | 1 - .../errors/cstruct_unknown_type.ml.expected | 1 - ppx_test/errors/dune.inc | 128 +++++++++--------- ppx_test/errors/gen_tests.ml | 8 +- 18 files changed, 68 insertions(+), 84 deletions(-) diff --git a/ppx_test/errors/cenum_id_payload.ml.expected b/ppx_test/errors/cenum_id_payload.ml.expected index 70eac9c4..6f7e50ba 100644 --- a/ppx_test/errors/cenum_id_payload.ml.expected +++ b/ppx_test/errors/cenum_id_payload.ml.expected @@ -1,2 +1 @@ -File "cenum_id_payload.ml", line 2, characters 18-20: Error: ppx_cstruct: invalid id diff --git a/ppx_test/errors/cenum_invalid_type.ml.expected b/ppx_test/errors/cenum_invalid_type.ml.expected index 45fa2129..5ef7de07 100644 --- a/ppx_test/errors/cenum_invalid_type.ml.expected +++ b/ppx_test/errors/cenum_invalid_type.ml.expected @@ -1,2 +1 @@ -File "cenum_invalid_type.ml", line 2, characters 11-19: Error: ppx_cstruct: invalid cenum variant diff --git a/ppx_test/errors/cenum_no_attribute.ml.expected b/ppx_test/errors/cenum_no_attribute.ml.expected index d9b2af4b..cfcb3efb 100644 --- a/ppx_test/errors/cenum_no_attribute.ml.expected +++ b/ppx_test/errors/cenum_no_attribute.ml.expected @@ -1,2 +1 @@ -File "cenum_no_attribute.ml", line 2, characters 2-18: Error: ppx_cstruct: invalid cenum attributes diff --git a/ppx_test/errors/cenum_not_a_variant.ml.expected b/ppx_test/errors/cenum_not_a_variant.ml.expected index 81274f40..cfbb4c1d 100644 --- a/ppx_test/errors/cenum_not_a_variant.ml.expected +++ b/ppx_test/errors/cenum_not_a_variant.ml.expected @@ -1,2 +1 @@ -File "cenum_not_a_variant.ml", line 2, characters 2-34: Error: ppx_cstruct: expected variant type diff --git a/ppx_test/errors/cenum_unknown_attribute.ml.expected b/ppx_test/errors/cenum_unknown_attribute.ml.expected index dc55a10d..21e0444c 100644 --- a/ppx_test/errors/cenum_unknown_attribute.ml.expected +++ b/ppx_test/errors/cenum_unknown_attribute.ml.expected @@ -1,2 +1 @@ -File "cenum_unknown_attribute.ml", line 2, characters 2-32: Error: ppx_cstruct: enum: unknown width specifier uint9_t diff --git a/ppx_test/errors/cstruct_attribute_payload.ml.expected b/ppx_test/errors/cstruct_attribute_payload.ml.expected index 9633196d..09edecda 100644 --- a/ppx_test/errors/cstruct_attribute_payload.ml.expected +++ b/ppx_test/errors/cstruct_attribute_payload.ml.expected @@ -1,2 +1 @@ -File "cstruct_attribute_payload.ml", line 2, characters 2-57: Error: ppx_cstruct: no attribute payload expected diff --git a/ppx_test/errors/cstruct_duplicate_field.ml.expected b/ppx_test/errors/cstruct_duplicate_field.ml.expected index 2f96ec25..0c0d33ef 100644 --- a/ppx_test/errors/cstruct_duplicate_field.ml.expected +++ b/ppx_test/errors/cstruct_duplicate_field.ml.expected @@ -1,2 +1 @@ -File "cstruct_duplicate_field.ml", line 5, characters 2-14: Error: ppx_cstruct: field x is present several times in this type diff --git a/ppx_test/errors/cstruct_len_int32.ml.expected b/ppx_test/errors/cstruct_len_int32.ml.expected index 0822f73d..8bdd5ae8 100644 --- a/ppx_test/errors/cstruct_len_int32.ml.expected +++ b/ppx_test/errors/cstruct_len_int32.ml.expected @@ -1,2 +1 @@ -File "cstruct_len_int32.ml", line 3, characters 17-20: Error: ppx_cstruct: [@len] argument should be an integer diff --git a/ppx_test/errors/cstruct_len_not_int.ml.expected b/ppx_test/errors/cstruct_len_not_int.ml.expected index 5118c334..8bdd5ae8 100644 --- a/ppx_test/errors/cstruct_len_not_int.ml.expected +++ b/ppx_test/errors/cstruct_len_not_int.ml.expected @@ -1,2 +1 @@ -File "cstruct_len_not_int.ml", line 3, characters 17-20: Error: ppx_cstruct: [@len] argument should be an integer diff --git a/ppx_test/errors/cstruct_len_zero.ml.expected b/ppx_test/errors/cstruct_len_zero.ml.expected index aae1fb1c..d97cd8e8 100644 --- a/ppx_test/errors/cstruct_len_zero.ml.expected +++ b/ppx_test/errors/cstruct_len_zero.ml.expected @@ -1,2 +1 @@ -File "cstruct_len_zero.ml", line 3, characters 17-20: Error: ppx_cstruct: [@len] argument should be > 0 diff --git a/ppx_test/errors/cstruct_multiple_len.ml.expected b/ppx_test/errors/cstruct_multiple_len.ml.expected index e9baffff..927c7607 100644 --- a/ppx_test/errors/cstruct_multiple_len.ml.expected +++ b/ppx_test/errors/cstruct_multiple_len.ml.expected @@ -1,2 +1 @@ -File "cstruct_multiple_len.ml", line 3, characters 4-35: Error: ppx_cstruct: multiple field length attribute diff --git a/ppx_test/errors/cstruct_not_a_record.ml.expected b/ppx_test/errors/cstruct_not_a_record.ml.expected index 3604679c..930f14d6 100644 --- a/ppx_test/errors/cstruct_not_a_record.ml.expected +++ b/ppx_test/errors/cstruct_not_a_record.ml.expected @@ -1,2 +1 @@ -File "cstruct_not_a_record.ml", line 2, characters 2-14: Error: ppx_cstruct: record type declaration expected diff --git a/ppx_test/errors/cstruct_not_an_identifier.ml.expected b/ppx_test/errors/cstruct_not_an_identifier.ml.expected index a4b970ad..2026cdd4 100644 --- a/ppx_test/errors/cstruct_not_an_identifier.ml.expected +++ b/ppx_test/errors/cstruct_not_an_identifier.ml.expected @@ -1,2 +1 @@ -File "cstruct_not_an_identifier.ml", line 3, characters 8-20: Error: ppx_cstruct: type identifier expected diff --git a/ppx_test/errors/cstruct_several_attributes.ml.expected b/ppx_test/errors/cstruct_several_attributes.ml.expected index 71c7fc19..30651a56 100644 --- a/ppx_test/errors/cstruct_several_attributes.ml.expected +++ b/ppx_test/errors/cstruct_several_attributes.ml.expected @@ -1,2 +1 @@ -File "cstruct_several_attributes.ml", line 2, characters 2-71: Error: ppx_cstruct: too many attributes diff --git a/ppx_test/errors/cstruct_unknown_endian.ml.expected b/ppx_test/errors/cstruct_unknown_endian.ml.expected index ceb88a8f..e068f302 100644 --- a/ppx_test/errors/cstruct_unknown_endian.ml.expected +++ b/ppx_test/errors/cstruct_unknown_endian.ml.expected @@ -1,2 +1 @@ -File "cstruct_unknown_endian.ml", line 2, characters 2-49: Error: ppx_cstruct: unknown endian unknown_endian, should be little_endian, big_endian, host_endian or bi_endian diff --git a/ppx_test/errors/cstruct_unknown_type.ml.expected b/ppx_test/errors/cstruct_unknown_type.ml.expected index 4e18276b..c453b760 100644 --- a/ppx_test/errors/cstruct_unknown_type.ml.expected +++ b/ppx_test/errors/cstruct_unknown_type.ml.expected @@ -1,2 +1 @@ -File "cstruct_unknown_type.ml", line 3, characters 4-15: Error: ppx_cstruct: Unknown type uint9_t diff --git a/ppx_test/errors/dune.inc b/ppx_test/errors/dune.inc index 289094c4..3717731e 100644 --- a/ppx_test/errors/dune.inc +++ b/ppx_test/errors/dune.inc @@ -3,10 +3,10 @@ (deps pp.exe (:input cenum_id_payload.ml)) (targets cenum_id_payload.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -17,10 +17,10 @@ (deps pp.exe (:input cenum_invalid_type.ml)) (targets cenum_invalid_type.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -31,10 +31,10 @@ (deps pp.exe (:input cenum_no_attribute.ml)) (targets cenum_no_attribute.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -45,10 +45,10 @@ (deps pp.exe (:input cenum_not_a_variant.ml)) (targets cenum_not_a_variant.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -59,10 +59,10 @@ (deps pp.exe (:input cenum_unknown_attribute.ml)) (targets cenum_unknown_attribute.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -73,10 +73,10 @@ (deps pp.exe (:input cstruct_attribute_payload.ml)) (targets cstruct_attribute_payload.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -87,10 +87,10 @@ (deps pp.exe (:input cstruct_duplicate_field.ml)) (targets cstruct_duplicate_field.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -101,10 +101,10 @@ (deps pp.exe (:input cstruct_len_int32.ml)) (targets cstruct_len_int32.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -115,10 +115,10 @@ (deps pp.exe (:input cstruct_len_not_int.ml)) (targets cstruct_len_not_int.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -129,10 +129,10 @@ (deps pp.exe (:input cstruct_len_zero.ml)) (targets cstruct_len_zero.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -143,10 +143,10 @@ (deps pp.exe (:input cstruct_multiple_len.ml)) (targets cstruct_multiple_len.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -157,10 +157,10 @@ (deps pp.exe (:input cstruct_not_a_record.ml)) (targets cstruct_not_a_record.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -171,10 +171,10 @@ (deps pp.exe (:input cstruct_not_an_identifier.ml)) (targets cstruct_not_an_identifier.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -185,10 +185,10 @@ (deps pp.exe (:input cstruct_several_attributes.ml)) (targets cstruct_several_attributes.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -199,10 +199,10 @@ (deps pp.exe (:input cstruct_unknown_endian.ml)) (targets cstruct_unknown_endian.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) @@ -213,10 +213,10 @@ (deps pp.exe (:input cstruct_unknown_type.ml)) (targets cstruct_unknown_type.ml.errors) (action - (with-stderr-to - %{targets} - (run ./pp.exe --impl %{input})))) - + (progn + (with-stderr-to %{targets} + (run ./pp.exe --impl %{input})) + (bash "sed -i.bak '1d' %{targets}")))) (rule (alias runtest) (package ppx_cstruct) diff --git a/ppx_test/errors/gen_tests.ml b/ppx_test/errors/gen_tests.ml index 825560d5..219f9c4a 100644 --- a/ppx_test/errors/gen_tests.ml +++ b/ppx_test/errors/gen_tests.ml @@ -5,10 +5,10 @@ let output_stanzas name = (deps pp.exe (:input %s)) (targets %s.errors) (action - (with-stderr-to - %%{targets} - (run ./pp.exe --impl %%{input})))) - + (progn + (with-stderr-to %%{targets} + (run ./pp.exe --impl %%{input})) + (bash "sed -i.bak '1d' %%{targets}")))) (rule (alias runtest) (package ppx_cstruct) From 59bf6b9453cf8e7d37ad864d6a9257d1a91bb7c8 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Tue, 14 Jul 2020 14:42:45 +0100 Subject: [PATCH 2/2] travis: test debian stable --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3396a064..211e3721 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,6 @@ env: - PACKAGE="cstruct" DISTRO="alpine" OCAML_VERSION="4.07" - PACKAGE="cstruct-lwt" DISTRO="debian-testing" OCAML_VERSION="4.07" - PACKAGE="cstruct-async" DISTRO="centos" OCAML_VERSION="4.07" - - PACKAGE="ppx_cstruct" DISTRO="debian-unstable" OCAML_VERSION="4.07" + - PACKAGE="ppx_cstruct" DISTRO="debian-stable" OCAML_VERSION="4.07" - PACKAGE="cstruct-unix" DISTRO="ubuntu" OCAML_VERSION="4.07" - PACKAGE="cstruct-unix" DISTRO="alpine" OCAML_VERSION="4.08"