From 43c1a522fb46dd14d30275a7079c8262aa17cce9 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 4 Sep 2024 10:17:47 -0700 Subject: [PATCH] t: clean up leftover reftable test cruft 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 Mentored-by: Christian Couder Signed-off-by: Chandra Pratap --- reftable/reftable-tests.h | 13 -------- reftable/test_framework.c | 27 ---------------- reftable/test_framework.h | 61 ------------------------------------ t/helper/test-reftable.c | 6 ---- t/helper/test-tool.c | 3 +- t/helper/test-tool.h | 1 - t/t0032-reftable-unittest.sh | 16 ---------- 7 files changed, 1 insertion(+), 126 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 --git a/reftable/reftable-tests.h b/reftable/reftable-tests.h deleted file mode 100644 index 05f8d2d5bc4a59..00000000000000 --- 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 a07fec5d84f867..00000000000000 --- 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 687390f9c239a3..00000000000000 --- 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 d27d7ee798ef13..e62298c6a4a6b2 100644 --- a/t/helper/test-reftable.c +++ b/t/helper/test-reftable.c @@ -9,12 +9,6 @@ #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 f8a67df7de90fc..252fa5de637a95 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 e74bc0ffd4179c..84291318cb3ae6 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 471cb37ac28aff..00000000000000 --- 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