[MERGED] osmo-hlr[master]: Remove unused src/db_test.c

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Apr 17 14:40:23 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Remove unused src/db_test.c
......................................................................


Remove unused src/db_test.c

There's a larger test suite in use in tests/db/db_test.c

Change-Id: Ifa409df9b4bb94bd4e8f15568486066393009494
---
M src/Makefile.am
D src/db_test.c
2 files changed, 0 insertions(+), 91 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/Makefile.am b/src/Makefile.am
index 9fbb062..60fc479 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,10 +38,6 @@
 	osmo-hlr-db-tool \
 	$(NULL)
 
-noinst_PROGRAMS = \
-	db_test \
-	$(NULL)
-
 osmo_hlr_SOURCES = \
 	auc.c \
 	ctrl.c \
diff --git a/src/db_test.c b/src/db_test.c
deleted file mode 100644
index 0d10797..0000000
--- a/src/db_test.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include <string.h>
-
-#include <osmocom/core/utils.h>
-#include <osmocom/core/application.h>
-
-#include "db.h"
-#include "hlr.h"
-#include "rand.h"
-#include "logging.h"
-
-static struct hlr *g_hlr;
-
-static int test(const char *imsi, struct db_context *dbc)
-{
-	struct osmo_auth_vector vec[3];
-	int rc, i;
-
-	/* initialize all vectors with a known token pattern */
-	memset(vec, 0x55, sizeof(vec));
-	for (i = 0; i < ARRAY_SIZE(vec); i++)
-		vec[i].res_len = 0;
-
-	rc = db_get_auc(dbc, imsi, 0, vec, ARRAY_SIZE(vec), NULL, NULL);
-	if (rc <= 0) {
-		LOGP(DMAIN, LOGL_ERROR, "Cannot obtain auth tuples for '%s'\n", imsi);
-		return rc;
-	}
-	LOGP(DMAIN, LOGL_INFO, "Obtained %u tuples for subscriber IMSI %s\n",
-		rc, imsi);
-
-	for (i = 0; i < rc; i++) {
-		struct osmo_auth_vector *v = vec + i;
-		LOGP(DMAIN, LOGL_DEBUG, "Tuple %u, auth_types=0x%x\n", i, v->auth_types);
-		LOGP(DMAIN, LOGL_DEBUG, "RAND=%s\n", osmo_hexdump_nospc(v->rand, sizeof(v->rand)));
-		LOGP(DMAIN, LOGL_DEBUG, "AUTN=%s\n", osmo_hexdump_nospc(v->autn, sizeof(v->autn)));
-		LOGP(DMAIN, LOGL_DEBUG, "CK=%s\n", osmo_hexdump_nospc(v->ck, sizeof(v->ck)));
-		LOGP(DMAIN, LOGL_DEBUG, "IK=%s\n", osmo_hexdump_nospc(v->ik, sizeof(v->ik)));
-		LOGP(DMAIN, LOGL_DEBUG, "RES=%s\n", osmo_hexdump_nospc(v->res, v->res_len));
-		LOGP(DMAIN, LOGL_DEBUG, "Kc=%s\n", osmo_hexdump_nospc(v->kc, sizeof(v->kc)));
-		LOGP(DMAIN, LOGL_DEBUG, "SRES=%s\n", osmo_hexdump_nospc(v->sres, sizeof(v->sres)));
-	}
-
-	return rc;
-}
-
-int main(int argc, char **argv)
-{
-	int rc;
-
-	g_hlr = talloc_zero(NULL, struct hlr);
-
-	rc = osmo_init_logging2(g_hlr, &hlr_log_info);
-	if (rc < 0) {
-		fprintf(stderr, "Error initializing logging\n");
-		exit(1);
-	}
-	LOGP(DMAIN, LOGL_NOTICE, "hlr starting\n");
-
-	rc = rand_init();
-	if (rc < 0) {
-		LOGP(DMAIN, LOGL_ERROR, "Error initializing random source\n");
-		exit(1);
-	}
-
-	g_hlr->dbc = db_open(NULL, "hlr.db", true);
-	if (!g_hlr->dbc) {
-		LOGP(DMAIN, LOGL_ERROR, "Error opening database\n");
-		exit(1);
-	}
-
-	/* non-existing subscriber */
-	rc = test("901990123456789", g_hlr->dbc);
-	/* 2G only AUC data (COMP128v1 / MILENAGE) */
-	rc = test("901990000000001", g_hlr->dbc);
-	/* 2G + 3G AUC data (COMP128v1 / MILENAGE) */
-	rc = test("901990000000002", g_hlr->dbc);
-	/* 3G AUC data (MILENAGE) */
-	rc = test("901990000000003", g_hlr->dbc);
-
-	LOGP(DMAIN, LOGL_NOTICE, "Exiting\n");
-
-	db_close(g_hlr->dbc);
-
-	log_fini();
-
-	exit(0);
-}

-- 
To view, visit https://gerrit.osmocom.org/7855
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifa409df9b4bb94bd4e8f15568486066393009494
Gerrit-PatchSet: 1
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list