brson · GitHub

Copy link Copy Markdown

Fixes #9

It is based on converting MVIR to LLVM IR and comparing the result with a reference file, similar to parts of the LLVM and Rust test suite.

It uses the datatest_stable crate, as do most of the other move tests.

It

  • creates a test for every .mvir in the testdata dir
  • converts the mvir to mv bytecode with move-ir-compiler
  • converts mv bytecode to llvm ir with move-mv-llvm-compiler
  • names the llvm ir ${testname}.actual.ll and compares it to ${testname}.expected.ll
  • if the two are different, errors and prints a diff

Actual test results can be promoted to expected test results. The mechanism I wrote to do this is by setting PROMOTE_LLVM_IR, which when set will cause the test harness to copy the .actual.ll files to .expected.ll. This mechanism could be changed to better match other parts of the move test suite. I haven't looked at it closely.

The .expected.ll files are checked into git.

cc @aditya-solana

Read the original on github.com ↗