Commit Graph

192 Commits

Author SHA1 Message Date
pedrocarlo
c072b0314b fix shrinking 2025-09-18 12:00:18 -03:00
pedrocarlo
27a8f019c6 clippy 2025-09-17 10:49:24 -03:00
pedrocarlo
6039a30222 fix double create failure 2025-09-17 10:49:24 -03:00
pedrocarlo
81cff3e3d7 fix shrinking to use a secondary index that points to the Property that generated the interactions 2025-09-17 10:49:24 -03:00
pedrocarlo
f95ac87f06 simplify code for differential testing 2025-09-17 10:49:24 -03:00
pedrocarlo
4d9e676f65 simplify run_simualtion signature + remove watch mode file as it shares logic with default run simulation logic 2025-09-17 10:49:24 -03:00
pedrocarlo
b98c22a90e run simulation on the total list of interactions to avoid recomputing whole vec of interactions on each loop + change state management in preparation for multiple connections change 2025-09-17 10:49:24 -03:00
pedrocarlo
faf38fe196 add connection Index to interaction struct 2025-09-17 10:49:24 -03:00
pedrocarlo
7e02fbe7e7 make assertion to be cloneable 2025-09-17 10:49:24 -03:00
pedrocarlo
77cab30c5b add connection index to interaction 2025-09-17 10:49:24 -03:00
pedrocarlo
5f24ff6e45 fix non determinism by using IndexSet for order preserving iteration 2025-09-05 02:00:18 -03:00
pedrocarlo
8c7da3a704 impl SimIO for SimulatorIO 2025-09-01 11:11:03 -03:00
pedrocarlo
4f2bc96dbe add Faultless profile 2025-08-30 13:07:19 -03:00
pedrocarlo
5881ee71d6 clippy 2025-08-30 12:21:37 -03:00
pedrocarlo
61fa7546c1 fold some SimulatorOpts fields to Profile 2025-08-30 11:31:52 -03:00
pedrocarlo
463eb1fefd simplify profile weights for writes 2025-08-30 11:31:52 -03:00
pedrocarlo
2f237fdcfd adjust remaining calculation to use the profile 2025-08-30 11:31:52 -03:00
pedrocarlo
962666831b read Profile file from path or use predefined profiles 2025-08-30 11:31:52 -03:00
pedrocarlo
06b923d0c1 adjust simulator to use correct trait signature 2025-08-30 11:31:52 -03:00
pedrocarlo
e0552629e3 create Generation Options structs 2025-08-30 11:31:52 -03:00
pedrocarlo
8010b7d0c7 make simulator use sql_generation crate as dependency 2025-08-25 22:59:31 -03:00
Jussi Saurio
97657a86b3 Do not assume error message content in FaultyQuery 2025-08-19 12:49:01 +03:00
pedrocarlo
d96a26aef9 Property TableHasExpectedContent should just check the expected
content on runtime, not generation time
2025-08-18 16:00:59 -03:00
pedrocarlo
59da828362 do not shadow FaultyQuery's immediately. Only shadow them later 2025-08-18 12:40:02 -03:00
pedrocarlo
6388ed2017 FaultyQuery enabled by default 2025-08-18 11:52:10 -03:00
Jussi Saurio
6c17fa2a5e fix/sim: prevent sim from trying to create an existing table or index
We recently merged a change that panics the sim on parse errors, because
not doing so has masked many scenarios where the sim unintentionally
creates incorrect sql and we just ignore it.

We already have Property::DoubleCreateFailure to assert that the same table
cannot be created twice, so this should not hide any bugs.
2025-08-17 18:13:05 +03:00
Jussi Saurio
0a3ebf8914 Fail simulator on parse errors 2025-08-16 10:27:10 +03:00
PThorpe92
2810b5d8a2 Add --keep-files flag and force Drop of database in simulator to prevent issues with the Registry 2025-08-15 17:54:40 -04:00
pedrocarlo
2bc6edc3d4 introduce TableContext for the simulator to properly generate predicates for Joins 2025-08-15 23:44:00 +03:00
Jussi Saurio
3760d44c13 sim: force compound selects to have the same number of result columns 2025-08-15 23:43:38 +03:00
Jussi Saurio
96072509f5 sim: add Property::TableHasExpectedContent 2025-08-15 11:16:31 +03:00
Jussi Saurio
4c76191fec fix/sim: fix incorrect implementation of compound select generation
Problem:

sim was generating compound selects like this:

- pick a random `table`
- create a random single SELECT
- create `n` random compound SELECTs (UNION ALL etc)

