From 37e39f5be4ae0156565b009ae210f2c95e906142 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Fri, 28 Feb 2003 03:34:18 +0000 Subject: Add simple test harness that exposes StrCaseCmp for testing. (This used to be commit ab77beca041595bc3bd70de3a6e1b49159a4964b) --- source3/torture/t_strcmp.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 source3/torture/t_strcmp.c (limited to 'source3/torture/t_strcmp.c') diff --git a/source3/torture/t_strcmp.c b/source3/torture/t_strcmp.c new file mode 100644 index 0000000000..622769001b --- /dev/null +++ b/source3/torture/t_strcmp.c @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2003 by Martin Pool + * + * Test harness for StrCaseCmp + */ + +#include "includes.h" + +int main(int argc, char *argv[]) +{ + if (argc != 3) { + fprintf(stderr, "usage: %s STRING1 STRING2\nCompares two strings\n", + argv[0]); + return 2; + } + + printf("%d\n", StrCaseCmp(argv[1], argv[2])); + + return 0; +} -- cgit From 9a63d8bc2af36386bd863dcda8d749cc9f29bb47 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Wed, 12 Mar 2003 02:58:45 +0000 Subject: Update usage message. (This used to be commit 17f01f6959fb79ba11a56d6869ec9789e3ee2f74) --- source3/torture/t_strcmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/torture/t_strcmp.c') diff --git a/source3/torture/t_strcmp.c b/source3/torture/t_strcmp.c index 622769001b..b510d64cf0 100644 --- a/source3/torture/t_strcmp.c +++ b/source3/torture/t_strcmp.c @@ -9,7 +9,8 @@ int main(int argc, char *argv[]) { if (argc != 3) { - fprintf(stderr, "usage: %s STRING1 STRING2\nCompares two strings\n", + fprintf(stderr, "usage: %s STRING1 STRING2\n" + "Compares two strings, prints the results of StrCaseCmp\n", argv[0]); return 2; } -- cgit From 54925dcc6061f4aeb9f05b10c607065a0e511d9e Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Wed, 19 Mar 2003 02:59:18 +0000 Subject: Run test 10000 times to make measurement easier. (This used to be commit e051789ac6cc05f8a643ea81e887d3b969cf3a27) --- source3/torture/t_strcmp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source3/torture/t_strcmp.c') diff --git a/source3/torture/t_strcmp.c b/source3/torture/t_strcmp.c index b510d64cf0..1d26ad22de 100644 --- a/source3/torture/t_strcmp.c +++ b/source3/torture/t_strcmp.c @@ -8,14 +8,19 @@ int main(int argc, char *argv[]) { + int i, ret; + if (argc != 3) { fprintf(stderr, "usage: %s STRING1 STRING2\n" "Compares two strings, prints the results of StrCaseCmp\n", argv[0]); return 2; } - - printf("%d\n", StrCaseCmp(argv[1], argv[2])); + + for (i = 0; i < 10000; i++) + ret = StrCaseCmp(argv[1], argv[2]); + + printf("%d\n", ret); return 0; } -- cgit From 80cd7c552ff95b3aa4caf79768af5b1e5c07c506 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Wed, 9 Apr 2003 05:22:17 +0000 Subject: t_push_ucs2, t_strcmp: Run tests only once by default, rather than 10000 times. (In theory they should be pure functions....) You can specify a parameter to repeat them if you want to e.g. measure performance. (This used to be commit 92acecd28c3374abcadbff0ab9cb765411f453f4) --- source3/torture/t_strcmp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source3/torture/t_strcmp.c') diff --git a/source3/torture/t_strcmp.c b/source3/torture/t_strcmp.c index 1d26ad22de..47327a0e06 100644 --- a/source3/torture/t_strcmp.c +++ b/source3/torture/t_strcmp.c @@ -9,15 +9,18 @@ int main(int argc, char *argv[]) { int i, ret; + int iters = 1; - if (argc != 3) { - fprintf(stderr, "usage: %s STRING1 STRING2\n" + if (argc < 3) { + fprintf(stderr, "usage: %s STRING1 STRING2 [ITERS]\n" "Compares two strings, prints the results of StrCaseCmp\n", argv[0]); return 2; } + if (argc >= 4) + iters = atoi(argv[3]); - for (i = 0; i < 10000; i++) + for (i = 0; i < iters; i++) ret = StrCaseCmp(argv[1], argv[2]); printf("%d\n", ret); -- cgit From 5b70d850479f026267d8e7f842d4ad452a04638f Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Wed, 9 Apr 2003 05:31:39 +0000 Subject: Set character set to default (UTF-8) before running tests. (This used to be commit b20d8b49701b532d4770197c5d08fa092234bf8e) --- source3/torture/t_strcmp.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/torture/t_strcmp.c') diff --git a/source3/torture/t_strcmp.c b/source3/torture/t_strcmp.c index 47327a0e06..bc8640ee55 100644 --- a/source3/torture/t_strcmp.c +++ b/source3/torture/t_strcmp.c @@ -11,6 +11,9 @@ int main(int argc, char *argv[]) int i, ret; int iters = 1; + /* Needed to initialize character set */ + lp_load("/dev/null", True, False, False); + if (argc < 3) { fprintf(stderr, "usage: %s STRING1 STRING2 [ITERS]\n" "Compares two strings, prints the results of StrCaseCmp\n", -- cgit From 9c15bd311db76885b27f30ba92d885833f668550 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Sat, 28 Jan 2006 22:53:04 +0000 Subject: r13212: r12414@cabra: derrell | 2006-01-28 17:52:17 -0500 lp_load() could not be called multiple times to modify parameter settings based on reading from multiple configuration settings. Each time, it initialized all of the settings back to their defaults before reading the specified configuration file. This patch adds a parameter to lp_load() specifying whether the settings should be initialized. It does, however, still force the settings to be initialized the first time, even if the request was to not initialize them. (Not doing so could wreak havoc due to uninitialized values.) (This used to be commit f2a24de769d1b2266e576597c57a8e3b1e2a2b51) --- source3/torture/t_strcmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/t_strcmp.c') diff --git a/source3/torture/t_strcmp.c b/source3/torture/t_strcmp.c index bc8640ee55..318423b8be 100644 --- a/source3/torture/t_strcmp.c +++ b/source3/torture/t_strcmp.c @@ -12,7 +12,7 @@ int main(int argc, char *argv[]) int iters = 1; /* Needed to initialize character set */ - lp_load("/dev/null", True, False, False); + lp_load("/dev/null", True, False, False, True); if (argc < 3) { fprintf(stderr, "usage: %s STRING1 STRING2 [ITERS]\n" -- cgit