edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB8b784e6Tahinli2 months ago961 commits
| 1 | //! Throwaway paths for the tests, and the one rule about them: everything a |
| 2 | //! test writes goes inside a directory that deletes itself. |
| 3 | //! |
| 4 | //! [`Scratch`] is that directory. It derefs to a path -- the directory itself, |
| 5 | //! or the one file inside it -- so a helper that used to hand back a `PathBuf` |
| 6 | //! hands back one of these instead and its call sites do not change. `Drop` is |
| 7 | //! what cleans up, which is the whole point: unwinding runs it, so a *failing* |
| 8 | //! test leaves nothing behind either. The suites used to litter `/tmp` with a |
| 9 | //! fresh `ve_*` directory per run and never take one back; on this machine that |
| 10 | //! reached 2907 of them. A test the kernel *aborts* never unwinds and so never |
| 11 | //! drops anything; [`reap_orphans`] takes those on the next run instead. |
| 12 | //! |
| 13 | //! Nothing outside a test has any use for this. It lives in the library rather |
| 14 | //! than in a test file because the integration suites, the unit tests here and |
| 15 | //! the app's own tests all need the same guard, and none of them can see each |
| 16 | //! other's modules. |
| 17 | |
| 18 | use OsStr; |
| 19 | use Deref; |
| 20 | use ; |
| 21 | use ; |
| 22 | |
| 23 | /// A temporary directory and the path a test uses inside it, gone when the |
| 24 | /// value is. |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | /// A fresh, empty directory under the system temporary one. `name` leads it so |
| 32 | /// it is recognisable while a test is stopped in it; the process id and a |
| 33 | /// counter follow, because two suites (or two tests of one suite, in parallel) |
| 34 | /// must not write each other's files. Canonical, because saved projects hold |
| 35 | /// paths relative to their own directory and `Project` canonicalises what it is |
| 36 | /// handed. |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | /// The one leak `Drop` cannot reach: a test the kernel *aborts* -- the AV1 |
| 52 | /// hardware encoder does it whenever the driver's ring hangs -- never unwinds, |
| 53 | /// so its directory outlives it. The name carries the process id that made it, |
| 54 | /// so a later run can tell an orphan from a directory a live sibling suite is |
| 55 | /// still writing into, and takes only the orphans. Once per process, before the |
| 56 | /// first scratch directory of it: the suites are what fills `/tmp`, and they all |
| 57 | /// come through here. |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | /// So one of these can be handed to a `Command` as an argument, which is how |
| 119 | /// the suites that check our output with ffmpeg name the file. |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 |