summaryrefslogtreecommitdiff
path: root/test/builtins
AgeCommit message (Collapse)Author
2021-04-23Add isla builtin testing and update coq scriptsail2Brian Campbell
(both off by default)
2020-04-28Add flooring division in preludeAlasdair
Defined in terms of tdiv so we don't have to add it to backends that don't already have it
2019-07-16Fix all remaining tests for this branchAlasdair
2019-06-18Implement count_leading_zeros in LemThomas Bauereiss
2019-06-17Implement a count_leading_zeros builtin for ocaml and c. This may be a ↵Robert Norton
slight performance improvement and keeps compatibility with smt backend that already had a builtin for this because it can't handle the loop in the sail version. Will need implementations for prover backends.
2019-06-06Add arith_shiftr to C and OCaml librariesThomas Bauereiss
2019-05-23Fix bug in slice_maskThomas Bauereiss
2019-04-16Code for testing builtins with CoqBrian Campbell
Disabled by default because it's fairly resource heavy. Currently two failures: a minor bug affecting divmod.sail, and undefined values aren't set up for set_slice_bits.sail.
2019-03-22Tidy up of div and mod operators (C implementation was previously ↵Robert Norton
inconsistent with ocaml etc.). Rename div and mod builtins to ediv_int/emod_int and tdiv_int/tmod_int and add corresponding implementations. Add a test with negative operands. This will break existing models but will mean users have to think about which versions they want and won't accidentally use the wrong one.
2018-12-12Fix some small bugsAlasdair
Now all ARM, RISC-V, and CHERI-MIPS all build successfully with type-checking changes. All typechecker/c/ocaml/lem/builtin/riscv/arm tests are now working as well. Now the python test scripts can run sequentially with TEST_PAR=1 there's no reason to keep the old shell versions around anymore.
2018-12-12Add parallelism limit to C and builtins testAlasdair Armstrong
Spawning a process for every test and running every test in parallel is quite RAM intensive (up to about 8gb) especially when running valgrind on every test in parallel. Now we only run up to TEST_PAR tests in parallel (default 4).
2018-12-11Fix all tests with type checking changesAlasdair Armstrong
2018-08-24Fix rewriter issuesAlasdair Armstrong
Allow pat_lits rewrite to map L_unit to wildcard patterns, rather than introducing eq_unit tests as guards. Add a fold_function and fold_funcl functions in rewriter.ml that apply the pattern and expression algebras to top-level functions, which means that they correctly get applied to top-level function patterns when they are used. Currently modifying the re-writing passes to do this introduces some bugs which needs investigated further. The current situation is that top-level patterns and patterns elsewhere are often treated differently because rewrite_exp doesn't (and indeed cannot, due to how the re-writer is structured) rewrite top level patterns. Fix pattern completeness check for unit literals Fix a bug in Sail->ANF transform where blocks were always annotated with type unit incorrectly. This caused issues in pattern literal re-writes where the guard was a block returning a boolean. A test case for this is added as test/c/and_block.sail. Fix a bug caused by nested polymorphic function calls and matching in top-level patterns. Test case is test/c/tl_poly_match.sail. Pass location info through codegen_conversion for better error reporting
2018-08-17Improve builtins testsAlasdair Armstrong
Test the builtin functions by compiling them to C, OCaml, and OCaml via Lem. Split up some of the longer builtin test programs to avoid stack overflows when compiling to OCaml, as 3000+ line long blocks can cause issues with some re-writing steps. Also test constant-folding with builtins (this should reduce the asserts in these files to assert true), and also test constant folding with the C compilation. Fix a bug whereby vectors with heap-allocated elements were not initialized correctly. Fix a bug caused by compiling and optimising empty vector literals. Fix an OCaml test case that broke due to the ref type being used. Now uses references to registers. Fix a bug where Sail would output big integers that lem can't parse. Checks if integer is between Int32.min_int and Int32.max_int and if not, use integerOfString to represent the integer. Really this should be fixed in Lem. Make the python test runner script the default for testing builtins and running the C compilation tests in test/run_tests.sh Add a ocaml_build_dir option that sets a custom build directory for OCaml. This is needed for running OCaml tests in parallel so the builds don't clobber one another.
2018-08-16Ressurect builtin tests, and add parallel test runner scriptAlasdair Armstrong
Add new python test runner script, which allows tests to be run in parallel before collecting the results. This makes the tests run a lot faster, especially for the builtins and C compilation tests. Also handles reporting errors mushc more nicely than the previous way of doing it in shell script.
2018-07-09Simplify treating of undefined_bool in Lem libraryThomas Bauereiss
Use nondeterministic choice by default instead of a deterministic bitstream generator in the state, which is slightly awkward to reason about, because every use of undefined_boolS changes the state. The previous behaviour can be implemented as Sail code, if desired. Also add a default implementation of internal_pick that nondeterministically chooses an element from a list.
2018-06-06Some additional fixes to C backend. Re-enable primitive optimizations.Alasdair Armstrong
Also add an additional -Oz3 flag that uses z3 to optimize some additional types. This is currently very experimental and doesn't fully work yet.
2018-05-23A couple of missing >= 0 constraints on vector handling functionsBrian Campbell
2018-05-09Run ARM built-in tests for Lem backend (via OCaml)Thomas Bauereiss
2018-04-03Added test cases for builtinsAlasdair Armstrong
Added library for simple integer arithmetic functions in lib/arith.sail WIP TeX file for formatting latex output included in lib/sail.tex Fixes for bugs in sail_lib