projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Merge in docs.
[awesomized/libmemcached]
/
libtest
/
test.c
diff --git
a/libtest/test.c
b/libtest/test.c
index da989b179638bfd95eed8cacefd012fea200b5f7..0905e13b6fc94562c4303749af6b0c786910212d 100644
(file)
--- a/
libtest/test.c
+++ b/
libtest/test.c
@@
-10,7
+10,7
@@
Sample test application.
*/
Sample test application.
*/
-#include
"config.h"
+#include
<config.h>
#include <unistd.h>
#include <unistd.h>
@@
-24,8
+24,6
@@
#include <time.h>
#include <stdint.h>
#include <time.h>
#include <stdint.h>
-#include <libmemcached/memcached.h>
-
#include <libtest/test.h>
#include <libtest/failed.h>
#include <libtest/test.h>
#include <libtest/failed.h>
@@
-61,10
+59,12
@@
const char *test_strerror(test_return_t code)
return "ok";
case TEST_FAILURE:
return "failed";
return "ok";
case TEST_FAILURE:
return "failed";
- case TEST_
MEMORY_ALLOCATION_FAILURE
:
- return "
memory allocation
";
+ case TEST_
FATAL
:
+ return "
failed
";
case TEST_SKIPPED:
return "skipped";
case TEST_SKIPPED:
return "skipped";
+ case TEST_MEMORY_ALLOCATION_FAILURE:
+ return "memory allocation";
case TEST_MAXIMUM_RETURN:
default:
fprintf(stderr, "Unknown return value\n");
case TEST_MAXIMUM_RETURN:
default:
fprintf(stderr, "Unknown return value\n");
@@
-148,7
+148,6
@@
int main(int argc, char *argv[])
char *wildcard= NULL;
world_st world;
collection_st *collection;
char *wildcard= NULL;
world_st world;
collection_st *collection;
- collection_st *next;
void *world_ptr;
world_stats_st stats;
void *world_ptr;
world_stats_st stats;
@@
-180,12
+179,23
@@
int main(int argc, char *argv[])
}
if (argc > 1)
}
if (argc > 1)
+ {
collection_to_run= argv[1];
collection_to_run= argv[1];
+ }
+ else if (getenv("TEST_COLLECTION"))
+ {
+ collection_to_run= getenv("TEST_COLLECTION");
+ }
+
+ if (collection_to_run)
+ printf("Only testing %s\n", collection_to_run);
if (argc == 3)
if (argc == 3)
+ {
wildcard= argv[2];
wildcard= argv[2];
+ }
- for (next= collection; next->name; next++)
+ for (
collection_st *
next= collection; next->name; next++)
{
test_return_t collection_rc= TEST_SUCCESS;
test_st *run;
{
test_return_t collection_rc= TEST_SUCCESS;
test_st *run;
@@
-214,6
+224,10
@@
skip_pre:
case TEST_SUCCESS:
fprintf(stderr, "\n%s\n\n", next->name);
break;
case TEST_SUCCESS:
fprintf(stderr, "\n%s\n\n", next->name);
break;
+ case TEST_FATAL:
+ fprintf(stderr, "\n%s [ failed ]\n\n", next->name);
+ stats.collection_failed++;
+ goto cleanup;
case TEST_FAILURE:
fprintf(stderr, "\n%s [ failed ]\n\n", next->name);
stats.collection_failed++;
case TEST_FAILURE:
fprintf(stderr, "\n%s [ failed ]\n\n", next->name);
stats.collection_failed++;
@@
-298,6
+312,8
@@
skip_pre:
fprintf(stderr, "%ld.%03ld ", load_time / 1000, load_time % 1000);
stats.success++;
break;
fprintf(stderr, "%ld.%03ld ", load_time / 1000, load_time % 1000);
stats.success++;
break;
+
+ case TEST_FATAL:
case TEST_FAILURE:
#if 0
push_failed_test(next->name, run->name);
case TEST_FAILURE:
#if 0
push_failed_test(next->name, run->name);
@@
-305,13
+321,16
@@
skip_pre:
stats.failed++;
failed= true;
break;
stats.failed++;
failed= true;
break;
+
case TEST_SKIPPED:
stats.skipped++;
skipped= true;
break;
case TEST_SKIPPED:
stats.skipped++;
skipped= true;
break;
+
case TEST_MEMORY_ALLOCATION_FAILURE:
fprintf(stderr, "Exhausted memory, quitting\n");
abort();
case TEST_MEMORY_ALLOCATION_FAILURE:
fprintf(stderr, "Exhausted memory, quitting\n");
abort();
+
case TEST_MAXIMUM_RETURN:
default:
assert(0); // Coding error.
case TEST_MAXIMUM_RETURN:
default:
assert(0); // Coding error.
@@
-328,6
+347,12
@@
skip_pre:
if (rc != TEST_SUCCESS)
break;
}
if (rc != TEST_SUCCESS)
break;
}
+
+ // If we get a TEST_FATAL we move onto the next collection
+ if (return_code == TEST_FATAL)
+ {
+ break;
+ }
}
if (next->post && world.runner->post)
}
if (next->post && world.runner->post)
@@
-370,9
+395,5
@@
cleanup:
world_stats_print(&stats);
world_stats_print(&stats);
-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
- sasl_done();
-#endif
-
return stats.failed == 0 ? 0 : 1;
}
return stats.failed == 0 ? 0 : 1;
}