diff mbox series

[v5,7/7] t: clean up leftover reftable test cruft

Message ID 20240906113746.8903-8-chandrapratap3519@gmail.com (mailing list archive)
State Superseded
Headers show
Series t: port reftable/stack_test.c to the unit testing framework | expand

Commit Message

Chandra Pratap Sept. 6, 2024, 11:29 a.m. UTC
From: Junio C Hamano <gitster@pobox.com>

With the migration of reftable tests to the unit-tests framework,
"test-tool reftable" becomes a no-op.

Get rid of everything that uses "test-tool reftable" alongside
everything that is used to implement it.

While at it, alphabetically sort the cmds[] list in
helper/test-tool.c by moving the entry for "dump-reftable".

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
---
 Makefile                     |  2 --
 reftable/reftable-tests.h    | 13 --------
 reftable/test_framework.c    | 27 ----------------
 reftable/test_framework.h    | 61 ------------------------------------
 t/helper/test-reftable.c     |  7 -----
 t/helper/test-tool.c         |  3 +-
 t/helper/test-tool.h         |  1 -
 t/t0032-reftable-unittest.sh | 16 ----------
 8 files changed, 1 insertion(+), 129 deletions(-)
 delete mode 100644 reftable/reftable-tests.h
 delete mode 100644 reftable/test_framework.c
 delete mode 100644 reftable/test_framework.h
 delete mode 100755 t/t0032-reftable-unittest.sh
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 1cbc2d61ae..64ccb1433f 100644
--- a/Makefile
+++ b/Makefile
@@ -2692,8 +2692,6 @@  REFTABLE_OBJS += reftable/stack.o
 REFTABLE_OBJS += reftable/tree.o
 REFTABLE_OBJS += reftable/writer.o
 
-REFTABLE_TEST_OBJS += reftable/test_framework.o
-
 TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
 
 .PHONY: test-objs
