From 43afae523e002f86982c3d2f15b49535eb02b4df Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Wed, 18 Jun 2025 13:32:31 +0200 Subject: [PATCH] Remove dbltExpand test This is an older manual test to compare dbLoadTemplate to compare to msi's output. However, it does not link properly with dbCore due to the rewriting of dbLoadRecords, so it is being removed. --- modules/database/test/ioc/dbtemplate/Makefile | 5 - .../database/test/ioc/dbtemplate/dbltExpand.c | 101 ------------------ 2 files changed, 106 deletions(-) delete mode 100644 modules/database/test/ioc/dbtemplate/dbltExpand.c diff --git a/modules/database/test/ioc/dbtemplate/Makefile b/modules/database/test/ioc/dbtemplate/Makefile index dbb13f337..bd23e7671 100644 --- a/modules/database/test/ioc/dbtemplate/Makefile +++ b/modules/database/test/ioc/dbtemplate/Makefile @@ -9,11 +9,6 @@ TOP = ../../../../.. include $(TOP)/configure/CONFIG -TESTPROD_HOST_DEFAULT = dbltExpand -TESTPROD_HOST_WIN32 = -nil- -dbltExpand_SRCS += dbltExpand.c -dbltExpand_LIBS += dbCore ca Com - TESTS += msi TESTSCRIPTS_HOST += $(TESTS:%=%.t) diff --git a/modules/database/test/ioc/dbtemplate/dbltExpand.c b/modules/database/test/ioc/dbtemplate/dbltExpand.c deleted file mode 100644 index 84dbefd41..000000000 --- a/modules/database/test/ioc/dbtemplate/dbltExpand.c +++ /dev/null @@ -1,101 +0,0 @@ -/*************************************************************************\ -* Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne -* National Laboratory. -* SPDX-License-Identifier: EPICS -* EPICS Base is distributed subject to a Software License Agreement found -* in the file LICENSE that is included with this distribution. -\*************************************************************************/ - -/* This is a simple version of msi for testing the dbLoadTemplate() code. - * - * It calls dbLoadTemplate() to parse the substitution file, but replaces - * dbLoadRecords() with its own version that reads the template file, - * expands any macros in the text and prints the result to stdout. - * - * This technique won't work on Windows, dbLoadRecords() has to be - * epicsShare... decorated and loaded from a shared library. - */ - -#include -#include -#include -#include - -#include "macLib.h" -#include "dbLoadTemplate.h" - - -#define BUFFER_SIZE 0x10000 - -static char *input_buffer, *output_buffer; - -int dbLoadRecords(const char *file, const char *macros) -{ - MAC_HANDLE *macHandle = NULL; - char **macPairs; - FILE *fp; - size_t input_len; - - if (macCreateHandle(&macHandle, NULL)) { - fprintf(stderr, "macCreateHandle failed\n"); - exit(1); - } - - macSuppressWarning(macHandle, 1); - macParseDefns(macHandle, macros, &macPairs); - if (!macPairs) { - macDeleteHandle(macHandle); - macHandle = NULL; - } else { - macInstallMacros(macHandle, macPairs); - free(macPairs); - } - - fp = fopen(file, "r"); - if (!fp) { - fprintf(stderr, "fopen('%s') failed: %s\n", file, strerror(errno)); - exit(1); - } - - input_len = fread(input_buffer, 1, BUFFER_SIZE, fp); - if (!feof(fp)) { - fprintf(stderr, "input file > 64K!\n"); - fclose(fp); - exit(1); - } - input_buffer[input_len] = 0; - - if (fclose(fp)) { - fprintf(stderr, "fclose('%s') failed: %s\n", file, strerror(errno)); - exit(1); - } - - macExpandString(macHandle, input_buffer, output_buffer, BUFFER_SIZE-1); - printf("%s", output_buffer); - - if (macHandle) macDeleteHandle(macHandle); - - return 0; -} - -int main(int argc, char **argv) -{ - input_buffer = malloc(BUFFER_SIZE); - output_buffer = malloc(BUFFER_SIZE); - - if (!input_buffer || !output_buffer) { - fprintf(stderr, "malloc(%d) failed\n", BUFFER_SIZE); - exit(1); - } - - if (argc != 2) { - fprintf(stderr, "Usage: %s file.sub\n", argv[0]); - exit(1); - } - - dbLoadTemplate(argv[1], NULL, NULL); - - free(output_buffer); - free(input_buffer); - return 0; -}