DPDK patches and discussions
 help / color / mirror / Atom feed
* [RFC] test: remove dead cfgfile tests
@ 2024-07-08 16:55 Stephen Hemminger
  2024-07-09  8:57 ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2024-07-08 16:55 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Thomas Monjalon

The tests for the cfgfile library were never built since the conversion
to meson (in 2017). Remove the dead code and files, if someone wants
to fix them then they can be restored later.
See commit b5dc795a8a55 ("test: build app with meson as dpdk-test")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 MAINTAINERS                                   |   2 -
 app/test/meson.build                          |   2 -
 app/test/resource.c                           | 276 ---------------
 app/test/resource.h                           | 106 ------
 app/test/test_cfgfile.c                       | 334 ------------------
 app/test/test_cfgfiles/etc/empty.ini          |   0
 .../test_cfgfiles/etc/empty_key_value.ini     |   3 -
 .../test_cfgfiles/etc/invalid_section.ini     |   3 -
 app/test/test_cfgfiles/etc/line_too_long.ini  |   3 -
 .../test_cfgfiles/etc/missing_section.ini     |   2 -
 .../test_cfgfiles/etc/realloc_sections.ini    | 128 -------
 app/test/test_cfgfiles/etc/sample1.ini        |  12 -
 app/test/test_cfgfiles/etc/sample2.ini        |  12 -
 13 files changed, 883 deletions(-)
 delete mode 100644 app/test/resource.c
 delete mode 100644 app/test/resource.h
 delete mode 100644 app/test/test_cfgfile.c
 delete mode 100644 app/test/test_cfgfiles/etc/empty.ini
 delete mode 100644 app/test/test_cfgfiles/etc/empty_key_value.ini
 delete mode 100644 app/test/test_cfgfiles/etc/invalid_section.ini
 delete mode 100644 app/test/test_cfgfiles/etc/line_too_long.ini
 delete mode 100644 app/test/test_cfgfiles/etc/missing_section.ini
 delete mode 100644 app/test/test_cfgfiles/etc/realloc_sections.ini
 delete mode 100644 app/test/test_cfgfiles/etc/sample1.ini
 delete mode 100644 app/test/test_cfgfiles/etc/sample2.ini

diff --git a/MAINTAINERS b/MAINTAINERS
index 533f707d5f..d18b1571ab 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1686,8 +1686,6 @@ F: app/test/test_argparse.c
 Configuration file
 M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
 F: lib/cfgfile/
-F: app/test/test_cfgfile.c
-F: app/test/test_cfgfiles/
 
 Interactive command line
 F: lib/cmdline/