assign a WHERE clause that always has a condition based on `table`

This can result in e.g.

```
SELECT a FROM foo WHERE bar.x = 'baz'
```

Solution:

Don't base the WHERE clause on a table that might not be referenced
in the query.

Again, the only reason this wasn't caught before was because `FaultyQuery`
and `FsyncNoWait` are the only paths where this is actually tested with an
assertion, and those are both disabled
2025-08-15 10:48:42 +03:00
Jussi Saurio
165f2aed23 make big joins even less likely 2025-08-14 19:35:16 +03:00
Jussi Saurio
f5438d14de make big compound selects even less likely 2025-08-14 19:35:16 +03:00
Jussi Saurio
aed48bb665 sim: reduce frequency of compound selects and complex joins 2025-08-14 19:35:16 +03:00
Jussi Saurio
1a11648974 sim: add Property::ReadYourUpdatesBack 2025-08-14 19:04:27 +03:00
Jussi Saurio
0b9d07db4c sim: restrict Update::arbitrary_from() to SET each column max once 2025-08-14 18:55:34 +03:00
bit-aloo
9a54ef214e parser: Distinguish quoted identifiers and unify Id into Name enum
This commit replaces the `Name(pub String)` struct with a `Name` enum that
explicitly models how the name appeared in the source either as an
unquoted identifier (`Ident`) or a quoted string (`Quoted`).

In the process, the separate `Id` wrapper type has been coalesced into the
`Name` enum, simplifying the AST and reducing duplication in identifier
handling logic.

While this increases the size of some AST nodes (notably `yyStackEntry`),
it improves correctness and makes source structure more explicit for
later phases.
2025-07-24 14:40:19 +05:30
Jussi Saurio
d67a9f03fd sim: add order by to some queries 2025-07-18 10:47:36 +03:00
Jussi Saurio
746995f436 Merge 'Property FaultyQuery should fail if we encounter an error that is not expected' from Pedro Muniz
If we use `Assumption` here, the simulator just goes to the next
property instead of halting here.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #2147
2025-07-17 23:44:44 +03:00
Jussi Saurio
1b52b5c764 Merge 'chore: update rust to version 1.88.0' from Nils Koch
This PR updates to version Rust 1.88.0 ([Release
notes](https://releases.rs/docs/1.88.0/)) and fixes all the clippy
errors that come with the new Rust version.
This is possible in the latest Rust version:
```rust
if let Some(foo) = bar && foo.is_cool() {
  ...
}
```
There are three complications in the migration (so far):
- A BUNCH of Clippy warnings (mostly fixed in
https://github.com/tursodatabase/limbo/pull/1827)
- Windows cross compilation failed; linking `advapi32` on windows fixes
it
  - Since Rust 1.87.0, advapi32 is not linked by default anymore
([Release notes](https://github.com/rust-
lang/rust/blob/master/RELEASES.md#compatibility-notes-1),
[PR](https://github.com/rust-lang/rust/pull/138233))
- Rust is more strict with FFIs and aligning pointers now. CI checks
failed with error below
  - Fixed in https://github.com/tursodatabase/turso/pull/2064
```
thread 'main' panicked at
core/ext/vtab_xconnect.rs:64:25:
misaligned pointer dereference: address must be
a multiple of 0x8 but is 0x7ffd9d901554
```

Closes #1807
2025-07-17 23:35:33 +03:00
pedrocarlo
4aa2c1a579 Property should fail if we encounter an error that is not expected 2025-07-17 17:01:54 -03:00
Pekka Enberg
e8ac707190 simulator: Disable INSERT INTO .. SELECT for being slow
Refs #2129
2025-07-17 09:20:00 +03:00
Nils Koch
8dc066503e chore: fix clippy errors 2025-07-16 19:34:42 +01:00
Jussi Saurio
ea427b3b64 sim: provide additional context in assertion failures 2025-07-16 12:05:30 +03:00
alpaylan
04f5b91e87 fix faulty Update generation within delete_select 2025-07-16 00:06:35 -04:00
alpaylan
28ecb083e1 fix faulty Insert::Select generation within delete_select 2025-07-15 22:35:05 -04:00
alpaylan
9347e43dfc clippy + fmt 2025-07-15 09:57:55 -04:00
alpaylan
9a921ed4b9 make the large table smaller 2025-07-15 09:56:27 -04:00
alpaylan
6b96789b6d add random_expr for SELECT <expr>; 2025-07-14 18:48:02 -04:00