about summary refs log tree commit diff
path: root/tvix/nix-compat/src/derivation/tests/mod.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-10-14T23·09+0100
committerflokli <flokli@flokli.de>2023-10-15T15·10+0000
commitf337601f69af2470885712ddf9d5e7738e2e45c1 (patch)
tree5f0ac273bc6a680ca31a655ca104fa8894f18d08 /tvix/nix-compat/src/derivation/tests/mod.rs
parent8a0fa69c6cd031b76d97442e3fe0176b6abb213e (diff)
refactor(nix-compat/derivation): move test fixtures to subdir r/6814
We use test_resources and globbing for some of the test cases, so adding
additional files in there will also create new test cases, which we
don't always want.

Move it down one level to make some more space.

Change-Id: I619867dc80a4ced59d45096d0703678663b559cd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9729
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/nix-compat/src/derivation/tests/mod.rs')
-rw-r--r--tvix/nix-compat/src/derivation/tests/mod.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/tvix/nix-compat/src/derivation/tests/mod.rs b/tvix/nix-compat/src/derivation/tests/mod.rs
index 833a442c8f..2ae80b620d 100644
--- a/tvix/nix-compat/src/derivation/tests/mod.rs
+++ b/tvix/nix-compat/src/derivation/tests/mod.rs
@@ -22,7 +22,7 @@ fn read_file(path: &str) -> BString {
     file_contents.into()
 }
 
-#[test_resources("src/derivation/tests/derivation_tests/*.drv")]
+#[test_resources("src/derivation/tests/derivation_tests/ok/*.drv")]
 fn check_serialization(path_to_drv_file: &str) {
     // skip JSON files known to fail parsing
     if path_to_drv_file.ends_with("cp1252.drv") || path_to_drv_file.ends_with("latin1.drv") {
@@ -40,7 +40,7 @@ fn check_serialization(path_to_drv_file: &str) {
     assert_eq!(expected, BStr::new(&serialized_derivation));
 }
 
-#[test_resources("src/derivation/tests/derivation_tests/*.drv")]
+#[test_resources("src/derivation/tests/derivation_tests/ok/*.drv")]
 fn validate(path_to_drv_file: &str) {
     // skip JSON files known to fail parsing
     if path_to_drv_file.ends_with("cp1252.drv") || path_to_drv_file.ends_with("latin1.drv") {
@@ -55,7 +55,7 @@ fn validate(path_to_drv_file: &str) {
         .expect("derivation failed to validate")
 }
 
-#[test_resources("src/derivation/tests/derivation_tests/*.drv")]
+#[test_resources("src/derivation/tests/derivation_tests/ok/*.drv")]
 fn check_to_aterm_bytes(path_to_drv_file: &str) {
     // skip JSON files known to fail parsing
     if path_to_drv_file.ends_with("cp1252.drv") || path_to_drv_file.ends_with("latin1.drv") {
@@ -78,7 +78,7 @@ fn check_to_aterm_bytes(path_to_drv_file: &str) {
 #[test_case("structured-attrs", "9lj1lkjm2ag622mh4h9rpy6j607an8g2-structured-attrs.drv"; "structured-attrs")]
 #[test_case("unicode", "52a9id8hx688hvlnz4d1n25ml1jdykz0-unicode.drv"; "unicode")]
 fn derivation_path(name: &str, expected_path: &str) {
-    let json_bytes = read_file(&format!("{}/{}.json", RESOURCES_PATHS, expected_path));
+    let json_bytes = read_file(&format!("{}/ok/{}.json", RESOURCES_PATHS, expected_path));
     let derivation: Derivation =
         serde_json::from_slice(&json_bytes).expect("JSON was not well-formatted");
 
@@ -118,7 +118,7 @@ fn derivation_with_trimmed_output_paths(derivation: &Derivation) -> Derivation {
 #[test_case("ss2p4wmxijn652haqyd7dckxwl4c7hxx-bar.drv", "sha256:c79aebd0ce3269393d4a1fde2cbd1d975d879b40f0bf40a48f550edc107fd5df";"fixed-sha1")]
 fn derivation_or_fod_hash(drv_path: &str, expected_nix_hash_string: &str) {
     // read in the fixture
-    let json_bytes = read_file(&format!("{}/{}.json", RESOURCES_PATHS, drv_path));
+    let json_bytes = read_file(&format!("{}/ok/{}.json", RESOURCES_PATHS, drv_path));
     let drv: Derivation = serde_json::from_slice(&json_bytes).expect("must deserialize");
 
     let actual = drv.derivation_or_fod_hash(|_| panic!("must not be called"));
@@ -135,7 +135,7 @@ fn derivation_or_fod_hash(drv_path: &str, expected_nix_hash_string: &str) {
 #[test_case("unicode", "52a9id8hx688hvlnz4d1n25ml1jdykz0-unicode.drv"; "unicode")]
 fn output_paths(name: &str, drv_path: &str) {
     // read in the fixture
-    let json_bytes = read_file(&format!("{}/{}.json", RESOURCES_PATHS, drv_path));
+    let json_bytes = read_file(&format!("{}/ok/{}.json", RESOURCES_PATHS, drv_path));
     let expected_derivation: Derivation =
         serde_json::from_slice(&json_bytes).expect("must deserialize");
 
@@ -157,7 +157,7 @@ fn output_paths(name: &str, drv_path: &str) {
             // In a real-world scenario you would have already done this during construction.
 
             let json_bytes = read_file(&format!(
-                "{}/{}.json",
+                "{}/ok/{}.json",
                 RESOURCES_PATHS,
                 Path::new(parent_drv_path)
                     .file_name()
@@ -261,7 +261,7 @@ fn output_path_construction() {
 
     // ensure it matches our bar fixture
     let bar_json_bytes = read_file(&format!(
-        "{}/{}.json",
+        "{}/ok/{}.json",
         RESOURCES_PATHS, "0hm2f1psjpcwg8fijsmr4wwxrx59s092-bar.drv"
     ));
     let bar_drv_expected: Derivation =
@@ -322,7 +322,7 @@ fn output_path_construction() {
 
     // ensure it matches our foo fixture
     let foo_json_bytes = read_file(&format!(
-        "{}/{}.json",
+        "{}/ok/{}.json",
         RESOURCES_PATHS, "4wvvbi4jwn0prsdxb7vs673qa5h9gr7x-foo.drv",
     ));
     let foo_drv_expected: Derivation =
@@ -408,7 +408,7 @@ fn non_unicode(name: &str, chars: Vec<u8>, exp_output_path: &str, exp_derivation
 
     // Construct the ATerm representation and compare with our fixture.
     {
-        let aterm_bytes = read_file(&format!("{}/{}", RESOURCES_PATHS, exp_derivation_path));
+        let aterm_bytes = read_file(&format!("{}/ok/{}", RESOURCES_PATHS, exp_derivation_path));
         assert_eq!(
             aterm_bytes,
             BStr::new(&derivation.to_aterm_bytes()),