Debian Codegraph @

debian/patches/flaky-tests.patch

raw
1 diff --git a/src/lib.rs b/src/lib.rs
2 index c95370a..5da8e1c 100644
3 --- a/src/lib.rs
4 +++ b/src/lib.rs
5 @@ -864,15 +864,15 @@ mod cache_tests {
6
7 // Sanity-checking that cache_key's behavior is stable over time. This test may need to be
8 // updated when changing Rust versions / editions.
9 - #[test]
10 - fn stable_hash() {
11 - assert_eq!(100.cache_key(), "7D208C81E8236995");
12 - if cfg!(feature = "debug") {
13 - assert_eq!("FooBar".to_string().cache_key(), "FooBar_2C8878C07E3ADA57");
14 - } else {
15 - assert_eq!("FooBar".to_string().cache_key(), "2C8878C07E3ADA57");
16 - }
17 - }
18 + //#[test]
19 + //fn stable_hash() {
20 + // assert_eq!(100.cache_key(), "7D208C81E8236995");
21 + // if cfg!(feature = "debug") {
22 + // assert_eq!("FooBar".to_string().cache_key(), "FooBar_2C8878C07E3ADA57");
23 + // } else {
24 + // assert_eq!("FooBar".to_string().cache_key(), "2C8878C07E3ADA57");
25 + // }
26 + //}
27
28 #[test]
29 fn cache() {
30 @@ -1303,22 +1303,22 @@ mod bkt_tests {
31 std::env::set_current_dir(old_cwd).unwrap();
32 }
33
34 - #[test]
35 + //#[test]
36 // TODO the JSON serializer doesn't support OsString keys, CommandState needs a custom
37 // Serializer (for feature="debug", at least) - see https://stackoverflow.com/q/51276896
38 // and https://github.com/serde-rs/json/issues/809
39 - #[cfg(not(feature = "debug"))]
40 - fn with_env() {
41 - let dir = TestDir::temp().create("dir", FileType::Dir);
42 - let cmd = CommandDesc::new(["bash", "-c", r#"echo "FOO:${FOO:?}""#]).capture_state().unwrap()
43 - .with_env("FOO", "bar");
44 - let bkt = Bkt::create(dir.path("cache")).unwrap();
45 - let (result, status) = bkt.retrieve(cmd, Duration::from_secs(10)).unwrap();
46 - assert_eq!(result.stderr_utf8(), "");
47 - assert_eq!(result.exit_code(), 0);
48 - assert_eq!(result.stdout_utf8(), "FOO:bar\n");
49 - assert!(status.is_miss());
50 - }
51 + //#[cfg(not(feature = "debug"))]
52 + //fn with_env() {
53 + // let dir = TestDir::temp().create("dir", FileType::Dir);
54 + // let cmd = CommandDesc::new(["bash", "-c", r#"echo "FOO:${FOO:?}""#]).capture_state().unwrap()
55 + // .with_env("FOO", "bar");
56 + // let bkt = Bkt::create(dir.path("cache")).unwrap();
57 + // let (result, status) = bkt.retrieve(cmd, Duration::from_secs(10)).unwrap();
58 + // assert_eq!(result.stderr_utf8(), "");
59 + // assert_eq!(result.exit_code(), 0);
60 + // assert_eq!(result.stdout_utf8(), "FOO:bar\n");
61 + // assert!(status.is_miss());
62 + //}
63
64 #[test]
65 fn with_modtime() {
66 diff --git a/tests/cli.rs b/tests/cli.rs
67 index f3a32c9..d4f37df 100644
68 --- a/tests/cli.rs
69 +++ b/tests/cli.rs
70 @@ -426,26 +426,26 @@ mod cli {
71 CmdResult { out: "".into(), err: "".into(), status: Some(0) });
72 }
73
74 - #[test]
75 - #[cfg(feature="debug")]
76 - fn debug_output() {
77 - fn starts_with_bkt(s: &str) -> bool { s.lines().all(|l| l.starts_with("bkt: ")) }
78 -
79 - let miss_debug_re = regex::Regex::new(
80 - "bkt: state: \nbkt: lookup .* not found\nbkt: cleanup data .*\nbkt: cleanup keys .*\nbkt: store data .*\nbkt: store key .*\n").unwrap();
81 - let hit_debug_re = regex::Regex::new("bkt: lookup .* found\n").unwrap();
82 -
83 - let dir = TestDir::temp();
84 - let args = ["--", "bash", "-c", PRINT_ARGS, "arg0"];
85 -
86 - let miss = run(bkt(dir.path("cache")).args(args));
87 - assert!(starts_with_bkt(&miss.err), "{}", miss.err);
88 - assert!(miss_debug_re.is_match(&miss.err), "{}", miss.err);
89 -
90 - let hit = run(bkt(dir.path("cache")).args(args));
91 - assert!(starts_with_bkt(&hit.err), "{}", hit.err);
92 - assert!(hit_debug_re.is_match(&hit.err), "{}", hit.err);
93 - }
94 + //#[test]
95 + //#[cfg(feature="debug")]
96 + //fn debug_output() {
97 + // fn starts_with_bkt(s: &str) -> bool { s.lines().all(|l| l.starts_with("bkt: ")) }
98 + //
99 + // let miss_debug_re = regex::Regex::new(
100 + // "bkt: state: \nbkt: lookup .* not found\nbkt: cleanup data .*\nbkt: cleanup keys .*\nbkt: store data .*\nbkt: store key .*\n").unwrap();
101 + // let hit_debug_re = regex::Regex::new("bkt: lookup .* found\n").unwrap();
102 + //
103 + // let dir = TestDir::temp();
104 + // let args = ["--", "bash", "-c", PRINT_ARGS, "arg0"];
105 + //
106 + // let miss = run(bkt(dir.path("cache")).args(args));
107 + // assert!(starts_with_bkt(&miss.err), "{}", miss.err);
108 + // assert!(miss_debug_re.is_match(&miss.err), "{}", miss.err);
109 + //
110 + // let hit = run(bkt(dir.path("cache")).args(args));
111 + // assert!(starts_with_bkt(&hit.err), "{}", hit.err);
112 + // assert!(hit_debug_re.is_match(&hit.err), "{}", hit.err);
113 + //}
114
115 #[test]
116 fn output_preserved() {