diff --git a/app/test/meson.build b/app/test/meson.build
index e29258e6ec..aad988410c 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -36,7 +36,6 @@ source_file_deps = {
     'test_bitratestats.c': ['metrics', 'bitratestats', 'ethdev'] + sample_packet_forward_deps,
     'test_bpf.c': ['bpf', 'net'],
     'test_byteorder.c': [],
-#    'test_cfgfile.c': ['cfgfile'],
     'test_cksum.c': ['net'],
     'test_cksum_perf.c': ['net'],
     'test_cmdline.c': [],
@@ -154,7 +153,6 @@ source_file_deps = {
     'test_reciprocal_division_perf.c': [],
     'test_red.c': ['sched'],
     'test_reorder.c': ['reorder'],
-#    'test_resource.c': [],
     'test_rib.c': ['net', 'rib'],
     'test_rib6.c': ['net', 'rib'],
     'test_ring.c': ['ptr_compress'],
diff --git a/app/test/resource.c b/app/test/resource.c
deleted file mode 100644
index 34465f1668..0000000000
--- a/app/test/resource.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/queue.h>
-
-#include <rte_debug.h>
-
-#include "resource.h"
-
-struct resource_list resource_list = TAILQ_HEAD_INITIALIZER(resource_list);
-
-size_t resource_size(const struct resource *r)
-{
-	return r->end - r->begin;
-}
-
-const struct resource *resource_find(const char *name)
-{
-	struct resource *r;
-
-	TAILQ_FOREACH(r, &resource_list, next) {
-		RTE_VERIFY(r->name);
-
-		if (!strcmp(r->name, name))
-			return r;
-	}
-
-	return NULL;
-}
-
-int resource_fwrite(const struct resource *r, FILE *f)
-{
-	const size_t goal = resource_size(r);
-	size_t total = 0;
-
-	while (total < goal) {
-		size_t wlen = fwrite(r->begin + total, 1, goal - total, f);
-		if (wlen == 0) {
-			perror(__func__);
-			return -1;
-		}
-
-		total += wlen;
-	}
-
-	return 0;
-}
-
-int resource_fwrite_file(const struct resource *r, const char *fname)
-{
-	FILE *f;
-	int ret;
-
-	f = fopen(fname, "w");
-	if (f == NULL) {
-		perror(__func__);
-		return -1;
-	}
-
-	ret = resource_fwrite(r, f);
-	fclose(f);
-	return ret;
-}
-
-#ifdef RTE_APP_TEST_RESOURCE_TAR
-#include <archive.h>
-#include <archive_entry.h>
-
-static int do_copy(struct archive *r, struct archive *w)
-{
-	const void *buf;
-	size_t len;
-#if ARCHIVE_VERSION_NUMBER >= 3000000
-	int64_t off;
-#else
-	off_t off;
-#endif
-	int ret;
-
-	while (1) {
-		ret = archive_read_data_block(r, &buf, &len, &off);
-		if (ret == ARCHIVE_RETRY)
-			continue;
-
-		if (ret == ARCHIVE_EOF)
-			return 0;
-
-		if (ret != ARCHIVE_OK)
-			return ret;
-
-		do {
-			ret = archive_write_data_block(w, buf, len, off);
-			if (ret != ARCHIVE_OK && ret != ARCHIVE_RETRY)
-				return ret;
-		} while (ret != ARCHIVE_OK);
-	}
-}
-
-int resource_untar(const struct resource *res)
-{
-	struct archive *r;
-	struct archive *w;
-	struct archive_entry *e;
-	void *p;
-	int flags = 0;
-	int ret;
-
-	p = malloc(resource_size(res));
-	if (p == NULL)
-		rte_panic("Failed to malloc %zu B\n", resource_size(res));
-
-	memcpy(p, res->begin, resource_size(res));
-
-	r = archive_read_new();
-	if (r == NULL) {
-		free(p);
-		return -1;
-	}
-
-	archive_read_support_format_all(r);
-	archive_read_support_filter_all(r);
-
-	w = archive_write_disk_new();
-	if (w == NULL) {
-		archive_read_free(r);
-		free(p);
-		return -1;
-	}
-
-	flags |= ARCHIVE_EXTRACT_PERM;
-	flags |= ARCHIVE_EXTRACT_FFLAGS;
-	archive_write_disk_set_options(w, flags);
-	archive_write_disk_set_standard_lookup(w);
-
-	ret = archive_read_open_memory(r, p, resource_size(res));
-	if (ret != ARCHIVE_OK)
-		goto fail;
-
-	while (1) {
-		ret = archive_read_next_header(r, &e);
-		if (ret == ARCHIVE_EOF)
-			break;
-		if (ret != ARCHIVE_OK)
-			goto fail;
-
-		ret = archive_write_header(w, e);
-		if (ret == ARCHIVE_EOF)
-			break;
-		if (ret != ARCHIVE_OK)
-			goto fail;
-
-		if (archive_entry_size(e) == 0)
-			continue;
-
-		ret = do_copy(r, w);
-		if (ret != ARCHIVE_OK)
-			goto fail;
-
-		ret = archive_write_finish_entry(w);
-		if (ret != ARCHIVE_OK)
-			goto fail;
-	}
-
-	archive_write_free(w);
-	archive_read_free(r);
-	free(p);
-	return 0;
-
-fail:
-	archive_write_free(w);
-	archive_read_free(r);
-	free(p);
-	rte_panic("Failed: %s\n", archive_error_string(r));
-	return -1;
-}
-
-int resource_rm_by_tar(const struct resource *res)
-{
-	struct archive *r;
-	struct archive_entry *e;
-	void *p;
-	int try_again = 1;
-	int attempts = 0;
-	int ret;
-
-	p = malloc(resource_size(res));
-	if (p == NULL)
-		rte_panic("Failed to malloc %zu B\n", resource_size(res));
-
-	memcpy(p, res->begin, resource_size(res));
-
-	/*
-	 * If somebody creates a file somewhere inside the extracted TAR
-	 * hierarchy during a test the resource_rm_by_tar might loop
-	 * infinitely. We prevent this by adding the attempts counter there.
-	 * In normal case, max N iteration is done where N is the depth of
-	 * the file-hierarchy.
-	 */
-	while (try_again && attempts < 10000) {
-		r = archive_read_new();
-		if (r == NULL) {
-			free(p);
-			return -1;
-		}
-
-		archive_read_support_format_all(r);
-		archive_read_support_filter_all(r);
-
-		ret = archive_read_open_memory(r, p, resource_size(res));
-		if (ret != ARCHIVE_OK) {
-			fprintf(stderr, "Failed: %s\n",
-					archive_error_string(r));
-			goto fail;
-		}
-
-		try_again = 0;
-
-		while (1) {
-			ret = archive_read_next_header(r, &e);
-			if (ret == ARCHIVE_EOF)
-				break;
-			if (ret != ARCHIVE_OK)
-				goto fail;
-
-			ret = remove(archive_entry_pathname(e));
-			if (ret < 0) {
-				switch (errno) {
-				case ENOTEMPTY:
-				case EEXIST:
-					try_again = 1;
-					break;
-
-				/* should not usually happen: */
-				case ENOENT:
-				case ENOTDIR:
-				case EROFS:
-					attempts += 1;
-					continue;
-				default:
-					perror("Failed to remove file");
-					goto fail;
-				}
-			}
-		}
-
-		archive_read_free(r);
-		attempts += 1;
-	}
-
-	if (attempts >= 10000) {
-		fprintf(stderr, "Failed to remove archive\n");
-		free(p);
-		return -1;
-	}
-
-	free(p);
-	return 0;
-
-fail:
-	archive_read_free(r);
-	free(p);
-
-	rte_panic("Failed: %s\n", archive_error_string(r));
-	return -1;
-}
-
-#endif /* RTE_APP_TEST_RESOURCE_TAR */
-
-void resource_register(struct resource *r)
-{
-	TAILQ_INSERT_TAIL(&resource_list, r, next);
-}
diff --git a/app/test/resource.h b/app/test/resource.h
deleted file mode 100644
index c75ebd4b5d..0000000000
--- a/app/test/resource.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016 RehiveTech. All rights reserved.
- */
-
-#ifndef _RESOURCE_H_
-#define _RESOURCE_H_
-
-/**
- * @file
- *
- * Test Resource API
- *
- * Each test can require and use some external resources. Usually, an external
- * resource is a file or a filesystem sub-hierarchy. A resource is included
- * inside the test executable.
- */
-
-#include <sys/queue.h>
-#include <stdio.h>
-#include <stddef.h>
-
-#include <rte_eal.h>
-#include <rte_common.h>
-
-TAILQ_HEAD(resource_list, resource);
-extern struct resource_list resource_list;
-
-/**
- * Representation of a resource. It points to the resource's binary data.
- * The semantics of the binary data are defined by the target test.
- */
-struct resource {
-	const char *name;  /**< Unique name of the resource */
-	const char *begin; /**< Start of resource data */
-	const char *end;   /**< End of resource data */
-	TAILQ_ENTRY(resource) next;
-};
-
-/**
- * @return size of the given resource
- */
-size_t resource_size(const struct resource *r);
-
-/**
- * Find a resource by name in the global list of resources.
- */
-const struct resource *resource_find(const char *name);
-
-/**
- * Write the raw data of the resource to the given file.
- * @return 0 on success
- */
-int resource_fwrite(const struct resource *r, FILE *f);
-
-/**
- * Write the raw data of the resource to the given file given by name.
- * The name is relative to the current working directory.
- * @return 0 on success
- */
-int resource_fwrite_file(const struct resource *r, const char *fname);
-
-/**
- * Treat the given resource as a tar archive. Extract
- * the archive to the current directory.
- */
-int resource_untar(const struct resource *res);
-
-/**
- * Treat the given resource as a tar archive. Remove
- * all files (related to the current directory) listed
- * in the tar archive.
- */
-int resource_rm_by_tar(const struct resource *res);
-
-/**
- * Register a resource in the global list of resources.
- * Not intended for direct use, please check the REGISTER_RESOURCE
- * macro.
- */
-void resource_register(struct resource *r);
-
-/**
- * Definition of a resource linked externally (by means of the used toolchain).
- * Only the base name of the resource is expected. The name refers to the
- * linked pointers beg_<name> and end_<name> provided externally.
- */
-#define REGISTER_LINKED_RESOURCE(n) \
-extern const char beg_ ##n;         \
-extern const char end_ ##n;         \
-REGISTER_RESOURCE(n, &beg_ ##n, &end_ ##n) \
-
-/**
- * Definition of a resource described by its name, and pointers begin, end.
- */
-#define REGISTER_RESOURCE(n, b, e) \
-static struct resource linkres_ ##n = {       \
-	.name = RTE_STR(n),     \
-	.begin = b,             \
-	.end = e,               \
-};                              \
-RTE_INIT(resinitfn_ ##n)	\
-{                               \
-	resource_register(&linkres_ ##n);  \
-}
-
-#endif
diff --git a/app/test/test_cfgfile.c b/app/test/test_cfgfile.c
deleted file mode 100644
index a5e3d8699c..0000000000
--- a/app/test/test_cfgfile.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2017 Wind River Systems, Inc.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <sys/queue.h>
-
-#include <rte_cfgfile.h>
-
-#include "test.h"
-#include "resource.h"
-
-
-#define CFG_FILES_ETC "test_cfgfiles/etc"
-
-REGISTER_LINKED_RESOURCE(test_cfgfiles);
-
-static int
-test_cfgfile_setup(void)
-{
-	const struct resource *r;
-	int ret;
-
-	r = resource_find("test_cfgfiles");
-	TEST_ASSERT_NOT_NULL(r, "missing resource test_cfgfiles");
-
-	ret = resource_untar(r);
-	TEST_ASSERT_SUCCESS(ret, "failed to untar %s", r->name);
-
-	return 0;
-}
-
-static int
-test_cfgfile_cleanup(void)
-{
-	const struct resource *r;
-	int ret;
-
-	r = resource_find("test_cfgfiles");
-	TEST_ASSERT_NOT_NULL(r, "missing resource test_cfgfiles");
-
-	ret = resource_rm_by_tar(r);
-	TEST_ASSERT_SUCCESS(ret, "Failed to delete resource %s", r->name);
-
-	return 0;
-}
-
-static int
-_test_cfgfile_sample(struct rte_cfgfile *cfgfile)
-{
-	const char *value;
-	int ret;
-
-	ret = rte_cfgfile_num_sections(cfgfile, NULL, 0);
-	TEST_ASSERT(ret == 2, "Unexpected number of sections: %d", ret);
-
-	ret = rte_cfgfile_has_section(cfgfile, "section1");
-	TEST_ASSERT(ret, "section1 section missing");
-
-	ret = rte_cfgfile_section_num_entries(cfgfile, "section1");
-	TEST_ASSERT(ret == 1, "section1 unexpected number of entries: %d", ret);
-
-	value = rte_cfgfile_get_entry(cfgfile, "section1", "key1");
-	TEST_ASSERT(strcmp("value1", value) == 0,
-		    "key1 unexpected value: %s", value);
-
-	ret = rte_cfgfile_has_section(cfgfile, "section2");
-	TEST_ASSERT(ret, "section2 section missing");
-
-	ret = rte_cfgfile_section_num_entries(cfgfile, "section2");
-	TEST_ASSERT(ret == 2, "section2 unexpected number of entries: %d", ret);
-
-	value = rte_cfgfile_get_entry(cfgfile, "section2", "key2");
-	TEST_ASSERT(strcmp("value2", value) == 0,
-		    "key2 unexpected value: %s", value);
-
-	value = rte_cfgfile_get_entry(cfgfile, "section2", "key3");
-	TEST_ASSERT(strcmp("value3", value) == 0,
-		    "key3 unexpected value: %s", value);
-
-	return 0;
-}
-
-static int
-test_cfgfile_sample1(void)
-{
-	struct rte_cfgfile *cfgfile;
-	int ret;
-
-	cfgfile = rte_cfgfile_load(CFG_FILES_ETC "/sample1.ini", 0);
-	TEST_ASSERT_NOT_NULL(cfgfile, "Failed to load config file");
-
-	ret = _test_cfgfile_sample(cfgfile);
-	TEST_ASSERT_SUCCESS(ret, "Failed to validate sample file: %d", ret);
-
-	ret = rte_cfgfile_close(cfgfile);
-	TEST_ASSERT_SUCCESS(ret, "Failed to close cfgfile");
-
-	return 0;
-}
-
-static int
-test_cfgfile_sample2(void)
-{
-	struct rte_cfgfile_parameters params;
-	struct rte_cfgfile *cfgfile;
-	int ret;
-
-	/* override comment character */
-	memset(&params, 0, sizeof(params));
-	params.comment_character = '#';
-
-	cfgfile = rte_cfgfile_load_with_params(CFG_FILES_ETC "/sample2.ini", 0,
-					       &params);
-	TEST_ASSERT_NOT_NULL(cfgfile, "Failed to parse sample2.ini");
-
-	ret = _test_cfgfile_sample(cfgfile);
-	TEST_ASSERT_SUCCESS(ret, "Failed to validate sample file: %d", ret);
-
-	ret = rte_cfgfile_close(cfgfile);
-	TEST_ASSERT_SUCCESS(ret, "Failed to close cfgfile");
-
-	return 0;
-}
-
-static int
-test_cfgfile_realloc_sections(void)
-{
-	struct rte_cfgfile *cfgfile;
-	int ret;
-	const char *value;
-
-	cfgfile = rte_cfgfile_load(CFG_FILES_ETC "/realloc_sections.ini", 0);
-	TEST_ASSERT_NOT_NULL(cfgfile, "Failed to load config file");
-
-	ret = rte_cfgfile_num_sections(cfgfile, NULL, 0);
-	TEST_ASSERT(ret == 9, "Unexpected number of sections: %d", ret);
-
-	ret = rte_cfgfile_has_section(cfgfile, "section9");
-	TEST_ASSERT(ret, "section9 missing");
-
-	ret = rte_cfgfile_section_num_entries(cfgfile, "section3");
-	TEST_ASSERT(ret == 21,
-			"section3 unexpected number of entries: %d", ret);
-
-	ret = rte_cfgfile_section_num_entries(cfgfile, "section9");
-	TEST_ASSERT(ret == 8, "section9 unexpected number of entries: %d", ret);
-
-	value = rte_cfgfile_get_entry(cfgfile, "section9", "key8");
-	TEST_ASSERT(strcmp("value8_section9", value) == 0,
-		    "key unexpected value: %s", value);
-
-	ret = rte_cfgfile_save(cfgfile, "/tmp/cfgfile_save.ini");
-	TEST_ASSERT_SUCCESS(ret, "Failed to save *.ini file");
-	remove("/tmp/cfgfile_save.ini");
-
-	ret = rte_cfgfile_close(cfgfile);
-	TEST_ASSERT_SUCCESS(ret, "Failed to close cfgfile");
-
-	return 0;
-}
-
-static int
-test_cfgfile_invalid_section_header(void)
-{
-	struct rte_cfgfile *cfgfile;
-
-	cfgfile = rte_cfgfile_load(CFG_FILES_ETC "/invalid_section.ini", 0);
-	TEST_ASSERT_NULL(cfgfile, "Expected failure did not occur");
-
-	return 0;
-}
-
-static int
-test_cfgfile_invalid_comment(void)
-{
-	struct rte_cfgfile_parameters params;
-	struct rte_cfgfile *cfgfile;
-
-	/* override comment character with an invalid one */
-	memset(&params, 0, sizeof(params));
-	params.comment_character = '$';
-
-	cfgfile = rte_cfgfile_load_with_params(CFG_FILES_ETC "/sample2.ini", 0,
-					       &params);
-	TEST_ASSERT_NULL(cfgfile, "Expected failure did not occur");
-
-	return 0;
-}
-
-static int
-test_cfgfile_invalid_key_value_pair(void)
-{
-	struct rte_cfgfile *cfgfile;
-
-	cfgfile = rte_cfgfile_load(CFG_FILES_ETC "/empty_key_value.ini", 0);
-	TEST_ASSERT_NULL(cfgfile, "Expected failure did not occur");
-
-	return 0;
-}
-
-static int
-test_cfgfile_empty_key_value_pair(void)
-{
-	struct rte_cfgfile *cfgfile;
-	const char *value;
-	int ret;
-
-	cfgfile = rte_cfgfile_load(CFG_FILES_ETC "/empty_key_value.ini",
-				   CFG_FLAG_EMPTY_VALUES);
-	TEST_ASSERT_NOT_NULL(cfgfile, "Failed to parse empty_key_value.ini");
-
-	ret = rte_cfgfile_num_sections(cfgfile, NULL, 0);
-	TEST_ASSERT(ret == 1, "Unexpected number of sections: %d", ret);
-
-	ret = rte_cfgfile_has_section(cfgfile, "section1");
-	TEST_ASSERT(ret, "section1 missing");
-
-	ret = rte_cfgfile_section_num_entries(cfgfile, "section1");
-	TEST_ASSERT(ret == 1, "section1 unexpected number of entries: %d", ret);
-
-	value = rte_cfgfile_get_entry(cfgfile, "section1", "key");
-	TEST_ASSERT(strlen(value) == 0, "key unexpected value: %s", value);
-
-	ret = rte_cfgfile_close(cfgfile);
-	TEST_ASSERT_SUCCESS(ret, "Failed to close cfgfile");
-
-	return 0;
-}
-
-static int
-test_cfgfile_missing_section(void)
-{
-	struct rte_cfgfile *cfgfile;
-
-	cfgfile = rte_cfgfile_load(CFG_FILES_ETC "/missing_section.ini", 0);
-	TEST_ASSERT_NULL(cfgfile, "Expected failure did not occur");
-
-	return 0;
-}
-
-static int
-test_cfgfile_global_properties(void)
-{
-	struct rte_cfgfile *cfgfile;
-	const char *value;
-	int ret;
-
-	cfgfile = rte_cfgfile_load(CFG_FILES_ETC "/missing_section.ini",
-				   CFG_FLAG_GLOBAL_SECTION);
-	TEST_ASSERT_NOT_NULL(cfgfile, "Failed to load config file");
-
-	ret = rte_cfgfile_num_sections(cfgfile, NULL, 0);
-	TEST_ASSERT(ret == 1, "Unexpected number of sections: %d", ret);
-
-	ret = rte_cfgfile_has_section(cfgfile, "GLOBAL");
-	TEST_ASSERT(ret, "global section missing");
-
-	ret = rte_cfgfile_section_num_entries(cfgfile, "GLOBAL");
-	TEST_ASSERT(ret == 1, "GLOBAL unexpected number of entries: %d", ret);
-
-	value = rte_cfgfile_get_entry(cfgfile, "GLOBAL", "key");
-	TEST_ASSERT(strcmp("value", value) == 0,
-		    "key unexpected value: %s", value);
-
-	ret = rte_cfgfile_close(cfgfile);
-	TEST_ASSERT_SUCCESS(ret, "Failed to close cfgfile");
-
-	return 0;
-}
-
-static int
-test_cfgfile_empty_file(void)
-{
-	struct rte_cfgfile *cfgfile;
-	int ret;
-
-	cfgfile = rte_cfgfile_load(CFG_FILES_ETC "/empty.ini", 0);
-	TEST_ASSERT_NOT_NULL(cfgfile, "Failed to load config file");
-
-	ret = rte_cfgfile_num_sections(cfgfile, NULL, 0);
-	TEST_ASSERT(ret == 0, "Unexpected number of sections: %d", ret);
-
-	ret = rte_cfgfile_close(cfgfile);
-	TEST_ASSERT_SUCCESS(ret, "Failed to close cfgfile");
-
-	return 0;
-}
-
-static int
-test_cfgfile(void)
-{
-	if (test_cfgfile_setup())
-		return -1;
-
-	if (test_cfgfile_sample1())
-		return -1;
-
-	if (test_cfgfile_sample2())
-		return -1;
-
-	if (test_cfgfile_realloc_sections())
-		return -1;
-
-	if (test_cfgfile_invalid_section_header())
-		return -1;
-
-	if (test_cfgfile_invalid_comment())
-		return -1;
-
-	if (test_cfgfile_invalid_key_value_pair())
-		return -1;
-
-	if (test_cfgfile_empty_key_value_pair())
-		return -1;
-
-	if (test_cfgfile_missing_section())
-		return -1;
-
-	if (test_cfgfile_global_properties())
-		return -1;
-
-	if (test_cfgfile_empty_file())
-		return -1;
-
-	if (test_cfgfile_cleanup())
-		return -1;
-
-	return 0;
-}
-
-REGISTER_TEST_COMMAND(cfgfile_autotest, test_cfgfile);
diff --git a/app/test/test_cfgfiles/etc/empty.ini b/app/test/test_cfgfiles/etc/empty.ini
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/app/test/test_cfgfiles/etc/empty_key_value.ini b/app/test/test_cfgfiles/etc/empty_key_value.ini
deleted file mode 100644
index 53284467b3..0000000000
--- a/app/test/test_cfgfiles/etc/empty_key_value.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[section1]
-; this is section 1
-key=
diff --git a/app/test/test_cfgfiles/etc/invalid_section.ini b/app/test/test_cfgfiles/etc/invalid_section.ini
deleted file mode 100644
index 95d6803977..0000000000
--- a/app/test/test_cfgfiles/etc/invalid_section.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[invalid
-; this is section 1
-key1=value1
diff --git a/app/test/test_cfgfiles/etc/line_too_long.ini b/app/test/test_cfgfiles/etc/line_too_long.ini
deleted file mode 100644
index 1dce164838..0000000000
--- a/app/test/test_cfgfiles/etc/line_too_long.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[section1]
-; this is section 1
-012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
diff --git a/app/test/test_cfgfiles/etc/missing_section.ini b/app/test/test_cfgfiles/etc/missing_section.ini
deleted file mode 100644
index c78e131b40..0000000000
--- a/app/test/test_cfgfiles/etc/missing_section.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-; no section
-key=value
diff --git a/app/test/test_cfgfiles/etc/realloc_sections.ini b/app/test/test_cfgfiles/etc/realloc_sections.ini
deleted file mode 100644
index e653e40c6b..0000000000
--- a/app/test/test_cfgfiles/etc/realloc_sections.ini
+++ /dev/null
@@ -1,128 +0,0 @@
-[section1]
-key1=value1_section1
-key2=value2_section1
-key3=value3_section1
-key4=value4_section1
-key5=value5_section1
-key6=value6_section1
-key7=value7_section1
-key8=value8_section1
-key9=value9_section1
-key10=value10_section1
-key11=value11_section1
-key12=value12_section1
-key13=value13_section1
-key14=value14_section1
-key15=value15_section1
-key16=value16_section1
-key17=value17_section1
-key18=value18_section1
-key19=value19_section1
-key20=value20_section1
-key21=value21_section1
-
-[section2]
-key1=value1_section2
-key2=value2_section2
-key3=value3_section2
-key4=value4_section2
-key5=value5_section2
-key6=value6_section2
-key7=value7_section2
-key8=value8_section2
-key9=value9_section2
-key10=value10_section2
-key11=value11_section2
-key12=value12_section2
-key13=value13_section2
-key14=value14_section2
-key15=value15_section2
-key16=value16_section2
-key17=value17_section2
-key18=value18_section2
-key19=value19_section2
-key20=value20_section2
-key21=value21_section2
-
-[section3]
-key1=value1_section3
-key2=value2_section3
-key3=value3_section3
-key4=value4_section3
-key5=value5_section3
-key6=value6_section3
-key7=value7_section3
-key8=value8_section3
-key9=value9_section3
-key10=value10_section3
-key11=value11_section3
-key12=value12_section3
-key13=value13_section3
-key14=value14_section3
-key15=value15_section3
-key16=value16_section3
-key17=value17_section3
-key18=value18_section3
-key19=value19_section3
-key20=value20_section3
-key21=value21_section3
-
-[section4]
-key1=value1_section4
-key2=value2_section4
-key3=value3_section4
-key4=value4_section4
-key5=value5_section4
-key6=value6_section4
-key7=value7_section4
-key8=value8_section4
-
-[section5]
-key1=value1_section5
-key2=value2_section5
-key3=value3_section5
-key4=value4_section5
-key5=value5_section5
-key6=value6_section5
-key7=value7_section5
-key8=value8_section5
-
-[section6]
-key1=value1_section6
-key2=value2_section6
-key3=value3_section6
-key4=value4_section6
-key5=value5_section6
-key6=value6_section6
-key7=value7_section6
-key8=value8_section6
-
-[section7]
-key1=value1_section7
-key2=value2_section7
-key3=value3_section7
-key4=value4_section7
-key5=value5_section7
-key6=value6_section7
-key7=value7_section7
-key8=value8_section7
-
-[section8]
-key1=value1_section8
-key2=value2_section8
-key3=value3_section8
-key4=value4_section8
-key5=value5_section8
-key6=value6_section8
-key7=value7_section8
-key8=value8_section8
-
-[section9]
-key1=value1_section9
-key2=value2_section9
-key3=value3_section9
-key4=value4_section9
-key5=value5_section9
-key6=value6_section9
-key7=value7_section9
-key8=value8_section9
diff --git a/app/test/test_cfgfiles/etc/sample1.ini b/app/test/test_cfgfiles/etc/sample1.ini
deleted file mode 100644
index aef91c2416..0000000000
--- a/app/test/test_cfgfiles/etc/sample1.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-; this is a global comment
-
-[section1]
-; this is section 1
-key1=value1
-
-[section2]
-; this is section 2
-;key1=value1
-key2=value2
-key3=value3 ; this is key3
-ignore-missing-separator
diff --git a/app/test/test_cfgfiles/etc/sample2.ini b/app/test/test_cfgfiles/etc/sample2.ini
deleted file mode 100644
index 21075e9763..0000000000
--- a/app/test/test_cfgfiles/etc/sample2.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-# this is a global comment
-
-[section1]
-# this is section 1
-key1=value1
-
-[section2]
-# this is section 2
-#key1=value1
-key2=value2
-key3=value3 # this is key3
-ignore-missing-separator
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] test: remove dead cfgfile tests
  2024-07-08 16:55 [RFC] test: remove dead cfgfile tests Stephen Hemminger
@ 2024-07-09  8:57 ` Thomas Monjalon
  2024-07-09  9:21   ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Monjalon @ 2024-07-09  8:57 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

08/07/2024 18:55, Stephen Hemminger:
> The tests for the cfgfile library were never built since the conversion
> to meson (in 2017). Remove the dead code and files, if someone wants
> to fix them then they can be restored later.
> See commit b5dc795a8a55 ("test: build app with meson as dpdk-test")
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  MAINTAINERS                                   |   2 -
>  app/test/meson.build                          |   2 -
>  app/test/resource.c                           | 276 ---------------
>  app/test/resource.h                           | 106 ------
>  app/test/test_cfgfile.c                       | 334 ------------------

As far as I remember, resource tests are different of cfgfile.
What is the problem of building cfgfile tests? Many errors? Which kind of error?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] test: remove dead cfgfile tests
  2024-07-09  8:57 ` Thomas Monjalon
@ 2024-07-09  9:21   ` Bruce Richardson
  0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2024-07-09  9:21 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Stephen Hemminger, dev

On Tue, Jul 09, 2024 at 10:57:55AM +0200, Thomas Monjalon wrote:
> 08/07/2024 18:55, Stephen Hemminger:
> > The tests for the cfgfile library were never built since the conversion
> > to meson (in 2017). Remove the dead code and files, if someone wants
> > to fix them then they can be restored later.
> > See commit b5dc795a8a55 ("test: build app with meson as dpdk-test")
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  MAINTAINERS                                   |   2 -
> >  app/test/meson.build                          |   2 -
> >  app/test/resource.c                           | 276 ---------------
> >  app/test/resource.h                           | 106 ------
> >  app/test/test_cfgfile.c                       | 334 ------------------
> 
> As far as I remember, resource tests are different of cfgfile.
> What is the problem of building cfgfile tests? Many errors? Which kind of error?
>
cfgfile tests use a dummy config file as a resource.

/Bruce

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-09  9:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-08 16:55 [RFC] test: remove dead cfgfile tests Stephen Hemminger
2024-07-09  8:57 ` Thomas Monjalon
2024-07-09  9:21   ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).