git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
f304a2773a62518d84c8a4c2b1c4b33fce7db9b3 blob 1480 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 
/*
Copyright 2020 Google LLC

Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
*/

#include "test_framework.h"

#include "system.h"
#include "basics.h"

struct test_case **test_cases;
int test_case_len;
int test_case_cap;

struct test_case *new_test_case(const char *name, void (*testfunc)(void))
{
	struct test_case *tc = reftable_malloc(sizeof(struct test_case));
	tc->name = name;
	tc->testfunc = testfunc;
	return tc;
}

struct test_case *add_test_case(const char *name, void (*testfunc)(void))
{
	struct test_case *tc = new_test_case(name, testfunc);
	if (test_case_len == test_case_cap) {
		test_case_cap = 2 * test_case_cap + 1;
		test_cases = reftable_realloc(
			test_cases, sizeof(struct test_case) * test_case_cap);
	}

	test_cases[test_case_len++] = tc;
	return tc;
}

int test_main(int argc, const char *argv[])
{
	const char *filter = NULL;
	int i = 0;
	if (argc > 1) {
		filter = argv[1];
	}

	for (i = 0; i < test_case_len; i++) {
		const char *name = test_cases[i]->name;
		if (filter == NULL || strstr(name, filter) != NULL) {
			printf("case %s\n", name);
			test_cases[i]->testfunc();
		} else {
			printf("skip %s\n", name);
		}

		reftable_free(test_cases[i]);
	}
	reftable_free(test_cases);
	test_cases = 0;
	test_case_len = 0;
	test_case_cap = 0;
	return 0;
}

void set_test_hash(uint8_t *p, int i)
{
	memset(p, (uint8_t)i, hash_size(SHA1_ID));
}
debug log:

solving f304a2773a ...
found f304a2773a in https://public-inbox.org/git/7bf59d491d75b72b4046661ec94c5e1d6a52047c.1600283416.git.gitgitgadget@gmail.com/

applying [1/1] https://public-inbox.org/git/7bf59d491d75b72b4046661ec94c5e1d6a52047c.1600283416.git.gitgitgadget@gmail.com/
diff --git a/reftable/test_framework.c b/reftable/test_framework.c
new file mode 100644
index 0000000000..f304a2773a

Checking patch reftable/test_framework.c...
Applied patch reftable/test_framework.c cleanly.

index at:
100644 f304a2773a62518d84c8a4c2b1c4b33fce7db9b3	reftable/test_framework.c

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git