2 8704c7ce 2021-03-10 stsp * Copyright (c) 2021 Stefan Sperling <stsp@openbsd.org>
4 8704c7ce 2021-03-10 stsp * Permission to use, copy, modify, and distribute this software for any
5 8704c7ce 2021-03-10 stsp * purpose with or without fee is hereby granted, provided that the above
6 8704c7ce 2021-03-10 stsp * copyright notice and this permission notice appear in all copies.
8 8704c7ce 2021-03-10 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 8704c7ce 2021-03-10 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 8704c7ce 2021-03-10 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 8704c7ce 2021-03-10 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 8704c7ce 2021-03-10 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 8704c7ce 2021-03-10 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 8704c7ce 2021-03-10 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 8704c7ce 2021-03-10 stsp #include <stdio.h>
18 8704c7ce 2021-03-10 stsp #include <stdlib.h>
19 8704c7ce 2021-03-10 stsp #include <string.h>
20 8704c7ce 2021-03-10 stsp #include <err.h>
21 8704c7ce 2021-03-10 stsp #include <unistd.h>
22 8704c7ce 2021-03-10 stsp #include <getopt.h>
24 8704c7ce 2021-03-10 stsp #include "got_error.h"
25 8704c7ce 2021-03-10 stsp #include "got_opentemp.h"
27 8704c7ce 2021-03-10 stsp #include "got_lib_deltify.h"
29 8704c7ce 2021-03-10 stsp #ifndef nitems
30 8704c7ce 2021-03-10 stsp #define nitems(_a) (sizeof(_a) / sizeof((_a)[0]))
34 8704c7ce 2021-03-10 stsp deltify_abc_axc(void)
36 8704c7ce 2021-03-10 stsp const struct got_error *err = NULL;
38 8704c7ce 2021-03-10 stsp FILE *base_file, *derived_file, *result_file;
39 8704c7ce 2021-03-10 stsp struct got_delta_table *dt;
40 8704c7ce 2021-03-10 stsp struct got_delta_instruction *deltas;
41 8704c7ce 2021-03-10 stsp int ndeltas;
42 8704c7ce 2021-03-10 stsp int have_nblocks = 0;
44 8704c7ce 2021-03-10 stsp base_file = got_opentemp();
45 8704c7ce 2021-03-10 stsp if (base_file == NULL)
48 8704c7ce 2021-03-10 stsp derived_file = got_opentemp();
49 8704c7ce 2021-03-10 stsp if (derived_file == NULL)
52 8704c7ce 2021-03-10 stsp result_file = got_opentemp();
53 8704c7ce 2021-03-10 stsp if (result_file == NULL)
56 8704c7ce 2021-03-10 stsp for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
57 8704c7ce 2021-03-10 stsp fputc('a', base_file);
58 8704c7ce 2021-03-10 stsp fputc('a', derived_file);
60 8704c7ce 2021-03-10 stsp for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
61 8704c7ce 2021-03-10 stsp fputc('b', base_file);
62 8704c7ce 2021-03-10 stsp fputc('x', derived_file);
64 8704c7ce 2021-03-10 stsp for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
65 8704c7ce 2021-03-10 stsp fputc('c', base_file);
66 8704c7ce 2021-03-10 stsp fputc('c', derived_file);
69 8704c7ce 2021-03-10 stsp rewind(base_file);
70 8704c7ce 2021-03-10 stsp rewind(derived_file);
72 8704c7ce 2021-03-10 stsp err = got_deltify_init(&dt, base_file, 0, 3 * GOT_DELTIFY_MAXCHUNK);
76 8704c7ce 2021-03-10 stsp for (i = 0; i < dt->nalloc; i++) {
77 8704c7ce 2021-03-10 stsp if (dt->blocks[i].len > 0)
78 8704c7ce 2021-03-10 stsp have_nblocks++;
80 8704c7ce 2021-03-10 stsp if (have_nblocks != dt->nblocks) {
81 8704c7ce 2021-03-10 stsp err = got_error(GOT_ERR_BAD_DELTA);
85 8704c7ce 2021-03-10 stsp err = got_deltify(&deltas, &ndeltas, derived_file, 0,
86 f34b169e 2021-06-18 stsp 3 * GOT_DELTIFY_MAXCHUNK, dt, base_file, 0,
87 f34b169e 2021-06-18 stsp 3 * GOT_DELTIFY_MAXCHUNK);
91 8704c7ce 2021-03-10 stsp if (ndeltas != 3) {
92 8704c7ce 2021-03-10 stsp err = got_error(GOT_ERR_BAD_DELTA);
95 8704c7ce 2021-03-10 stsp /* Copy 'aaaa...' from base file. */
96 8704c7ce 2021-03-10 stsp if (!(deltas[0].copy == 1 && deltas[0].offset == 0 &&
97 8704c7ce 2021-03-10 stsp deltas[0].len == GOT_DELTIFY_MAXCHUNK)) {
98 8704c7ce 2021-03-10 stsp err = got_error(GOT_ERR_BAD_DELTA);
101 8704c7ce 2021-03-10 stsp /* Copy 'xxxx...' from derived file. */
102 8704c7ce 2021-03-10 stsp if (!(deltas[1].copy == 0 && deltas[1].offset == GOT_DELTIFY_MAXCHUNK &&
103 8704c7ce 2021-03-10 stsp deltas[1].len == GOT_DELTIFY_MAXCHUNK)) {
104 8704c7ce 2021-03-10 stsp err = got_error(GOT_ERR_BAD_DELTA);
107 8704c7ce 2021-03-10 stsp /* Copy 'ccccc...' from base file. */
108 8704c7ce 2021-03-10 stsp if (!(deltas[2].copy == 1 &&
109 8704c7ce 2021-03-10 stsp deltas[2].offset == 2 * GOT_DELTIFY_MAXCHUNK &&
110 8704c7ce 2021-03-10 stsp deltas[2].len == GOT_DELTIFY_MAXCHUNK)) {
111 8704c7ce 2021-03-10 stsp err = got_error(GOT_ERR_BAD_DELTA);
116 8704c7ce 2021-03-10 stsp got_deltify_free(dt);
117 8704c7ce 2021-03-10 stsp fclose(base_file);
118 8704c7ce 2021-03-10 stsp fclose(derived_file);
119 2b0ae357 2022-01-10 thomas fclose(result_file);
120 2b0ae357 2022-01-10 thomas return (err == NULL);
123 2b0ae357 2022-01-10 thomas static int
124 2b0ae357 2022-01-10 thomas deltify_abc_axc_file_mem(void)
126 2b0ae357 2022-01-10 thomas const struct got_error *err = NULL;
127 2b0ae357 2022-01-10 thomas size_t i;
128 2b0ae357 2022-01-10 thomas uint8_t base_data[3 * GOT_DELTIFY_MAXCHUNK];
129 2b0ae357 2022-01-10 thomas FILE *derived_file, *result_file;
130 2b0ae357 2022-01-10 thomas struct got_delta_table *dt;
131 2b0ae357 2022-01-10 thomas struct got_delta_instruction *deltas;
132 2b0ae357 2022-01-10 thomas int ndeltas;
133 2b0ae357 2022-01-10 thomas int have_nblocks = 0;
135 2b0ae357 2022-01-10 thomas derived_file = got_opentemp();
136 2b0ae357 2022-01-10 thomas if (derived_file == NULL)
137 2b0ae357 2022-01-10 thomas return 1;
139 2b0ae357 2022-01-10 thomas result_file = got_opentemp();
140 2b0ae357 2022-01-10 thomas if (result_file == NULL)
141 2b0ae357 2022-01-10 thomas return 1;
143 2b0ae357 2022-01-10 thomas for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
144 2b0ae357 2022-01-10 thomas base_data[i] = 'a';
145 2b0ae357 2022-01-10 thomas fputc('a', derived_file);
147 2b0ae357 2022-01-10 thomas for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
148 2b0ae357 2022-01-10 thomas base_data[GOT_DELTIFY_MAXCHUNK + i] = 'b';
149 2b0ae357 2022-01-10 thomas fputc('x', derived_file);
151 2b0ae357 2022-01-10 thomas for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
152 2b0ae357 2022-01-10 thomas base_data[2 * GOT_DELTIFY_MAXCHUNK + i] = 'c';
153 2b0ae357 2022-01-10 thomas fputc('c', derived_file);
156 2b0ae357 2022-01-10 thomas rewind(derived_file);
158 2b0ae357 2022-01-10 thomas err = got_deltify_init_mem(&dt, base_data, 0, 3 * GOT_DELTIFY_MAXCHUNK);
160 2b0ae357 2022-01-10 thomas goto done;
162 2b0ae357 2022-01-10 thomas for (i = 0; i < dt->nalloc; i++) {
163 2b0ae357 2022-01-10 thomas if (dt->blocks[i].len > 0)
164 2b0ae357 2022-01-10 thomas have_nblocks++;
166 2b0ae357 2022-01-10 thomas if (have_nblocks != dt->nblocks) {
167 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
168 2b0ae357 2022-01-10 thomas goto done;
171 2b0ae357 2022-01-10 thomas err = got_deltify_file_mem(&deltas, &ndeltas, derived_file, 0,
172 2b0ae357 2022-01-10 thomas 3 * GOT_DELTIFY_MAXCHUNK, dt, base_data, 0,
173 2b0ae357 2022-01-10 thomas 3 * GOT_DELTIFY_MAXCHUNK);
175 2b0ae357 2022-01-10 thomas goto done;
177 2b0ae357 2022-01-10 thomas if (ndeltas != 3) {
178 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
179 2b0ae357 2022-01-10 thomas goto done;
181 2b0ae357 2022-01-10 thomas /* Copy 'aaaa...' from base file. */
182 2b0ae357 2022-01-10 thomas if (!(deltas[0].copy == 1 && deltas[0].offset == 0 &&
183 2b0ae357 2022-01-10 thomas deltas[0].len == GOT_DELTIFY_MAXCHUNK)) {
184 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
185 2b0ae357 2022-01-10 thomas goto done;
187 2b0ae357 2022-01-10 thomas /* Copy 'xxxx...' from derived file. */
188 2b0ae357 2022-01-10 thomas if (!(deltas[1].copy == 0 && deltas[1].offset == GOT_DELTIFY_MAXCHUNK &&
189 2b0ae357 2022-01-10 thomas deltas[1].len == GOT_DELTIFY_MAXCHUNK)) {
190 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
191 2b0ae357 2022-01-10 thomas goto done;
193 2b0ae357 2022-01-10 thomas /* Copy 'ccccc...' from base file. */
194 2b0ae357 2022-01-10 thomas if (!(deltas[2].copy == 1 &&
195 2b0ae357 2022-01-10 thomas deltas[2].offset == 2 * GOT_DELTIFY_MAXCHUNK &&
196 2b0ae357 2022-01-10 thomas deltas[2].len == GOT_DELTIFY_MAXCHUNK)) {
197 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
198 2b0ae357 2022-01-10 thomas goto done;
202 2b0ae357 2022-01-10 thomas got_deltify_free(dt);
203 2b0ae357 2022-01-10 thomas fclose(derived_file);
204 2b0ae357 2022-01-10 thomas fclose(result_file);
205 2b0ae357 2022-01-10 thomas return (err == NULL);
208 2b0ae357 2022-01-10 thomas static int
209 2b0ae357 2022-01-10 thomas deltify_abc_axc_mem_file(void)
211 2b0ae357 2022-01-10 thomas const struct got_error *err = NULL;
212 2b0ae357 2022-01-10 thomas size_t i;
213 2b0ae357 2022-01-10 thomas FILE *base_file, *result_file;
214 2b0ae357 2022-01-10 thomas uint8_t derived_file[3 * GOT_DELTIFY_MAXCHUNK];
215 2b0ae357 2022-01-10 thomas struct got_delta_table *dt;
216 2b0ae357 2022-01-10 thomas struct got_delta_instruction *deltas;
217 2b0ae357 2022-01-10 thomas int ndeltas;
218 2b0ae357 2022-01-10 thomas int have_nblocks = 0;
220 2b0ae357 2022-01-10 thomas base_file = got_opentemp();
221 2b0ae357 2022-01-10 thomas if (base_file == NULL)
222 2b0ae357 2022-01-10 thomas return 1;
224 2b0ae357 2022-01-10 thomas result_file = got_opentemp();
225 2b0ae357 2022-01-10 thomas if (result_file == NULL)
226 2b0ae357 2022-01-10 thomas return 1;
228 2b0ae357 2022-01-10 thomas for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
229 2b0ae357 2022-01-10 thomas fputc('a', base_file);
230 2b0ae357 2022-01-10 thomas derived_file[i] = 'a';
232 2b0ae357 2022-01-10 thomas for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
233 2b0ae357 2022-01-10 thomas fputc('b', base_file);
234 2b0ae357 2022-01-10 thomas derived_file[GOT_DELTIFY_MAXCHUNK + i] = 'x';
236 2b0ae357 2022-01-10 thomas for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
237 2b0ae357 2022-01-10 thomas fputc('c', base_file);
238 2b0ae357 2022-01-10 thomas derived_file[2 * GOT_DELTIFY_MAXCHUNK + i] = 'c';
241 2b0ae357 2022-01-10 thomas rewind(base_file);
243 2b0ae357 2022-01-10 thomas err = got_deltify_init(&dt, base_file, 0, 3 * GOT_DELTIFY_MAXCHUNK);
245 2b0ae357 2022-01-10 thomas goto done;
247 2b0ae357 2022-01-10 thomas for (i = 0; i < dt->nalloc; i++) {
248 2b0ae357 2022-01-10 thomas if (dt->blocks[i].len > 0)
249 2b0ae357 2022-01-10 thomas have_nblocks++;
251 2b0ae357 2022-01-10 thomas if (have_nblocks != dt->nblocks) {
252 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
253 2b0ae357 2022-01-10 thomas goto done;
256 2b0ae357 2022-01-10 thomas err = got_deltify_mem_file(&deltas, &ndeltas, derived_file, 0,
257 2b0ae357 2022-01-10 thomas 3 * GOT_DELTIFY_MAXCHUNK, dt, base_file, 0,
258 2b0ae357 2022-01-10 thomas 3 * GOT_DELTIFY_MAXCHUNK);
260 2b0ae357 2022-01-10 thomas goto done;
262 2b0ae357 2022-01-10 thomas if (ndeltas != 3) {
263 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
264 2b0ae357 2022-01-10 thomas goto done;
266 2b0ae357 2022-01-10 thomas /* Copy 'aaaa...' from base file. */
267 2b0ae357 2022-01-10 thomas if (!(deltas[0].copy == 1 && deltas[0].offset == 0 &&
268 2b0ae357 2022-01-10 thomas deltas[0].len == GOT_DELTIFY_MAXCHUNK)) {
269 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
270 2b0ae357 2022-01-10 thomas goto done;
272 2b0ae357 2022-01-10 thomas /* Copy 'xxxx...' from derived file. */
273 2b0ae357 2022-01-10 thomas if (!(deltas[1].copy == 0 && deltas[1].offset == GOT_DELTIFY_MAXCHUNK &&
274 2b0ae357 2022-01-10 thomas deltas[1].len == GOT_DELTIFY_MAXCHUNK)) {
275 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
276 2b0ae357 2022-01-10 thomas goto done;
278 2b0ae357 2022-01-10 thomas /* Copy 'ccccc...' from base file. */
279 2b0ae357 2022-01-10 thomas if (!(deltas[2].copy == 1 &&
280 2b0ae357 2022-01-10 thomas deltas[2].offset == 2 * GOT_DELTIFY_MAXCHUNK &&
281 2b0ae357 2022-01-10 thomas deltas[2].len == GOT_DELTIFY_MAXCHUNK)) {
282 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
283 2b0ae357 2022-01-10 thomas goto done;
287 2b0ae357 2022-01-10 thomas got_deltify_free(dt);
288 2b0ae357 2022-01-10 thomas fclose(base_file);
289 8704c7ce 2021-03-10 stsp fclose(result_file);
290 8704c7ce 2021-03-10 stsp return (err == NULL);
293 2b0ae357 2022-01-10 thomas static int
294 2b0ae357 2022-01-10 thomas deltify_abc_axc_mem_mem(void)
296 2b0ae357 2022-01-10 thomas const struct got_error *err = NULL;
297 2b0ae357 2022-01-10 thomas size_t i;
298 2b0ae357 2022-01-10 thomas FILE *result_file;
299 2b0ae357 2022-01-10 thomas uint8_t base_file[3 * GOT_DELTIFY_MAXCHUNK];
300 2b0ae357 2022-01-10 thomas uint8_t derived_file[3 * GOT_DELTIFY_MAXCHUNK];
301 2b0ae357 2022-01-10 thomas struct got_delta_table *dt;
302 2b0ae357 2022-01-10 thomas struct got_delta_instruction *deltas;
303 2b0ae357 2022-01-10 thomas int ndeltas;
304 2b0ae357 2022-01-10 thomas int have_nblocks = 0;
306 2b0ae357 2022-01-10 thomas result_file = got_opentemp();
307 2b0ae357 2022-01-10 thomas if (result_file == NULL)
308 2b0ae357 2022-01-10 thomas return 1;
310 2b0ae357 2022-01-10 thomas for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
311 2b0ae357 2022-01-10 thomas base_file[i] = 'a';
312 2b0ae357 2022-01-10 thomas derived_file[i] = 'a';
314 2b0ae357 2022-01-10 thomas for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
315 2b0ae357 2022-01-10 thomas base_file[GOT_DELTIFY_MAXCHUNK + i] = 'b';
316 2b0ae357 2022-01-10 thomas derived_file[GOT_DELTIFY_MAXCHUNK + i] = 'x';
318 2b0ae357 2022-01-10 thomas for (i = 0; i < GOT_DELTIFY_MAXCHUNK; i++) {
319 2b0ae357 2022-01-10 thomas base_file[2 * GOT_DELTIFY_MAXCHUNK + i] = 'c';
320 2b0ae357 2022-01-10 thomas derived_file[2 * GOT_DELTIFY_MAXCHUNK + i] = 'c';
323 2b0ae357 2022-01-10 thomas err = got_deltify_init_mem(&dt, base_file, 0, 3 * GOT_DELTIFY_MAXCHUNK);
325 2b0ae357 2022-01-10 thomas goto done;
327 2b0ae357 2022-01-10 thomas for (i = 0; i < dt->nalloc; i++) {
328 2b0ae357 2022-01-10 thomas if (dt->blocks[i].len > 0)
329 2b0ae357 2022-01-10 thomas have_nblocks++;
331 2b0ae357 2022-01-10 thomas if (have_nblocks != dt->nblocks) {
332 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
333 2b0ae357 2022-01-10 thomas goto done;
336 2b0ae357 2022-01-10 thomas err = got_deltify_mem_mem(&deltas, &ndeltas, derived_file, 0,
337 2b0ae357 2022-01-10 thomas 3 * GOT_DELTIFY_MAXCHUNK, dt, base_file, 0,
338 2b0ae357 2022-01-10 thomas 3 * GOT_DELTIFY_MAXCHUNK);
340 2b0ae357 2022-01-10 thomas goto done;
342 2b0ae357 2022-01-10 thomas if (ndeltas != 3) {
343 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
344 2b0ae357 2022-01-10 thomas goto done;
346 2b0ae357 2022-01-10 thomas /* Copy 'aaaa...' from base file. */
347 2b0ae357 2022-01-10 thomas if (!(deltas[0].copy == 1 && deltas[0].offset == 0 &&
348 2b0ae357 2022-01-10 thomas deltas[0].len == GOT_DELTIFY_MAXCHUNK)) {
349 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
350 2b0ae357 2022-01-10 thomas goto done;
352 2b0ae357 2022-01-10 thomas /* Copy 'xxxx...' from derived file. */
353 2b0ae357 2022-01-10 thomas if (!(deltas[1].copy == 0 && deltas[1].offset == GOT_DELTIFY_MAXCHUNK &&
354 2b0ae357 2022-01-10 thomas deltas[1].len == GOT_DELTIFY_MAXCHUNK)) {
355 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
356 2b0ae357 2022-01-10 thomas goto done;
358 2b0ae357 2022-01-10 thomas /* Copy 'ccccc...' from base file. */
359 2b0ae357 2022-01-10 thomas if (!(deltas[2].copy == 1 &&
360 2b0ae357 2022-01-10 thomas deltas[2].offset == 2 * GOT_DELTIFY_MAXCHUNK &&
361 2b0ae357 2022-01-10 thomas deltas[2].len == GOT_DELTIFY_MAXCHUNK)) {
362 2b0ae357 2022-01-10 thomas err = got_error(GOT_ERR_BAD_DELTA);
363 2b0ae357 2022-01-10 thomas goto done;
367 2b0ae357 2022-01-10 thomas got_deltify_free(dt);
368 2b0ae357 2022-01-10 thomas fclose(result_file);
369 2b0ae357 2022-01-10 thomas return (err == NULL);
372 8704c7ce 2021-03-10 stsp static int quiet;
374 8704c7ce 2021-03-10 stsp #define RUN_TEST(expr, name) \
375 8704c7ce 2021-03-10 stsp { test_ok = (expr); \
376 8704c7ce 2021-03-10 stsp if (!quiet) printf("test_%s %s\n", (name), test_ok ? "ok" : "failed"); \
377 8704c7ce 2021-03-10 stsp failure = (failure || !test_ok); }
379 8704c7ce 2021-03-10 stsp static void
380 8704c7ce 2021-03-10 stsp usage(void)
382 8704c7ce 2021-03-10 stsp fprintf(stderr, "usage: delta_test [-q]\n");
386 8704c7ce 2021-03-10 stsp main(int argc, char *argv[])
388 8704c7ce 2021-03-10 stsp int test_ok;
389 8704c7ce 2021-03-10 stsp int failure = 0;
392 8704c7ce 2021-03-10 stsp while ((ch = getopt(argc, argv, "q")) != -1) {
393 8704c7ce 2021-03-10 stsp switch (ch) {
403 8704c7ce 2021-03-10 stsp argc -= optind;
404 8704c7ce 2021-03-10 stsp argv += optind;
406 8704c7ce 2021-03-10 stsp if (argc != 0) {
411 8704c7ce 2021-03-10 stsp #ifndef PROFILE
412 8704c7ce 2021-03-10 stsp if (pledge("stdio rpath wpath cpath unveil", NULL) == -1)
413 8704c7ce 2021-03-10 stsp err(1, "pledge");
415 8704c7ce 2021-03-10 stsp if (unveil(GOT_TMPDIR_STR, "rwc") != 0)
416 8704c7ce 2021-03-10 stsp err(1, "unveil");
418 8704c7ce 2021-03-10 stsp if (unveil(NULL, NULL) != 0)
419 8704c7ce 2021-03-10 stsp err(1, "unveil");
421 8704c7ce 2021-03-10 stsp RUN_TEST(deltify_abc_axc(), "deltify_abc_axc");
422 2b0ae357 2022-01-10 thomas RUN_TEST(deltify_abc_axc_file_mem(), "deltify_abc_axc_file_mem");
423 2b0ae357 2022-01-10 thomas RUN_TEST(deltify_abc_axc_mem_file(), "deltify_abc_axc_mem_file");
424 2b0ae357 2022-01-10 thomas RUN_TEST(deltify_abc_axc_mem_mem(), "deltify_abc_axc_mem_mem");
426 8704c7ce 2021-03-10 stsp return failure ? 1 : 0;