summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2018-10-16Merge branch 'sail2' into rmem_interpreterJon French
2018-10-15Add interpreted RISC-V model to test suiteJon French
2018-10-12Prevent accidental test failures when Coq compiles in the wrong orderBrian Campbell
2018-09-28Add a regression test for bug in commit 88b25e9Alasdair Armstrong
2018-09-27Add an additional type checking testAlasdair Armstrong
2018-09-21Remove cheri and mips specs -- they now have their own repository.Robert Norton
2018-09-13C: Fix an issue with assigning to unitialized variables at end of blocksAlasdair Armstrong
Assigning to an uninitialized variable as the last statement in a block is almost certainly a type, and if that occurs then the lift_assign re-write will introduce empty blocks causing this error to occur. Now when we see such an empty block when converting to A-normal form we turn it into unit, and emit a warning stating that an empty block has been found as well as the probable cause (uninitialized variable).
2018-09-12Jenkins: Fix deprecation warningsAlasdair Armstrong
Now that Jenkins is updated to a newer version of OCaml we can finally fix some warning with more recent versions of OCaml than 4.02.3. Also fix a Lem test case that was failing.
2018-09-10Various fixesAlasdair Armstrong
C: Don't print usage message and quit when called with no arguments, as this is used for testing C output OCaml: Fix generation of datatypes with multiple type arguments OCaml: Generate P_cons pattern correctly C: Fix constant propagation to not propagate letbindings with type annotations. This behaviour could cause type errors due to how type variables are introduced. Now we only propagate letbindings when the type of the propagated variable is guaranteed to be the same as the inferred type of the binding. Tests: Add OCaml tests to the C end-to-end tests (which really shouldn't be in test/c/ any more, something like test/compile might be better). Currently some issues with reals there like interpreter. Tests: Rename list.sail -> list_test.sail because ocaml doesn't want to compile files called list.ml.
2018-09-07Jenkins: Fix Jenkins issue with RISC-V test suiteAlasdair Armstrong
2018-09-07RISCV: Run RISC-V tests using version compiled to CAlasdair Armstrong
Current pass rate is 170 out of 181. Looks like there are some issues with rv64ua-p-lrsc.elf, rv64ua-v-lrsc.elf, and rv64uc-p-rvc.elf which I think are caused by me not implementing parts of the RISC-V platform correctly in C. Some of the div and mod tests also fail, which is probably an issue with using the correct rounding.
2018-09-06C: Fix a bug with shadowing in nested let-bindingsAlasdair
2018-08-30C: Fix a bug where function argument type becomes more specific due to flow ↵Alasdair Armstrong
typing Added a regression test as c/test/downcast_fn.sail
2018-08-30C: Fix an issue with struct field being generalised inside polymorphic ↵Alasdair Armstrong
constructors Add a new printing function for debugging that recursively prints constructor types. Fix an interpreter bug when pattern matching on constructors with tuple types.
2018-08-29C: Fix some issues with tuples as arguments to polymorphic constructorsAlasdair Armstrong
Now all we need to do is make sure the RISC-V builtins are mapped to the correct C functions, and RISC-V in C should work (hopefully). We're still missing some of the functions in sail.c for the mappings so those have to be implemented.
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-23Fix interpreter after re-writer changeAlasdair Armstrong
Interpreter used a re-write (vector concat removal) that is dependent on the vector_string_to_bit_list rewriting pass. This fixes the interpreter to work without either vector concat removal, or turning bitstrings into vector literals like [bitzero, bitzero, bitone]. This has the upside of reducing the number of steps the interpreter needs for working with bitvectors so should improve interpreter performance. We also now test all the C compilation tests behave the same using the interpreter. Currently the real number tests fail due to limitations of Lem's rational library (this must be fixed in Lem). This required supporting configuration registers in the interpreter. As such the interpreter was refactored to more cleanly process registers when building an initial global state. The functions are also collected into the global state, which removes the need to search for them in the AST every time a function call happens. This should not only improve performance, but also removes the need to pass an AST into the interpretation functions.
2018-08-22Fix a bug in nested vector concatenation patternsAlasdair Armstrong
2018-08-21C: Correctly handle the kinds of patterns generated by mappingsAlasdair Armstrong
This change allows the RISC-V spec to compile to C, but more testing is needed to ensure it works correctly.
2018-08-20Refactor tuple conversions in Sail to C compilationAlasdair Armstrong
Make the C l-expression type in Sail more generic and expressive, and refactor the generation of conversions into a seperate codegen_conversion function, which can handle more complex cases than the previous more ad-hoc method.
2018-08-20Add some more test cases for C compilationAlasdair Armstrong
Test that basic bi-directional mappings compile correctly Test that a minimal file importing the prelude compiles correctly
2018-08-18Correctly handle specialising polymorphic types in nested unionsAlasdair
Ensure that this works even when the union types are dependent in the wrong order, before topologically sorting definitions. We do this by calling fix_variant_ctyps on all cdefs by passing a list of prior cdefs to specialize_variants.
2018-08-18Correctly specialise type annotation in polymorphic functionsAlasdair
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-08-14Improve error messages from C backend, and fix issues with assigning to pointersAlasdair Armstrong
2018-08-14Merge remote-tracking branch 'origin/sail2' into polymorphic_variantsAlasdair Armstrong
2018-08-13Sort ctype_defs in dependency order after specialisationAlasdair
We now generate anonymous types in the correct order, but post specialisation more dependencies can occur between named types, so an additional sorting step is needed to ensure that these happen in the correct order. In theory we could end up with circular dependencies here that don't exist at the Sail source level, but this shouldn't occur often (or ever) in practice. I think this is fixable but it would require some code generator changes.
2018-08-09Fix a bug by ensuring that monomorphic variant constructors do not get ↵Alasdair Armstrong
lifted types Add a test case for nested variant constructors
2018-08-09Fix bugs involving multi-argument variant type constructorsAlasdair Armstrong
2018-08-07Lem: print more bitvector typesBrian Campbell
Especially for return expressions, which fixes a test case
2018-08-06Add a simple test case for polymorphic variant typeAlasdair Armstrong
2018-07-27Coq: patterns on bit literalsBrian Campbell
2018-07-26Some tweaks to not and or patternsAlasdair Armstrong
- Fix ambiguities in parser.mly - Ensure that no new identifiers are bound in or-patterns and not-patterns, by adding a no_bindings switch to the environment. These patterns shouldn't generate any bogus flow typing constraints because we just pass through the original environment without adding any possible constraints (although this does mean we don't get any flow typing from negated numeric literals right now, which is a TODO). - Reformat some code to match surrounding code. - Add a typechecking test case for not patterns - Add a typechecking test case for or patterns At least at the front end everything should work now, but we need to do a little bit more to rewrite these patterns away for lem etc.
2018-07-24Merge branch 'c_fixes' into sail2Alasdair Armstrong
2018-07-24Merge remote-tracking branch 'origin/sail2' into c_fixesAlasdair Armstrong
2018-07-24Move monomorphisation after mapping rewritesBrian Campbell
Fixes monomorphisation on files using mappings. Also extended constant propagation to handle pattern matches on bitvector expressions (because an earlier rewrite replaces the literals). Also moved L_undef rewriting because monomorphisation can handle them but not the replacement functions.
2018-07-23Coq test for a few non-trivial atom typesBrian Campbell
2018-07-23Coq: make all pattern matches in the output exhaustiveBrian Campbell
Uses previous stage to deal with (e.g.) guards. New option -dcoq_warn_nonex tells you where all of the extra default cases were added.
2018-07-12make unziping freebsd kernel more robust if run again.Robert Norton
2018-07-12Fixes for ARM Sail tests, and get_time_ns for interpreterAlasdair
2018-07-11Add FreeBSD boot to mips test suite.Robert Norton
2018-07-11Update CHERI code extraction from IsabelleThomas Bauereiss
Also use zero-initialised memory. Apparently some tests access unitialised memory, and the default behaviour of the Lem shallow embedding is to fail in this case.
2018-07-09Update CHERI code generation from IsabelleThomas Bauereiss
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-07-07Add the lrsc tests from riscv-tests.Prashanth Mundkur
2018-07-07Coq: bbv have reorganised their repositoryBrian Campbell
2018-07-05Fix equality comparisons for structsAlasdair
Add a test case in test/c/eq_struct.sail. Ensure that the macro EQUAL(type) will always give a valid equality function for any builtin type in sail.h.
2018-07-05Fix CHERI test that was failing when compiled to CAlasdair Armstrong
Non bitvector literals for decreasing vectors were not being reversed correctly, so the list of capability registers was effectively in reverse order. Added a test case to test/c/ based on this aspect of CHERI
2018-07-03Fix a bug in foreach loopsAlasdair Armstrong
We should test before the first iteration in case 'to' starts out as less than 'from'.