#include <time.h>
#include <stdint.h>
-#include <libmemcached/memcached.h>
-
#include <libtest/test.h>
#include <libtest/failed.h>
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_MEMORY_ALLOCATION_FAILURE:
+ return "memory allocation";
case TEST_MAXIMUM_RETURN:
default:
fprintf(stderr, "Unknown return value\n");
char *wildcard= NULL;
world_st world;
collection_st *collection;
- collection_st *next;
void *world_ptr;
world_stats_st stats;
}
if (argc > 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)
+ {
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;
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++;
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);
stats.failed++;
failed= true;
break;
+
case TEST_SKIPPED:
stats.skipped++;
skipped= true;
break;
+
case TEST_MEMORY_ALLOCATION_FAILURE:
fprintf(stderr, "Exhausted memory, quitting\n");
abort();
+
case TEST_MAXIMUM_RETURN:
default:
assert(0); // Coding error.
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)
world_stats_print(&stats);
-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
- sasl_done();
-#endif
-
return stats.failed == 0 ? 0 : 1;
}