about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-10-19T14·22+0200
committerclbot <clbot@tvl.fyi>2022-10-20T02·28+0000
commit292a751388b0a6e1695afb56d28c2109f1c0707e (patch)
treed1317f108b88eee2c2d06a6e2aba958f6a6af54d /tvix/eval
parentf991ff929401df79d4ad2320bf3e796c935e830a (diff)
test(tvix): nix-planned test verification using C++ Nix 2.3 and 2.11 r/5162
Reimplement the test discovery of the lang tests script in Nix which
allows for a more flexible skipping logic that can e.g. react to the C++
Nix version used. This allows us to run the test suite against both
C++ Nix 2.3 and the latest C++ Nix version 2.11. The latter is mainly
useful, so we can implement newer Nix features and still verify them
against the C++ implementation.

Change-Id: I30c802844133b86b5e49f5e4f4fefacdb6215e0e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7042
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/default.nix120
1 files changed, 0 insertions, 120 deletions
diff --git a/tvix/eval/default.nix b/tvix/eval/default.nix
index 7328ed7ee2c2..d8e180b7cf33 100644
--- a/tvix/eval/default.nix
+++ b/tvix/eval/default.nix
@@ -26,125 +26,5 @@ lib.fix (self: depot.third_party.naersk.buildPackage (lib.fix (naerskArgs: {
 
     passthru = { };
   });
-
-  passthru.cpp-nix-run-lang-tests = pkgs.stdenv.mkDerivation {
-    name = "cpp-nix-run-lang-tests";
-
-    src = ./src/tests;
-    dontConfigure = true;
-
-    nativeBuildInputs = [
-      pkgs.buildPackages.nix
-    ];
-
-    buildPhase = ''
-      chmod +x $scriptPath
-      patchShebangs --build $scriptPath
-
-      mkdir store var
-      export NIX_STORE_DIR="$(realpath store)"
-      export NIX_STATE_DIR="$(realpath var)"
-
-      $scriptPath
-    '';
-
-    installPhase = "touch $out";
-
-    passAsFile = [ "script" ];
-    script = ''
-      #!/usr/bin/env bash
-      # SPDX-License-Identifier: LGPL-2.1-only
-      # SPDX-FileCopyrightText: © 2022 The TVL Contributors
-      # SPDX-FileCopyrightText: © 2004-2022 The Nix Contributors
-      #
-      # Execute language tests found in tvix_tests and nix_tests
-      # using the C++ Nix implementation. Based on NixOS/nix:tests/lang.sh.
-
-      expect() {
-        local expected res
-        expected="$1"
-        shift
-        set +e
-        "$@"
-        res="$?"
-        set -e
-        [[ $res -eq $expected ]]
-      }
-
-      TESTDIR="''${1:-.}"
-
-      fail=0
-
-      for i in "$TESTDIR/"*_tests/parse-fail-*.nix; do
-          echo "parsing $i (should fail)";
-          if ! expect 1 nix-instantiate --parse - < $i 2> /dev/null; then
-              echo "FAIL: $i shouldn't parse"
-              fail=1
-          fi
-      done
-
-      for i in "$TESTDIR/"*_tests/parse-okay-*.nix; do
-          echo "parsing $i (should succeed)";
-          if ! expect 0 nix-instantiate --parse - < $i > /dev/null; then
-              echo "FAIL: $i should parse"
-              fail=1
-          fi
-      done
-
-      for i in "$TESTDIR/"*_tests/eval-fail-*.nix; do
-          echo "evaluating $i (should fail)";
-          if ! expect 1 nix-instantiate --eval $i 2> /dev/null; then
-              echo "FAIL: $i shouldn't evaluate"
-              fail=1
-          fi
-      done
-
-      export TEST_VAR="foo"
-
-      for i in "$TESTDIR/"*_tests/eval-okay-*.nix; do
-          echo "evaluating $i (should succeed)";
-
-          base="$(dirname "$i")/$(basename "$i" ".nix")"
-
-          case "$(basename $i)" in
-            eval-okay-search-path.nix) ;&
-            eval-okay-tail-call-1.nix | \
-            eval-okay-fromjson.nix)
-              # TODO(sterni,grfn): fix these tests
-              echo "SKIPPED: $i"
-              continue
-              ;;
-            *) ;;
-          esac
-
-          if test -e $base.exp; then
-              flags=
-              if test -e $base.flags; then
-                  flags=$(cat $base.flags)
-              fi
-              if ! expect 0 nix-instantiate $flags --eval --strict $base.nix > $base.out; then
-                  echo "FAIL: $i should evaluate"
-                  fail=1
-              elif ! diff $base.out $base.exp; then
-                  echo "FAIL: evaluation result of $i not as expected"
-                  fail=1
-              fi
-          fi
-
-          if test -e $base.exp.xml; then
-              if ! expect 0 nix-instantiate --eval --xml --no-location --strict \
-                      $base.nix > $base.out.xml; then
-                  echo "FAIL: $i should evaluate"
-                  fail=1
-              elif ! cmp -s $base.out.xml $base.exp.xml; then
-                  echo "FAIL: XML evaluation result of $i not as expected"
-                  fail=1
-              fi
-          fi
-      done
-
-      exit $fail
-    '';
-  };
 }))
 )