summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2019-02-11Add an additional test caseAlasdair
Make LEXP_deref an inference rule. This should allow strictly more programs to type-check.
2019-02-11Add tests for implicit argumentsAlasdair Armstrong
2019-02-08Add parameterization support for bitfields.Prashanth Mundkur
This supports the following syntax: type xlen : Int = 64 type ylen : Int = 1 type xlenbits = bits(xlen) bitfield Mstatus : xlenbits = { SD : xlen - ylen, SXL : xlen - ylen - 1 .. xlen - ylen - 3 }
2019-02-08Updates for asl_parserAlasdair Armstrong
Tweak colours of monomorphistion test output
2019-02-07Add a symbol for new implicit arguments for backwards compatabilityAlasdair Armstrong
Fix monomorphisation tests
2019-02-07Fix implicits in v8.2 public ARM specAlasdair Armstrong
2019-02-06Add typechecking test from MarkAlasdair Armstrong
2019-02-06Fix some testsAlasdair Armstrong
2019-02-04Test lem output by running end-to-end tests using ocaml via lemAlasdair Armstrong
2019-02-04Fix behavior for fallthrough cases in catch blocksAlasdair Armstrong
Make all backends behave the same when a catch block does not catch a specific exception.
2019-02-02Monomorphisation tests all pass so add them to standard regression testsAlasdair
2019-02-02Merge remote-tracking branch 'origin/sail2' into asl_flow2Alasdair
2019-02-01Add test cases for integer synonymsAlasdair
2019-01-31Monomorphisation: improve cast insertion and nexp rewriting on variantsBrian Campbell
It now pushes casts into lets and constructor applications, and so supports the case needed for RISC-V.
2019-01-31Support case splitting on variables as well as sizeof in cast introductionBrian Campbell
2019-01-29Merge branch 'sail2' into asl_flow2Thomas Bauereiss
2019-01-25Coq: add enough to generate some output for arm-v8.5-aBrian Campbell
Now supports mutual recursion, configuration registers (in the same way as Lem), boolean constraints (but produces some ugly stuff that the solver can't handle).
2019-01-22Add some more test casesAlasdair Armstrong
2019-01-21Pass Lem library path to IsabelleThomas Bauereiss
2019-01-21Don't require manual set up of Isabelle session directoriesThomas Bauereiss
Since Isabelle 2018, specifying the same directory both on the command line and persistently in the user's ROOTS file is allowed, so we don't have to choose between one or the other any more.
2019-01-14Merge remote-tracking branch 'origin/sail2' into asl_flow2Alasdair
2019-01-08Improvements for v85Alasdair Armstrong
2018-12-27Coq: avoid putting ambiguous numeric literals in Coq outputBrian Campbell
There are situations when we really want a more refined expression, such as 8 * n instead of 64 (when we know n = 8 from a case split), but we might not be able to generate it. For now we generate an underscore and let Coq figure it out from the context.
2018-12-27Coq: fix name clashes and instantiation calculationBrian Campbell
2018-12-26More error messages improvmentsAlasdair Armstrong
2018-12-22Improve error messages and debuggingAlasdair Armstrong
Work on improving the formatting and quality of error messages When sail is invoked with sail -i, any type errors now drop the user down to the interactive prompt, with the interactive environment being the environment at the point the type error occurred, this means the typechecker state can be interactively queried in the interpreter to help diagnose type errors.
2018-12-20Fix monomorpisation tests with typechecker changesAlasdair Armstrong
Add an extra argument for Type_check.prove for the location of the prove call (as prove __POS__) to help debug SMT related issues
2018-12-20RISVC model is now at https://github.com/rems-project/sail-riscv . Remove it ↵Robert Norton
and tests.
2018-12-19Coq: handle pairs of ranges (and other existential types) properlyBrian Campbell
(Needed for current CHERI.)
2018-12-18Ensure type-variables have consistent namesAlasdair
Type variables can now be lexically scoped and shadow each other like normal variables, rather than being required to be unique. This means we can use identifier names to choose names for type variables in a way where we can assume they remain consistent between type-checker runs. This means that re-writer steps can lift types out of annotations in E_aux constructors and put them directly as syntactic annotations in the AST - this should enable more robust rewrite steps. Also fix RISC-V lem build w/ flow typing changes
2018-12-18Revert "Experiment with generating type variable names in a repeatable way"Alasdair
This reverts commit 4d8a4078990a00ffdc018bc8f5d4d5e3dcf6527d.
2018-12-18Experiment with generating type variable names in a repeatable wayAlasdair Armstrong
This results in much better error messages, as we can pick readable names that make sense, and should hopefully make the re-writer more robust.
2018-12-18Store function instantiation information within annotations, so we don'tAlasdair
have to recompute it, which can be very expensive for very large specifications Also additional flow typing and fixes for boolean type variables
2018-12-17Changes for ASL parserAlasdair Armstrong
2018-12-14Add some experimental support for non-lexical flow-typing rulesAlasdair Armstrong
Add a file nl_flow.ml which can analyse a block of Sail expressions and insert constraints for flow-typing rules which do not follow the lexical structure of the code (and therefore the syntax-directed typing rules can't do any flow-typing for). A common case found in ASL translated Sail would be something like function decode(Rt: bits(4)) = { if Rt == 0xF then { throw(Error_see("instruction")); }; let t = unsigned(Rt); execute(t) } which would currently fail is execute has a 0 <= t <= 14 constraint for a register it writes to. However if we spot this pattern and add an assertion automatically: let t = unsigned(Rt); assert(t != 15); execute(t) Then everything works, because the assertion is in the correct place for regular flow typing. Currently it only works for this specific use-case, and is turned on using the -non_lexical_flow flag
2018-12-14Add a few more tests for JenkinsAlasdair Armstrong
Some of the output from the tests scripts is odd on Jenkins, try to fix this by flushing stdout more regularly in the test scripts
2018-12-14A few additional testsAlasdair
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-12Add a test for flow typing as found in the ARM 32-bit instructionsAlasdair Armstrong
2018-12-12Add a test case for various simple boolean propertiesAlasdair Armstrong
test/typecheck/pass/tautology.sail constaints tests of various boolean properties, e.g. // de Morgan _prove(constraint(not('p | 'q) <--> not('p) & not('q))); _prove(constraint(not('p & 'q) <--> not('p) | not('q))); introduce a new _not_prove case which allows us to assert in tests that a constraint is not provable. This test essentially tests that constraints map to sensible problems in the SMT solver, without testing flow typing or any other features. Add a script test/typecheck/update_errors.sh, which regenerates the expected error messages. Testing that type-checking failures is important, but can be brittle when the error messages change for inconsequential reasons. This script automates fixing this. Also ensure that this test case works correctly in Lem
2018-12-12Get typechecking example with boolean argument flow-typing workingAlasdair
2018-12-11Fix all tests with type checking changesAlasdair Armstrong
2018-12-11Fix most remaining tests on branchAlasdair
2018-12-10Various changes:Alasdair Armstrong
* Improve type inference for numeric if statements (if_infer test) * Correctly handle constraints for existentially quantified constructors (constraint_ctor test) * Canonicalise all numeric types in function arguments, which triggers some weird edge cases between parametric polymorphism and subtyping of numeric arguments * Because of this eq_int, eq_range, and eq_atom etc become identical * Avoid duplicating destruct_exist in Env * Handle some odd subtyping cases better
2018-12-08Compiling againAlasdair
Change Typ_arg_ to A_. We use it a lot more now typ_arg is used instead of uvar as the result of unify. Plus A_ could either stand for argument, or Any/A type which is quite appropriate in most use cases. Restore instantiation info in infer_funapp'. Ideally we would save this instead of recomputing it ever time we need it. However I checked and there are over 300 places in the code that would need to be changed to add an extra argument to E_app. Still some issues causing specialisation to fail however. Improve the error message when we swap how we infer/check an l-expression, as this could previously cause the actual cause of a type-checking failure to be effectively hidden.
2018-12-06Re-factor initial checkAlasdair Armstrong
Mostly this is to change how we desugar types in order to make us more flexible with what we can parse as a valid constraint as type. Previously the structure of the initial check forced some awkward limitations on what was parseable due to how the parse AST is set up. As part of this, I've taken the de-scattering of scattered functions out of the initial check, and moved it to a re-writing step after type-checking, where I think it logically belongs. This doesn't change much right now, but opens up some more possibilities in the future: Since scattered functions are now typechecked normally, any future module system for Sail would be able to handle them specially, and the Latex documentation backend can now document scattered functions explicitly, rather than relying on hackish 'de-scattering' logic to present documentation as the functions originally appeared. This has one slight breaking change which is that union clauses must appear before their uses in scattered functions, so union ast = Foo : unit function clause execute(Foo()) is ok, but function clause execute(Foo()) union ast = Foo : unit is not. Previously this worked because the de-scattering moved union clauses upwards before type-checking, but as this now happens after type-checking they must appear in the correct order. This doesn't occur in ARM, RISC-V, MIPS, but did appear in Cheri and I submitted a pull request to re-order the places where it happens.
2018-12-03Fix = / == in a couple of monomorphisation testsBrian Campbell
2018-11-30Remove constraint synonymsAlasdair Armstrong
They weren't needed for ASL parser like I thought they would be, and they increase the complexity of dealing with constraints throughout Sail, so just remove them. Also fix some compiler warnings
2018-11-30Parser tweaks and fixesAlasdair Armstrong
- Completely remove the nexp = nexp syntax in favour of nexp == nexp. All our existing specs have already switched over. As part of this fix every test that used the old syntax, and update the generated aarch64 specs - Remove the `type when constraint` syntax. It just makes changing the parser in any way really awkward. - Change the syntax for declaring new types with multiple type parameters from: type foo('a : Type) ('n : Int), constraint = ... to type foo('a: Type, 'n: Int), constraint = ... This makes type declarations mimic function declarations, and makes the syntax for declaring types match the syntax for using types, as foo is used as foo(type, nexp). None of our specifications use types with multiple type parameters so this change doesn't actually break anything, other than some tests. The brackets around the type parameters are now mandatory. - Experiment with splitting Type/Order type parameters from Int type parameters in the parser. Currently in a type bar(x, y, z) all of x, y, and z could be either numeric expressions, orders, or types. This means that in the parser we are severely restricted in what we can parse in numeric expressions because everything has to be parseable as a type (atyp) - it also means we can't introduce boolean type variables/expressions or other minisail features (like removing ticks from type variables!) because we are heavily constrained by what we can parse unambigiously due to how these different type parameters can be mixed and interleaved. There is now experimental syntax: vector::<'o, 'a>('n) <--> vector('n, 'o, 'a) which splits the type argument list into two between Type/Order-polymorphic arguments and Int-polymorphic arguments. The exact choice of delimiters isn't set in stone - ::< and > match generics in Rust. The obvious choices of < and > / [ and ] are ambigious in various ways. Using this syntax right now triggers a warning. - Fix undefined behaviour in C compilation when concatenating a 0-length vector with a 64-length vector.