diff --git a/reftable/reftable-tests.h b/reftable/reftable-tests.h
deleted file mode 100644
index 05f8d2d5bc..0000000000
--- a/reftable/reftable-tests.h
+++ /dev/null
@@ -1,13 +0,0 @@ 
-/*
-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
-*/
-
-#ifndef REFTABLE_TESTS_H
-#define REFTABLE_TESTS_H
-
-
-#endif
diff --git a/reftable/test_framework.c b/reftable/test_framework.c
deleted file mode 100644
index a07fec5d84..0000000000
--- a/reftable/test_framework.c
+++ /dev/null
@@ -1,27 +0,0 @@ 
-/*
-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 "system.h"
-#include "test_framework.h"
-
-
-void set_test_hash(uint8_t *p, int i)
-{
-	memset(p, (uint8_t)i, hash_size(GIT_SHA1_FORMAT_ID));
-}
-
-ssize_t strbuf_add_void(void *b, const void *data, size_t sz)
-{
-	strbuf_add(b, data, sz);
-	return sz;
-}
-
-int noop_flush(void *arg UNUSED)
-{
-	return 0;
-}
diff --git a/reftable/test_framework.h b/reftable/test_framework.h
deleted file mode 100644
index 687390f9c2..0000000000
--- a/reftable/test_framework.h
+++ /dev/null
@@ -1,61 +0,0 @@ 
-/*
-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
-*/
-
-#ifndef TEST_FRAMEWORK_H
-#define TEST_FRAMEWORK_H
-
-#include "system.h"
-#include "reftable-error.h"
-
-#define EXPECT_ERR(c)                                                          \
-	do {                                                                   \
-		if (c != 0) {                                                  \
-			fflush(stderr);                                        \
-			fflush(stdout);                                        \
-			fprintf(stderr, "%s: %d: error == %d (%s), want 0\n",  \
-				__FILE__, __LINE__, c, reftable_error_str(c)); \
-			abort();                                               \
-		}                                                              \
-	} while (0)
-
-#define EXPECT_STREQ(a, b)                                                       \
-	do {                                                                     \
-		if (strcmp(a, b)) {                                              \
-			fflush(stderr);                                          \
-			fflush(stdout);                                          \
-			fprintf(stderr, "%s:%d: %s (%s) != %s (%s)\n", __FILE__, \
-				__LINE__, #a, a, #b, b);                         \
-			abort();                                                 \
-		}                                                                \
-	} while (0)
-
-#define EXPECT(c)                                                                  \
-	do {                                                                       \
-		if (!(c)) {                                                        \
-			fflush(stderr);                                            \
-			fflush(stdout);                                            \
-			fprintf(stderr, "%s: %d: failed assertion %s\n", __FILE__, \
-				__LINE__, #c);                                     \
-			abort();                                                   \
-		}                                                                  \
-	} while (0)
-
-#define RUN_TEST(f)                          \
-	fprintf(stderr, "running %s\n", #f); \
-	fflush(stderr);                      \
-	f();
-
-void set_test_hash(uint8_t *p, int i);
-
-/* Like strbuf_add, but suitable for passing to reftable_new_writer
- */
-ssize_t strbuf_add_void(void *b, const void *data, size_t sz);
-
-int noop_flush(void *);
-
-#endif
diff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c
index d27d7ee798..29d4e9a755 100644
--- a/t/helper/test-reftable.c
+++ b/t/helper/test-reftable.c
@@ -6,15 +6,8 @@ 
 #include "reftable/reftable-merged.h"
 #include "reftable/reftable-reader.h"
 #include "reftable/reftable-stack.h"
-#include "reftable/reftable-tests.h"
 #include "test-tool.h"
 
-int cmd__reftable(int argc, const char **argv)
-{
-	/* test from simple to complex. */
-	return 0;
-}
-
 static void print_help(void)
 {
 	printf("usage: dump [-st] arg\n\n"
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index f8a67df7de..252fa5de63 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -26,6 +26,7 @@  static struct test_cmd cmds[] = {
 	{ "drop-caches", cmd__drop_caches },
 	{ "dump-cache-tree", cmd__dump_cache_tree },
 	{ "dump-fsmonitor", cmd__dump_fsmonitor },
+	{ "dump-reftable", cmd__dump_reftable },
 	{ "dump-split-index", cmd__dump_split_index },
 	{ "dump-untracked-cache", cmd__dump_untracked_cache },
 	{ "env-helper", cmd__env_helper },
@@ -61,9 +62,7 @@  static struct test_cmd cmds[] = {
 	{ "read-graph", cmd__read_graph },
 	{ "read-midx", cmd__read_midx },
 	{ "ref-store", cmd__ref_store },
-	{ "reftable", cmd__reftable },
 	{ "rot13-filter", cmd__rot13_filter },
-	{ "dump-reftable", cmd__dump_reftable },
 	{ "regex", cmd__regex },
 	{ "repository", cmd__repository },
 	{ "revision-walking", cmd__revision_walking },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index e74bc0ffd4..84291318cb 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -55,7 +55,6 @@  int cmd__read_graph(int argc, const char **argv);
 int cmd__read_midx(int argc, const char **argv);
 int cmd__ref_store(int argc, const char **argv);
 int cmd__rot13_filter(int argc, const char **argv);
-int cmd__reftable(int argc, const char **argv);
 int cmd__regex(int argc, const char **argv);
 int cmd__repository(int argc, const char **argv);
 int cmd__revision_walking(int argc, const char **argv);
diff --git a/t/t0032-reftable-unittest.sh b/t/t0032-reftable-unittest.sh
deleted file mode 100755
index 471cb37ac2..0000000000
--- a/t/t0032-reftable-unittest.sh
+++ /dev/null
@@ -1,16 +0,0 @@ 
-#!/bin/sh
-#
-# Copyright (c) 2020 Google LLC
-#
-
-test_description='reftable unittests'
-
-TEST_PASSES_SANITIZE_LEAK=true
-. ./test-lib.sh
-
-test_expect_success 'unittests' '
-	TMPDIR=$(pwd) && export TMPDIR &&
-	test-tool reftable
-'
-
-test_done