Skip to content

Add flat files to conformance tests#7853

Open
kwxm wants to merge 14 commits into
masterfrom
kwxm/conformance/add-flat-files
Open

Add flat files to conformance tests#7853
kwxm wants to merge 14 commits into
masterfrom
kwxm/conformance/add-flat-files

Conversation

@kwxm

@kwxm kwxm commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This adds .flat and .flat.expected files for most of the conformance tests to make things easier for other users.

  • By default tests like haskell-conformance still use the textual format; however you can use the --format flat option to get them to use the .flat files instead.
  • Some of the test cases (eg, for parse errors) don't have flat equivalents. There are no flat files for these.
  • I've changed the extension for the files containing expected budgets to .budget.expected (it was previously .uplc.budget.expected, but the flat files will require the same budgets).
  • I've renamed the constant directories to parser because those tests are really testing the parser and don't have any flat equivalent.
  • I've added a conformance-consistency test to check that every .uplc file has a corresponding .flat file and vice versa (but see the next point) and that the uplc and flat files decode to identical ASTs (and similarly for the results).
  • conformance-consistency contains a list of directories/files to skip to deal with the .uplc files that don't have corresponding .flat files.
  • It may in fact be possible to convert some of the files in test-cases/uplc/evaluation/builtin/parser (in particular, some of the value ones) to flat, but that'll have to be done by manufacturing the flat encodings directly (ie, not using uplc convert, since it'll fail to parse them). This will be a bit tricky, so I'll come back to it in a separate issue.
  • I've had to exclude the test in test-cases/uplc/evaluation/term/var because of some problems with free variables: I'll come back and look at this later.

If something goes wrong during execution of a .flat file then the .flat.expected file is empty. I'm undecided about whether this is a good idea: maybe it should just contain text "parse/decode" error or "evaluation failure" like the other two .expected files.

@kwxm kwxm added Test Conformance No Changelog Required Add this to skip the Changelog Check labels Jul 16, 2026
@kwxm
kwxm requested review from SeungheonOh, Unisay and zliu41 July 16, 2026 22:57
@kwxm kwxm changed the title Add flat files to conforrmance tests Add flat files to conformance tests Jul 16, 2026
Options were parsed against an empty test tree (to learn --format before test discovery), but tasty only accepts a provider option like tasty-golden's --no-create if the tree contains such tests, so the parse failed. Instead, discover the tests for both formats and let askOption select the right tree, parsing the options once, against the full tree.
If a textual `.uplc` file is expected to fail to parse correctly then the `.uplc.expected` file will contain the string "parse/decode error"

#### "evaluation failure"
If the file is expected to parse correctly but an error is expected to occur during evaluation then the `.uplc.expected` file will contain the string "parse/decode error".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evaluation failure?

instance IsOption Format where
defaultValue = Textual
parseValue s = case s of
"uplc" -> Just Textual

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "uplc" not "textual"? This is inconsistent with the help text below.

unDeBruijnTerm tmEvaluated of
Left _ -> Nothing
Right namedTerm -> Just $ UPLC.Program () version namedTerm
Left _ -> EvalFailure -- Shouldn't happen unless there's something wrong with the Agda code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DecodeError?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Conformance No Changelog Required Add this to skip the Changelog Check Test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants