about summary refs log tree commit diff
path: root/tvix/eval/src/tests (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-01-25 r/7451 feat(tvix/eval/tvix_tests): add some more xml testsFlorian Klink2-0/+48
https: //cl.tvl.fyi/c/depot/+/10686/comment/ea582dae_574d6c3f/ Change-Id: Iac74abbf2f2e0327bc9ddf9dcc6bb43f918a1c63 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10689 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2024-01-25 r/7449 feat(tvix/eval/tests): compare .xml outputsFlorian Klink4-20/+29
In case a .exp.xml file is provided alongside the test, compare its output with the desired state. Also, add some function .exp.xml that were presumably moved out of the way back to src/tests/nix_tests, as they now produce the correct XML output. Change-Id: Ibd8123f3e6ed7bae3a44407d2284a2b2c8ce9a28 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10687 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2024-01-25 r/7448 feat(tvix/eval): track pattern binding namesFlorian Klink2-0/+0
These need to be preserved at least for builtins.toXML. Also, we incorrectly only wrote an <attrspat> in case ellipsis was true, but that's not the case. Change-Id: I6bff9c47c2922f878d5c43e48280cda9c9ddb692 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10686 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: aspen <root@gws.fyi>
2024-01-24 r/7445 fix(tvix/eval/tests): fix eval-okay-getenvFlorian Klink3-0/+2
This relies on TEST_VAR=foo being set to "foo". Nix does this in tests/functional/lang.sh, we do it in the test suite. Change-Id: I7ffa9ed27124530b7758aeadf07c79477656f34f Reviewed-on: https://cl.tvl.fyi/c/depot/+/10683 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2024-01-23 r/7441 docs(tvix/eval/tests): update commentFlorian Klink1-2/+1
There's no `expected_failures` feature, we run them unconditionally. Change-Id: Ibe1c93497e040d0d5b6cbfcaa043027814c191f1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10681 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
2024-01-18 r/7409 refactor(tvix/eval): move Evaluation::{default,new_pure}() againFlorian Klink2-6/+3
Have a Evaluation::new() function that's used to set up the Evaluation struct initially - which is also used by both new_pure and new_impure internally. It's generic over the exact type of IO, making it easier to instantiate Evaluation with non-tvix-eval EvalIO implementations, that might not be in a Box. Change-Id: Ibf728da24aca59639c5b6df58d00ae98c99a63f5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10640 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2024-01-18 r/7407 refactor(tvix/eval): generalize EvalIO containerFlorian Klink1-2/+2
Don't restrict to a Box<dyn EvalIO>. There's still one or two places where we do restrict, this will be solved by b/262. Change-Id: Ic8d927d6ea81fa12d90b1e4352f35ffaafbd1adf Reviewed-on: https://cl.tvl.fyi/c/depot/+/10639 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2024-01-17 r/7404 feat(tvix/glue): introduce test suite for context stringsRyan Lahfa1-8/+0
This is an additional test suite on the top of the Nix ones for context strings matters. It already smoked out multiple mistakes and potential bugs and non-deterministic result from the evaluator. It uses a similar technology as the one in the tvix-eval albeit we instantiate a fully fledged evaluator with in-memory store. We copy the files instead of symlinking them because crates are built in isolation, so symlinks cannot work. Change-Id: I63ae225ce4f83c6e2c8ccd60d779c2f8eb9d08fb Reviewed-on: https://cl.tvl.fyi/c/depot/+/10619 Autosubmit: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2024-01-17 r/7398 feat(tvix/eval): move away from `test_generator` to `rstest`Ryan Lahfa1-28/+43
`test-generator` has not been updated in the past 2 years. `rstest` has not been updated in the past 5 months. This is an improvement in the maintenance state… I guess? We get also new features, it changes the name of the tests with numbers too. Change-Id: I5376104c7704f525dba7524da78daa09867cc669 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10623 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-12-31 r/7290 feat(tvix/eval): accept impl AsRef<str> for codeFlorian Klink1-1/+1
We're also happy to consume strings, or other owned stringy types. Change-Id: I5bead4407976134815d8f879f9f70468e6af1dc4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10476 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-12-31 r/7289 refactor(tvix/eval): remove code and location from structFlorian Klink2-9/+11
Instead, it's passed in the evaluate/compile_only functions, which feels more naturally. It lets us set up the Evaluation struct long before we actually feed it with data to evaluate. Now that Evaluation::new() would be accepting an empty list of arguments, we can simply implement Default, making things a bit more idiomatic. Change-Id: I4369658634909a0c504fdffa18242a130daa0239 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10475 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>
2023-12-29 r/7277 fix(tvix/eval): propagate catchables through builtins.attrNamesAdam Joseph2-0/+2
Change-Id: Id14e39543239272aed041998fd9a78465c9cb8b2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10359 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2023-12-29 r/7276 fix(tvix/eval): propagate catchables through builtins.intersectAttrsAdam Joseph2-0/+2
Change-Id: I4ada8cf10611e98519cb1b1da11bfd06815f2932 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10358 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2023-12-29 r/7275 fix(tvix/eval): propagate catchables in string interpolationsAdam Joseph2-0/+2
Change-Id: I13d7ce0c7328a8e6fbc6d2c4ff5c4fe6095b96ea Reviewed-on: https://cl.tvl.fyi/c/depot/+/10357 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2023-12-29 r/7274 fix(tvix/eval): catchable in type field of nix_eq()Adam Joseph2-0/+2
Change-Id: I165ff77764e272cc94d18cb03ad6cbc9a8ebefde Reviewed-on: https://cl.tvl.fyi/c/depot/+/10348 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2023-12-29 r/7273 fix(tvix/eval): builtins.match: propagate catchablesAdam Joseph2-0/+2
Change-Id: I14c9e625c91369e10d0c00380dca992811ae9059 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10346 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI
2023-12-25 r/7264 fix(tvix/eval/value): correctly emit spaces when coercing listssterni2-14/+19
r/7176 introduced an incorrect assumption was the benefit of the nonrecursive coercion algorithm, namely that a coercion operation always returns a non empty string. This allows to detect whether we are coercing a list or not by checking if the intermediate result is empty or not. Unfortunately, coercing null and false yields an empty string, so we need to explicitly track whether we are coercing a list. Updated the test case to hopefully catch similar bugs in the future. I'm not a hundred percent certain I have not introduced a new edge case with this, so it may be interesting to add a prop test case for this to nix_oracle down the line. At least lists are the only nested data structures that can be serialized as nested data structures, so the problem is kind of limited. Change-Id: Ia41e904356f1c41a9d35e4e65ec02f2fe5a4100e Reviewed-on: https://cl.tvl.fyi/c/depot/+/10418 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2023-12-12 r/7205 fix(tvix/eval): substring: propagate catchablesAdam Joseph2-0/+2
Change-Id: Ia9b7858c817fbc9c95a3d1c2855b2445f7830e8d Reviewed-on: https://cl.tvl.fyi/c/depot/+/10326 Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7204 fix(tvix/eval): baseNameOf: propagate catchablesAdam Joseph2-0/+2
Change-Id: Id8dc772ea8f338dfd243210f4108f79072570c3b Reviewed-on: https://cl.tvl.fyi/c/depot/+/10324 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7203 fix(tvix/eval): builtins.length: propagate catchablesAdam Joseph2-0/+2
This commit fixes out builtins.length so it propagates catchables like cppnix does. Change-Id: I7670bec5eee1d4cd3f67a04c9a6808979fb56a8d Reviewed-on: https://cl.tvl.fyi/c/depot/+/10315 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI
2023-12-12 r/7201 fix(tvix/eval): builtins.filter: propagate catchablesAdam Joseph2-0/+2
This commit fixes builtins.filter so it propagates catchables correctly. Change-Id: Ib23a383bc5e272e42052205ffd1e94649a0ebc47 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10313 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7199 fix(tvix/eval): builtins.getAttr: propagate catchablesAdam Joseph2-0/+2
Change-Id: I84b6b8f8568d57614a03aff0d6069e0bc27357bf Reviewed-on: https://cl.tvl.fyi/c/depot/+/10310 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com>
2023-12-12 r/7198 fix(tvix/eval): builtins.elemAt: propagate catchablesAdam Joseph2-0/+2
This commit fixes builtins.elemAt so it propagates catchables like cppnix does. Change-Id: Ieca5e128da17e78af0b14dae4a28a1ff8796e4f2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10308 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7196 fix(tvix/eval): propagate catchables through builtins.splitVersionAdam Joseph2-0/+2
This fixes our implementation of builtins.splitVersion so it propagates catchables like cppnix does. Change-Id: Id5d83ea76229f8c8f202aa42353cb609e67de43f Reviewed-on: https://cl.tvl.fyi/c/depot/+/10305 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7192 fix(tvix/eval): propagate catchables through `&&`Adam Joseph2-0/+2
Change-Id: I7bb5ac1ef47b41c47269e64cee0e90eb64c6fcce Reviewed-on: https://cl.tvl.fyi/c/depot/+/10322 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7191 fix(tvix/eval): make `||` propagate catchablesAdam Joseph2-0/+2
Change-Id: I42f994d7c9228368d5f6c30c4730c24666f7bc69 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10320 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7190 fix(tvix/eval): fix nested assertions b/340Adam Joseph2-0/+0
This commit fixes our handling of `throw` within an `assert` condition. Fixes: b/340 Change-Id: I40a383639ec266da50a853f16216b1b7868495da Reviewed-on: https://cl.tvl.fyi/c/depot/+/10318 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7189 fix(tvix/eval): `?`: propagate catchablesAdam Joseph2-0/+2
This commit fixes out `?` operator so it correctly propagates catchables. Change-Id: Iebaa153a8492101ee3ddd29893c98730ff331547 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10317 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-12-12 r/7187 fix(tvix/eval): calling a catchable is catchableAdam Joseph2-0/+2
When attempting to call a Value, if it is a Value::Catchable we must not cause an uncatchable failure. This commit simply reuses the Value::Catchable as the result of attempting to call it. This is safe because nix is designed so that nix code cannot distinguish between different catchable failures -- they all look the same to the interpreted code. This fixes b/351. Change-Id: Ibf763a08753e541843626182ff59fdbf15ea2959 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10300 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7186 fix(tvix/eval): fix catchables in named formalsAdam Joseph2-0/+0
Fixes b/348. Change-Id: I5e8d56b5fd26a19eac32ec5e11baf93765691dc8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10296 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-12-12 r/7185 test(tvix/eval): test catchables in named formalsAdam Joseph2-0/+2
Relates to b/348. $ /git/depot/result/bin/tvix -E '(builtins.tryEval (({ fred }: "bob") (throw "3"))).success' note: while evaluating this Nix code --> [code]:1:1 | 1 | (builtins.tryEval (({ fred }: "bob") (throw "3"))).success | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: while evaluating this as native code (force) --> [code]:1:1 | 1 | (builtins.tryEval (({ fred }: "bob") (throw "3"))).success | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: while evaluating this as native code (tryEval) --> [code]:1:2 | 1 | (builtins.tryEval (({ fred }: "bob") (throw "3"))).success | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: while evaluating this Nix code --> [code]:1:20 | 1 | (builtins.tryEval (({ fred }: "bob") (throw "3"))).success | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E006]: expected value of type 'set', but found a 'internal[catchable]' --> [code]:1:21 | 1 | (builtins.tryEval (({ fred }: "bob") (throw "3"))).success | ^^^^^^^^ Change-Id: I730fdd996f7e1b81dbbf83dc1524104a8cad2f78 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10295 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com>
2023-12-12 r/7184 fix(tvix/eval): fix testing catchables for inequalityAdam Joseph2-0/+0
Fixes b/347. Change-Id: Icad0251884d4d8adcdf8d690b91385bf4896f9c8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10294 Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7183 test(tvix/eval): testing catchable for inequalityAdam Joseph2-0/+2
Relates to b/347. $ /git/depot/result/bin/tvix -E '(builtins.tryEval (throw "bob" != 3)).success' note: while evaluating this Nix code --> [code]:1:1 | 1 | (builtins.tryEval (throw "bob" != 3)).success | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: while evaluating this as native code (force) --> [code]:1:1 | 1 | (builtins.tryEval (throw "bob" != 3)).success | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: while evaluating this as native code (tryEval) --> [code]:1:2 | 1 | (builtins.tryEval (throw "bob" != 3)).success | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E006]: expected value of type 'bool', but found a 'internal[catchable]' --> [code]:1:20 | 1 | (builtins.tryEval (throw "bob" != 3)).success | ^^^^^^^^^^^^^^^^ Change-Id: Ide19b3ddaf314ef310efc2fe5ac36667e43011dc Reviewed-on: https://cl.tvl.fyi/c/depot/+/10293 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI
2023-12-12 r/7182 fix(tvix/eval): handle catchables in attribute set updatesAdam Joseph2-0/+0
Fixes b/346. Change-Id: I277121d2363e605ebe09651ed9440fe1bc126c8c Reviewed-on: https://cl.tvl.fyi/c/depot/+/10292 Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7181 test(tvix/eval): test for catchable in attribute mergesAdam Joseph2-0/+2
Relates to b/346. $ /git/depot/result/bin/tvix -E '(builtins.tryEval (throw "bob" // { })).success' note: while evaluating this Nix code --> [code]:1:1 | 1 | (builtins.tryEval (throw "bob" // { })).success | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: while evaluating this as native code (force) --> [code]:1:1 | 1 | (builtins.tryEval (throw "bob" // { })).success | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: while evaluating this as native code (tryEval) --> [code]:1:2 | 1 | (builtins.tryEval (throw "bob" // { })).success | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E006]: expected value of type 'set', but found a 'internal[catchable]' --> [code]:1:20 | 1 | (builtins.tryEval (throw "bob" // { })).success | ^^^^^^^^^^^^^^^^^^ Change-Id: Ib84c4ec6d2612d4f1f6066e66c3dd1bf04369b6e Reviewed-on: https://cl.tvl.fyi/c/depot/+/10291 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com>
2023-12-12 r/7180 fix(tvix/eval): fix recovering from throws in implicationsAdam Joseph2-0/+0
This fixes b/345. Change-Id: Ic0d3b6ffacd2a5e0050d22354d08320b69a4fe13 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10290 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: Adam Joseph <adam@westernsemico.com>
2023-12-12 r/7179 test(tvix/eval): test recovering from throw in implicationsAdam Joseph2-0/+2
error[E006]: expected value of type 'bool', but found a 'internal[catchable]' --> src/tests/tvix_tests/notyetpassing/eval-okay-test-catchables-in-implications.nix:1:43 | 1 | (builtins.tryEval (({ foo ? throw "up" }: foo -> true) { })).success | ^^^^^^^^^^^ Relates to b/345 Change-Id: Ic331c32ea59bf67ae775f485b444dc6804ca13d5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10289 Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7178 fix(tvix/eval): fix branching on catchable defaults (b/343)Adam Joseph2-0/+0
This commit adds Opcode::OpJumpIfCatchable, which can be inserted ahead of most VM operations which expect a boolean on the stack, in order to handle catchables in branching position properly. Other than remembering to patch the jump, no other changes should be required. This commit also fixes b/343 by emitting this new opcode when compiling if-then-else. There are probably other places where we need to do the same thing. Change-Id: I48de3010014c0bbeba15d34fc0d4800e0bb5a1ef Reviewed-on: https://cl.tvl.fyi/c/depot/+/10288 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: Adam Joseph <adam@westernsemico.com>
2023-12-12 r/7177 test(tvix/eval): test branching on catchable defaults (b/343)Adam Joseph2-0/+2
This is a test case for b/343, wherein tvix dies if you try to branch on an argument whose defaulted value is a catchable. Change-Id: I891ca825e39ad14dda9f220f06d9591874fcd45d Reviewed-on: https://cl.tvl.fyi/c/depot/+/10287 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI
2023-12-12 r/7173 test(tvix/eval): nested assertions (b/340)Adam Joseph2-0/+2
Change-Id: I898d7056877a6370d5720b633df416f54e7cf65f Reviewed-on: https://cl.tvl.fyi/c/depot/+/10222 Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su>
2023-12-12 r/7169 fix(tvix/eval): preserve catchables in nix_cmp_ordering(), fix b/338Adam Joseph2-0/+0
This commit fixes b/338 by properly propagating catchables through comparison operations. Change-Id: I6b0283a40f228ecf9a6398d24c060bdacb1077cf Reviewed-on: https://cl.tvl.fyi/c/depot/+/10221 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com>
2023-12-12 r/7168 test(tvix/eval): test for b/338 catchable hygiene problemAdam Joseph2-0/+2
Commit 05f42519b53575ad3235b5e0a0cd7d71f04076a5 fixed b/281 by establishing a hygiene regimen to partition *catchable* errors (i.e. those which tryEval can detect) from all other errors, like internal VM failures or I/O errors (which Nix must not be allowed to detect, since these errors are fundamentally impure). Unfotunately there are still cases where tvix assumes that anything other than Value::Bool means it should panic!(). I found another one, and added a test case for it in: eval_okay_src_tests_tvix_tests_eval_okay_compare_ordering_catchable_nix Not yet passing. Change-Id: I69c62ed9ea5c8f81870e8de5c5fe12dcde849763 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10220 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-12-12 r/7167 feat(tvix/eval): nonrecursive nix_cmp_ordering(), fixes b/339Adam Joseph2-0/+0
This commit rewrites Value::nix_cmp_ordering() into an equivalent nonrecursive form. Except for calls to Thunk::force(), the new form no longer uses generators, and is async only because of the fact that it calls Thunk::force(). I originally believed that this commit would make evaluation faster. In fact it is slightly slower. I believe this is due to the added vec![] allocation. I am investigating. Prev-Nixpkgs-Benchmark: {"attrpath":"pkgsCross.aarch64-multiplatform.hello.outPath","peak-kbytes":"460048","system-seconds":"0.68","user-seconds":"5.73"} This-Nixpkgs-Benchmark: {"attrpath":"pkgsCross.aarch64-multiplatform.hello.outPath","peak-kbytes":"460224","system-seconds":"0.67","user-seconds":"5.84"} Change-Id: Ic627bc220d9c5aa3c5e68b9b8bf199837cd55af5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10212 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com>
2023-12-12 r/7165 test(tvix/eval): add test case for b/339Adam Joseph2-0/+2
Not yet passing. Change-Id: I1de3f72d8b3f46567fdba010fc3ab4bace3f1699 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10219 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2023-09-26 r/6662 feat(tvix/eval): test case for b/281Adam Joseph2-0/+2
This commit adds a test case for b/281. Change-Id: I8dfbfc0ff636184d7882530d8aefb329a3af9e5c Reviewed-on: https://cl.tvl.fyi/c/depot/+/9288 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: flokli <flokli@flokli.de>
2023-09-24 r/6650 fix(tvix/eval): fix b/281 by adding Value::CatchableAdam Joseph1-4/+9
This commit makes catchable errors a variant of Value. The main downside of this approach is that we lose the ability to use Rust's `?` syntax for propagating catchable errors. Change-Id: Ibe89438d8a70dcec29e016df692b5bf88a5cad13 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9289 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI
2023-09-15 r/6589 fix(tvix/eval): update identifier quoting to match cppnix 2.17Adam Joseph11-2/+23
In cppnix 2.17, commit b72bc4a972fe568744d98b89d63adcd504cb586c, the libexpr pretty-printing routine was fixed so that it would no longer pretty-print attrsets with keywords in their attrnames incorrectly. This commit implements the corresponding fix for tvix, fixes our tests to work with cppnix>=2.17 oracles, and expands our test cases to cover all the keywords. Change-Id: I4b51389cd3a9c44babc8ab2a84b383b7b0b116ca Reviewed-on: https://cl.tvl.fyi/c/depot/+/9283 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2023-08-24 r/6523 fix(tvix/eval): off-by-one in replaceStringsLinus Heckemann2-1/+2
replaceStrings would previously fail to replace the last character in a string. Change-Id: I43a7c960945350b2e7a5b731b7fdb617723eb38f Reviewed-on: https://cl.tvl.fyi/c/depot/+/9151 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2023-08-11 r/6480 test(tvix/eval): check truncation direction of builtins.divsterni2-1/+24
builtins.div ought to truncate towards zero so that -(builtins.div a b) == builtins.div (-a) b -(builtins.div a b) == builtins.div a (-b) Change-Id: I8b7c08cd7f4fa8a1363c786d42c8d484f6cd133d Reviewed-on: https://cl.tvl.fyi/c/depot/+/9006 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-07-11 r/6405 docs(tvix): document when pointer equality is preserved in C++ Nixsterni4-5/+39
This explicitly documents behavior of C++ Nix that goes against the intuition you'd gather from this document: that e.g. a simple select from an attribute set causes a value to no longer be pointer equal to its former self. The point of documenting this is that we can show in a to be written section on the use of pointer equality in nixpkgs that pointer equality is only needed in a limited sense for evaluating it (C++ Nix's exterior pointer equality). Tvix's pointer equality is far more powerful since value identity preserving operations also preserve pointer equality, generally speaking (this is because we implement interior pointer equality in my made up terminology). This should eventually also be documented. Change-Id: I6ce7ef2d67b012f5ebc92f9e81bba33fb9dce7d0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8856 Tested-by: BuildkiteCI Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su>