2 * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #include <sys/queue.h>
25 #include "got_error.h"
26 #include "got_object.h"
29 #define RUN_TEST(expr, name) \
30 if (!(expr)) { printf("test %s failed\n", (name)); failure = 1; }
32 #define GOT_REPO_PATH "../../../"
35 packfile_read_idx(const char *repo_path)
37 const struct got_error *err;
38 struct got_packidx_v2_hdr *packidx;
39 const char *pack_checksum = "5414c35e56c54294d2515863832bf46ad0e321d7";
40 const char *pack_prefix = ".git/objects/pack/pack";
44 if (asprintf(&fullpath, "%s/%s-%s.idx", repo_path, pack_prefix,
48 err = got_packidx_open(&packidx, fullpath);
50 printf("got_packidx_open: %s\n", err->msg);
54 got_packidx_close(packidx);
60 main(int argc, const char *argv[])
63 const char *repo_path;
66 repo_path = GOT_REPO_PATH;
70 fprintf(stderr, "usage: repository_test [REPO_PATH]\n");
74 RUN_TEST(packfile_read_idx(repo_path), "packfile_read_idx");
76 return failure ? 1 : 0;