test(tvix/eval): update C++ Nix test suite to current master

The language test suite actually doesn't require flakes and the
new features are mostly sensible (added builtins) as well as some
tests for regressions the C++ implementation experienced.

The path interpolation test is not included in this update because there
is no way to construct an location-independent .exp file for it (the C++
repo also doesn't have one). We may still want to implement that feature
eventually (in case rnix adds support for it).

The C++ Nix revision used is ac0fb38e8a5a25a84fa17704bd31b453211263eb.

Change-Id: I75f1e780ddeeee6f6b1f28cf3c66c288dca2c20c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7043
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
sterni 2022-10-19 16:36:28 +02:00 committed by clbot
parent e3637136d1
commit 8e188d6235
23 changed files with 94 additions and 32 deletions

View file

@ -0,0 +1 @@
500500

View file

@ -0,0 +1,3 @@
with import ./lib.nix;
builtins.foldl' (x: y: x + y) 0 (range 1 1000)

View file

@ -0,0 +1 @@
3

View file

@ -0,0 +1 @@
((_: _) 1) + ((__: __) 2)

View file

@ -0,0 +1 @@
3

View file

@ -0,0 +1,2 @@
((__curPosFoo: __curPosFoo) 1) + ((__curPosBar: __curPosBar) 2)

View file

@ -0,0 +1 @@
"23;24;23;23"

View file

@ -0,0 +1,9 @@
with import ./lib.nix;
let
n1 = builtins.floor 23.5;
n2 = builtins.ceil 23.5;
n3 = builtins.floor 23;
n4 = builtins.ceil 23;
in
builtins.concatStringsSep ";" (map toString [ n1 n2 n3 n4 ])

View file

@ -1,36 +1,35 @@
# RFC 7159, section 13.
builtins.fromJSON
''
{
"Image": {
"Width": 800,
"Height": 600,
"Title": "View from 15th Floor",
"Thumbnail": {
"Url": "http://www.example.com/image/481989943",
"Height": 125,
"Width": 100
"Video": {
"Title": "The Penguin Chronicles",
"Width": 1920,
"Height": 1080,
"EmbeddedData": [3.14159, 23493,null, true ,false, -10],
"Thumb": {
"Url": "http://www.example.com/video/5678931",
"Width": 200,
"Height": 250
},
"Animated" : false,
"IDs": [116, 943, 234, 38793, true ,false,null, -100],
"Latitude": 37.7668,
"Longitude": -122.3959
"Subtitle" : false,
"Latitude": 46.2051,
"Longitude": 6.0723
}
}
''
==
{ Image =
{ Width = 800;
Height = 600;
Title = "View from 15th Floor";
Thumbnail =
{ Url = http://www.example.com/image/481989943;
Height = 125;
Width = 100;
{ Video =
{ Title = "The Penguin Chronicles";
Width = 1920;
Height = 1080;
EmbeddedData = [ 3.14159 23493 null true false (0-10) ];
Thumb =
{ Url = "http://www.example.com/video/5678931";
Width = 200;
Height = 250;
};
Animated = false;
IDs = [ 116 943 234 38793 true false null (0-100) ];
Latitude = 37.7668;
Longitude = -122.3959;
Subtitle = false;
Latitude = 46.2051;
Longitude = 6.0723;
};
}

View file

@ -0,0 +1 @@
{ column = 11; file = "eval-okay-getattrpos-functionargs.nix"; line = 2; }

View file

@ -0,0 +1,4 @@
let
fun = { foo }: {};
pos = builtins.unsafeGetAttrPos "foo" (builtins.functionArgs fun);
in { inherit (pos) column line; file = baseNameOf pos.file; }

View file

@ -0,0 +1 @@
{ "1" = [ 9 ]; "2" = [ 8 ]; "3" = [ 13 29 ]; "4" = [ 3 4 10 11 17 18 ]; "5" = [ 0 23 26 28 ]; "6" = [ 1 12 21 27 30 ]; "7" = [ 7 22 ]; "8" = [ 14 ]; "9" = [ 19 ]; b = [ 16 25 ]; c = [ 24 ]; d = [ 2 ]; e = [ 5 6 15 31 ]; f = [ 20 ]; }

View file

@ -0,0 +1,5 @@
with import ./../lib.nix;
builtins.groupBy (n:
builtins.substring 0 1 (builtins.hashString "sha256" (toString n))
) (range 0 31)

View file

@ -1,10 +1,9 @@
with import ./lib.nix;
with builtins;
assert pathExists <nix/buildenv.nix>;
assert isFunction (import <nix/fetchurl.nix>);
assert length __nixPath == 6;
assert length (filter (x: x.prefix == "nix") __nixPath) == 1;
assert length __nixPath == 5;
assert length (filter (x: baseNameOf x.path == "dir4") __nixPath) == 1;
import <a.nix> + import <b.nix> + import <c.nix> + import <dir5/c.nix>

View file

@ -1 +1 @@
[ [ 42 77 147 249 483 526 ] [ 526 483 249 147 77 42 ] [ "bar" "fnord" "foo" "xyzzy" ] [ { key = 1; value = "foo"; } { key = 1; value = "fnord"; } { key = 2; value = "bar"; } ] ]
[ [ 42 77 147 249 483 526 ] [ 526 483 249 147 77 42 ] [ "bar" "fnord" "foo" "xyzzy" ] [ { key = 1; value = "foo"; } { key = 1; value = "fnord"; } { key = 2; value = "bar"; } ] [ [ ] [ ] [ 1 ] [ 1 4 ] [ 1 5 ] [ 1 6 ] [ 2 ] [ 2 3 ] [ 3 ] [ 3 ] ] ]

View file

@ -5,4 +5,16 @@ with builtins;
(sort lessThan [ "foo" "bar" "xyzzy" "fnord" ])
(sort (x: y: x.key < y.key)
[ { key = 1; value = "foo"; } { key = 2; value = "bar"; } { key = 1; value = "fnord"; } ])
(sort lessThan [
[ 1 6 ]
[ ]
[ 2 3 ]
[ 3 ]
[ 1 5 ]
[ 2 ]
[ 1 ]
[ ]
[ 1 4 ]
[ 3 ]
])
]

View file

@ -31,9 +31,9 @@
<attr name="f">
<function>
<attrspat>
<attr name="z" />
<attr name="x" />
<attr name="y" />
<attr name="z" />
</attrspat>
</function>
</attr>

View file

@ -0,0 +1 @@
{ "0" = { n = "0"; v = [ 5 23 29 ]; }; "1" = { n = "1"; v = [ 7 30 ]; }; "2" = { n = "2"; v = [ 18 ]; }; "4" = { n = "4"; v = [ 10 ]; }; "5" = { n = "5"; v = [ 15 25 26 31 ]; }; "6" = { n = "6"; v = [ 3 14 ]; }; "7" = { n = "7"; v = [ 12 ]; }; "8" = { n = "8"; v = [ 2 6 8 9 ]; }; "9" = { n = "9"; v = [ 0 16 ]; }; a = { n = "a"; v = [ 17 21 22 27 ]; }; c = { n = "c"; v = [ 11 24 ]; }; d = { n = "d"; v = [ 4 13 28 ]; }; e = { n = "e"; v = [ 20 ]; }; f = { n = "f"; v = [ 1 19 ]; }; }

View file

@ -0,0 +1,9 @@
with import ./../lib.nix;
let
str = builtins.hashString "sha256" "test";
in
builtins.zipAttrsWith
(n: v: { inherit n v; })
(map (n: { ${builtins.substring n 1 str} = n; })
(range 0 31))

View file

@ -0,0 +1,3 @@
# https://github.com/NixOS/nix/issues/6562
# Note that this file must not end with a newline.
a 1"$

View file

@ -3,5 +3,6 @@
http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz
http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz
https://ftp5.gwdg.de/pub/linux/archlinux/extra/os/x86_64/unzip-6.0-14-x86_64.pkg.tar.zst
ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz
]

View file

@ -44,7 +44,15 @@ let
# C++ Nix can't do TCO
"nix_tests/eval-okay-tail-call-1.nix" = true;
# Ordering change after 2.3
"nix_tests/eval-okay-xml.nix" = [ nix_latest ];
"nix_tests/eval-okay-xml.nix" = [ nix ];
# Missing builtins in Nix 2.3
"nix_tests/eval-okay-floor-ceil.nix" = [ nix ];
"nix_tests/eval-okay-groupBy.nix" = [ nix ];
"nix_tests/eval-okay-zipAttrsWith.nix" = [ nix ];
# Comparable lists are not in Nix 2.3
"nix_tests/eval-okay-sort.nix" = [ nix ];
# getAttrPos gains support for functionArgs-returned sets after 2.3
"nix_tests/eval-okay-getattrpos-functionargs.nix" = [ nix ];
};
runCppNixLangTests = cpp-nix: