1 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 * Data Differential YATL (i.e. libtest) library
5 * Copyright (C) 2012 Data Differential, http://datadifferential.com/
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following disclaimer
16 * in the documentation and/or other materials provided with the
19 * * The names of its contributors may not be used to endorse or
20 * promote products derived from this software without specific prior
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #include <libtest/test.hpp>
41 #if defined(LIBTEST_WITH_LIBMEMCACHED_SUPPORT) && LIBTEST_WITH_LIBMEMCACHED_SUPPORT
42 #include <libmemcached-1.0/memcached.h>
45 #if defined(LIBTEST_WITH_LIBGEARMAN_SUPPORT) && LIBTEST_WITH_LIBGEARMAN_SUPPORT
46 #include <libgearman/gearman.h>
52 using namespace libtest
;
54 static test_return_t
LIBTOOL_COMMAND_test(void *)
56 test_true(getenv("LIBTOOL_COMMAND"));
60 static test_return_t
VALGRIND_COMMAND_test(void *)
62 test_true(getenv("VALGRIND_COMMAND"));
66 static test_return_t
HELGRIND_COMMAND_test(void *)
68 test_true(getenv("HELGRIND_COMMAND"));
72 static test_return_t
GDB_COMMAND_test(void *)
74 test_true(getenv("GDB_COMMAND"));
78 static test_return_t
test_success_equals_one_test(void *)
80 test_skip(HAVE_LIBMEMCACHED
, 1);
81 #if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED
82 test_zero(MEMCACHED_SUCCESS
);
87 static test_return_t
test_success_test(void *)
92 static test_return_t
test_failure_test(void *)
94 return TEST_SKIPPED
; // Only run this when debugging
100 static test_return_t
local_test(void *)
102 if (getenv("LIBTEST_LOCAL"))
104 test_true(test_is_local());
108 test_false(test_is_local());
114 static test_return_t
local_not_test(void *)
121 if ((ptr
= getenv("LIBTEST_LOCAL")) == NULL
)
126 // unsetenv() will cause issues with valgrind
127 _compare(__FILE__
, __LINE__
, __func__
, 0, unsetenv("LIBTEST_LOCAL"), true);
128 test_compare(0, unsetenv("LIBTEST_LOCAL"));
129 test_false(test_is_local());
131 test_compare(0, setenv("LIBTEST_LOCAL", "1", 1));
132 test_true(test_is_local());
136 test_compare(0, unsetenv("LIBTEST_LOCAL"));
140 char *old_string
= strdup(temp
.c_str());
141 test_compare(0, setenv("LIBTEST_LOCAL", old_string
, 1));
147 static test_return_t
var_exists_test(void *)
149 test_compare(0, access("var", R_OK
| W_OK
| X_OK
));
153 static test_return_t
var_tmp_exists_test(void *)
155 test_compare(0, access("var/tmp", R_OK
| W_OK
| X_OK
));
159 static test_return_t
var_run_exists_test(void *)
161 test_compare(0, access("var/run", R_OK
| W_OK
| X_OK
));
165 static test_return_t
var_log_exists_test(void *)
167 test_compare(0, access("var/log", R_OK
| W_OK
| X_OK
));
171 static test_return_t
var_drizzle_exists_test(void *)
173 test_compare(0, access("var/drizzle", R_OK
| W_OK
| X_OK
));
177 static test_return_t
var_tmp_test(void *)
179 FILE *file
= fopen("var/tmp/junk", "w+");
186 static test_return_t
var_run_test(void *)
188 FILE *file
= fopen("var/run/junk", "w+");
194 static test_return_t
var_log_test(void *)
196 FILE *file
= fopen("var/log/junk", "w+");
202 static test_return_t
var_drizzle_test(void *)
204 FILE *file
= fopen("var/drizzle/junk", "w+");
210 static test_return_t
var_tmp_rm_test(void *)
212 test_true(unlink("var/tmp/junk") == 0);
216 static test_return_t
var_run_rm_test(void *)
218 test_true(unlink("var/run/junk") == 0);
222 static test_return_t
var_log_rm_test(void *)
224 test_true(unlink("var/log/junk") == 0);
228 static test_return_t
var_drizzle_rm_test(void *)
230 test_true(unlink("var/drizzle/junk") == 0);
234 static test_return_t
_compare_test_return_t_test(void *)
236 test_compare(TEST_SUCCESS
, TEST_SUCCESS
);
241 static test_return_t
_compare_memcached_return_t_test(void *)
243 test_skip(HAVE_LIBMEMCACHED
, true);
244 #if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED
245 test_compare(MEMCACHED_SUCCESS
, MEMCACHED_SUCCESS
);
251 static test_return_t
_compare_gearman_return_t_test(void *)
253 test_skip(HAVE_LIBGEARMAN
, true);
254 #if defined(HAVE_LIBGEARMAN) && HAVE_LIBGEARMAN
255 test_compare(GEARMAN_SUCCESS
, GEARMAN_SUCCESS
);
261 static test_return_t
drizzled_cycle_test(void *object
)
263 server_startup_st
*servers
= (server_startup_st
*)object
;
264 test_true(servers
and servers
->validate());
266 #if defined(HAVE_GEARMAND_BINARY) && HAVE_GEARMAND_BINARY
267 test_true(has_drizzled());
270 test_skip(true, has_drizzled());
272 test_true(server_startup(*servers
, "drizzled", get_free_port(), 0, NULL
));
277 static test_return_t
gearmand_cycle_test(void *object
)
279 server_startup_st
*servers
= (server_startup_st
*)object
;
280 test_true(servers
and servers
->validate());
282 #if defined(HAVE_GEARMAND_BINARY) && HAVE_GEARMAND_BINARY
283 test_true(has_gearmand());
286 test_skip(true, has_gearmand());
288 test_true(server_startup(*servers
, "gearmand", get_free_port(), 0, NULL
));
293 static test_return_t
memcached_light_cycle_TEST(void *object
)
295 server_startup_st
*servers
= (server_startup_st
*)object
;
298 test_skip(true, bool(HAVE_MEMCACHED_LIGHT_BINARY
));
300 test_true(server_startup(*servers
, "memcached-light", get_free_port(), 0, NULL
));
305 static test_return_t
skip_shim(bool a
, bool b
)
311 static test_return_t
test_skip_true_TEST(void *object
)
313 test_compare(true, true);
314 test_compare(false, false);
315 test_compare(TEST_SUCCESS
, skip_shim(true, true));
316 test_compare(TEST_SUCCESS
, skip_shim(false, false));
321 static test_return_t
test_skip_false_TEST(void *object
)
323 test_compare(TEST_SKIPPED
, skip_shim(true, false));
324 test_compare(TEST_SKIPPED
, skip_shim(false, true));
328 static test_return_t
memcached_cycle_test(void *object
)
330 server_startup_st
*servers
= (server_startup_st
*)object
;
333 if (MEMCACHED_BINARY
and HAVE_LIBMEMCACHED
)
335 test_true(has_memcached());
336 test_true(server_startup(*servers
, "memcached", get_free_port(), 0, NULL
));
344 static test_return_t
memcached_socket_cycle_test(void *object
)
346 server_startup_st
*servers
= (server_startup_st
*)object
;
349 if (MEMCACHED_BINARY
)
351 if (HAVE_LIBMEMCACHED
)
353 test_true(has_memcached());
354 test_true(servers
->start_socket_server("memcached", get_free_port(), 0, NULL
));
363 static test_return_t
memcached_sasl_test(void *object
)
365 server_startup_st
*servers
= (server_startup_st
*)object
;
368 test_skip(false, bool(getenv("TESTS_ENVIRONMENT")));
370 if (MEMCACHED_SASL_BINARY
)
372 if (HAVE_LIBMEMCACHED
)
374 test_true(has_memcached_sasl());
375 test_true(server_startup(*servers
, "memcached-sasl", get_free_port(), 0, NULL
));
384 static test_return_t
application_true_BINARY(void *)
386 Application
true_app("true");
388 test_compare(Application::SUCCESS
, true_app
.run());
389 test_compare(Application::SUCCESS
, true_app
.wait());
394 static test_return_t
application_gdb_true_BINARY2(void *)
396 test_skip(0, access("/usr/bin/gdb", X_OK
));
397 Application
true_app("true");
400 test_compare(Application::SUCCESS
, true_app
.run());
401 test_compare(Application::SUCCESS
, true_app
.wait());
406 static test_return_t
application_gdb_true_BINARY(void *)
408 test_skip(0, access("/usr/bin/gdb", X_OK
));
409 Application
true_app("true");
412 const char *args
[]= { "--fubar", 0 };
413 test_compare(Application::SUCCESS
, true_app
.run(args
));
414 test_compare(Application::SUCCESS
, true_app
.wait());
419 static test_return_t
application_true_fubar_BINARY(void *)
421 Application
true_app("true");
423 const char *args
[]= { "--fubar", 0 };
424 test_compare(Application::SUCCESS
, true_app
.run(args
));
425 test_compare(Application::SUCCESS
, true_app
.wait());
426 test_compare(0, true_app
.stdout_result().size());
431 static test_return_t
application_doesnotexist_BINARY(void *)
434 test_skip_valgrind();
435 Application
true_app("doesnotexist");
436 true_app
.will_fail();
438 const char *args
[]= { "--fubar", 0 };
439 #if defined(TARGET_OS_OSX) && TARGET_OS_OSX
440 test_compare(Application::INVALID
, true_app
.run(args
));
442 test_compare(Application::SUCCESS
, true_app
.run(args
));
443 test_compare(Application::INVALID
, true_app
.wait(false));
446 test_compare(0, true_app
.stdout_result().size());
451 static test_return_t
application_true_fubar_eq_doh_BINARY(void *)
453 Application
true_app("true");
455 const char *args
[]= { "--fubar=doh", 0 };
456 test_compare(Application::SUCCESS
, true_app
.run(args
));
457 test_compare(Application::SUCCESS
, true_app
.wait());
458 test_compare(0, true_app
.stdout_result().size());
463 static test_return_t
application_true_fubar_eq_doh_option_BINARY(void *)
465 Application
true_app("true");
467 true_app
.add_option("--fubar=", "doh");
469 test_compare(Application::SUCCESS
, true_app
.run());
470 test_compare(Application::SUCCESS
, true_app
.wait());
471 test_compare(0, true_app
.stdout_result().size());
477 static test_return_t
GET_TEST(void *)
479 libtest::http::GET
get("http://foo.example.com/");
481 test_compare(false, get
.execute());
486 static test_return_t
POST_TEST(void *)
488 libtest::vchar_t body
;
489 libtest::http::POST
post("http://foo.example.com/", body
);
491 test_compare(false, post
.execute());
496 static test_return_t
TRACE_TEST(void *)
498 libtest::vchar_t body
;
499 libtest::http::TRACE
trace("http://foo.example.com/", body
);
501 test_compare(false, trace
.execute());
507 static test_return_t
vchar_t_TEST(void *)
509 libtest::vchar_t response
;
510 libtest::make_vector(response
, test_literal_param("fubar\n"));
511 test_compare(response
, response
);
516 static test_return_t
vchar_t_compare_neg_TEST(void *)
518 libtest::vchar_t response
;
519 libtest::vchar_t response2
;
520 libtest::make_vector(response
, test_literal_param("fubar\n"));
521 libtest::make_vector(response2
, test_literal_param(__func__
));
522 test_true(response
!= response2
);
527 static test_return_t
application_echo_fubar_BINARY(void *)
529 Application
true_app("echo");
531 const char *args
[]= { "fubar", 0 };
532 test_compare(Application::SUCCESS
, true_app
.run(args
));
533 test_compare(Application::SUCCESS
, true_app
.wait());
535 while (true_app
.slurp() == false) {} ;
537 libtest::vchar_t response
;
538 make_vector(response
, test_literal_param("fubar\n"));
539 test_compare(response
, true_app
.stdout_result());
544 static test_return_t
application_echo_fubar_BINARY2(void *)
546 Application
true_app("echo");
548 true_app
.add_option("fubar");
550 test_compare(Application::SUCCESS
, true_app
.run());
551 test_compare(Application::SUCCESS
, true_app
.wait(false));
553 libtest::vchar_t response
;
554 make_vector(response
, test_literal_param("fubar\n"));
555 test_compare(response
, true_app
.stdout_result());
560 static test_return_t
true_BINARY(void *)
562 const char *args
[]= { 0 };
563 test_compare(EXIT_SUCCESS
, exec_cmdline("true", args
));
568 static test_return_t
true_fubar_BINARY(void *)
570 const char *args
[]= { "--fubar", 0 };
571 test_compare(EXIT_SUCCESS
, exec_cmdline("true", args
));
576 static test_return_t
echo_fubar_BINARY(void *)
578 const char *args
[]= { "fubar", 0 };
579 test_compare(EXIT_SUCCESS
, exec_cmdline("echo", args
));
584 static test_return_t
wait_BINARY(void *)
586 const char *args
[]= { "--quiet", 0 };
588 test_compare(EXIT_FAILURE
, exec_cmdline("libtest/wait", args
, true));
593 static test_return_t
wait_help_BINARY(void *)
595 const char *args
[]= { "--quiet", "--help", 0 };
597 test_compare(EXIT_SUCCESS
, exec_cmdline("libtest/wait", args
, true));
602 static test_return_t
wait_version_BINARY(void *)
604 const char *args
[]= { "--quiet", "--version", 0 };
606 test_compare(EXIT_SUCCESS
, exec_cmdline("libtest/wait", args
, true));
611 static test_return_t
wait_services_BINARY(void *)
613 test_skip(0, access("/etc/services", R_OK
));
615 const char *args
[]= { "--quiet", "/etc/services", 0 };
617 test_compare(EXIT_SUCCESS
, exec_cmdline("libtest/wait", args
, true));
622 static test_return_t
wait_services_BINARY2(void *)
624 test_skip(0, access("/etc/services", R_OK
));
626 const char *args
[]= { "/etc/services", 0 };
628 test_compare(EXIT_SUCCESS
, exec_cmdline("libtest/wait", args
, true));
633 static test_return_t
wait_services_appliction_TEST(void *)
635 test_skip(0, access("/usr/bin/gdb", X_OK
));
636 test_skip(0, access("/etc/services", R_OK
));
638 libtest::Application
wait_app("libtest/wait", true);
641 const char *args
[]= { "/etc/services", 0 };
642 test_compare(Application::SUCCESS
, wait_app
.run(args
));
643 test_compare(Application::SUCCESS
, wait_app
.wait());
648 static test_return_t
gdb_wait_services_appliction_TEST(void *)
650 test_skip(true, false);
651 #if defined(TARGET_OS_OSX) && TARGET_OS_OSX
652 test_skip(0, TARGET_OS_OSX
);
655 test_skip(0, access("/usr/bin/gdb", X_OK
));
656 test_skip(0, access("/etc/services", R_OK
));
658 libtest::Application
wait_app("libtest/wait", true);
661 const char *args
[]= { "/etc/services", 0 };
662 test_compare(Application::SUCCESS
, wait_app
.run(args
));
663 test_compare(Application::SUCCESS
, wait_app
.wait());
668 static test_return_t
gdb_abort_services_appliction_TEST(void *)
670 test_skip(true, false);
671 test_skip(0, access("/usr/bin/gdb", X_OK
));
673 #if defined(TARGET_OS_OSX) && TARGET_OS_OSX
674 test_skip(0, TARGET_OS_OSX
);
677 libtest::Application
abort_app("libtest/abort", true);
680 test_compare(Application::SUCCESS
, abort_app
.run());
681 test_compare(Application::SUCCESS
, abort_app
.wait());
683 std::string gdb_filename
= abort_app
.gdb_filename();
684 test_skip(0, access(gdb_filename
.c_str(), R_OK
));
685 const char *args
[]= { "SIGABRT", gdb_filename
.c_str(), 0 };
686 test_compare(EXIT_SUCCESS
, exec_cmdline("grep", args
));
689 args
[0]= "THIS_WILL_NOT_BE_FOUND";
690 test_compare(EXIT_FAILURE
, exec_cmdline("grep", args
));
695 static test_return_t
get_free_port_TEST(void *)
698 test_true((ret_port
= get_free_port()));
699 test_true(get_free_port() != default_port());
700 test_true(get_free_port() != get_free_port());
705 static uint32_t fatal_calls
= 0;
707 static test_return_t
fatal_TEST(void *)
709 test_compare(fatal_calls
++, fatal::disabled_counter());
710 throw libtest::fatal(LIBYATL_DEFAULT_PARAM
, "Testing va_args based fatal(): %d", 10);
715 static test_return_t
number_of_cpus_TEST(void *)
717 test_true(number_of_cpus() >= 1);
722 static test_return_t
check_dns_TEST(void *)
724 test_warn_hint(libtest::check_dns(), "Broken DNS server/no DNS server found");
729 static test_return_t
lookup_true_TEST(void *)
731 test_warn_hint(libtest::lookup("exist.gearman.info"), "dns is not currently working");
735 static test_return_t
lookup_false_TEST(void *)
737 if (libtest::lookup("does_not_exist.gearman.info"))
739 Error
<< "Broken DNS server detected";
746 static test_return_t
create_tmpfile_TEST(void *)
748 std::string tmp
= create_tmpfile(__func__
);
749 test_compare(-1, access(tmp
.c_str(), R_OK
));
750 test_compare(-1, access(tmp
.c_str(), F_OK
));
752 Application
touch_app("touch");
753 const char *args
[]= { tmp
.c_str(), 0 };
754 test_compare(Application::SUCCESS
, touch_app
.run(args
));
755 test_compare(Application::SUCCESS
, touch_app
.wait(false));
757 test_compare(0, access(tmp
.c_str(), R_OK
));
758 test_compare(0, unlink(tmp
.c_str()));
763 static test_return_t
fatal_message_TEST(void *)
765 test_compare(fatal_calls
++, fatal::disabled_counter());
766 fatal_message("Fatal test");
771 static test_return_t
default_port_TEST(void *)
773 in_port_t ret_port
= default_port();
774 test_compare(ret_port
, libtest::default_port());
775 test_compare(ret_port
, libtest::default_port());
780 static test_return_t
check_for_gearman(void *)
782 test_skip(true, HAVE_LIBGEARMAN
);
783 test_skip(true, has_gearmand());
787 static test_return_t
check_for_drizzle(void *)
789 test_skip(true, HAVE_LIBDRIZZLE
);
790 test_skip(true, has_drizzled());
795 test_st drizzled_tests
[] ={
796 {"drizzled startup-shutdown", 0, drizzled_cycle_test
},
800 test_st gearmand_tests
[] ={
802 {"pause", 0, pause_test
},
804 {"gearmand startup-shutdown", 0, gearmand_cycle_test
},
805 {"_compare(gearman_return_t)", 0, _compare_gearman_return_t_test
},
809 static test_return_t
check_for_libmemcached(void *)
811 test_skip(true, HAVE_LIBMEMCACHED
);
812 test_skip(true, has_memcached());
816 test_st memcached_tests
[] ={
817 {"memcached startup-shutdown", 0, memcached_cycle_test
},
818 {"memcached-light startup-shutdown", 0, memcached_light_cycle_TEST
},
819 {"memcached(socket file) startup-shutdown", 0, memcached_socket_cycle_test
},
820 {"memcached_sasl() startup-shutdown", 0, memcached_sasl_test
},
821 {"_compare(memcached_return_t)", 0, _compare_memcached_return_t_test
},
825 test_st test_skip_TESTS
[] ={
826 {"true, true", 0, test_skip_true_TEST
},
827 {"true, false", 0, test_skip_false_TEST
},
831 test_st environment_tests
[] ={
832 {"LIBTOOL_COMMAND", 0, LIBTOOL_COMMAND_test
},
833 {"VALGRIND_COMMAND", 0, VALGRIND_COMMAND_test
},
834 {"HELGRIND_COMMAND", 0, HELGRIND_COMMAND_test
},
835 {"GDB_COMMAND", 0, GDB_COMMAND_test
},
839 test_st tests_log
[] ={
840 {"TEST_SUCCESS", false, test_success_test
},
841 {"TEST_FAILURE", false, test_failure_test
},
842 {"TEST_SUCCESS == 0", false, test_success_equals_one_test
},
846 test_st local_log
[] ={
847 {"test_is_local()", 0, local_test
},
848 {"test_is_local(NOT)", 0, local_not_test
},
852 test_st directories_tests
[] ={
853 {"var exists", 0, var_exists_test
},
854 {"var/tmp exists", 0, var_tmp_exists_test
},
855 {"var/run exists", 0, var_run_exists_test
},
856 {"var/log exists", 0, var_log_exists_test
},
857 {"var/drizzle exists", 0, var_drizzle_exists_test
},
858 {"var/tmp", 0, var_tmp_test
},
859 {"var/run", 0, var_run_test
},
860 {"var/log", 0, var_log_test
},
861 {"var/drizzle", 0, var_drizzle_test
},
862 {"var/tmp rm", 0, var_tmp_rm_test
},
863 {"var/run rm", 0, var_run_rm_test
},
864 {"var/log rm", 0, var_log_rm_test
},
865 {"var/drizzle rm", 0, var_drizzle_rm_test
},
869 test_st comparison_tests
[] ={
870 {"_compare(test_return_t)", 0, _compare_test_return_t_test
},
874 test_st cmdline_tests
[] ={
875 {"true", 0, true_BINARY
},
876 {"true --fubar", 0, true_fubar_BINARY
},
877 {"echo fubar", 0, echo_fubar_BINARY
},
878 {"wait --quiet", 0, wait_BINARY
},
879 {"wait --quiet --help", 0, wait_help_BINARY
},
880 {"wait --quiet --version", 0, wait_version_BINARY
},
881 {"wait --quiet /etc/services", 0, wait_services_BINARY
},
882 {"wait /etc/services", 0, wait_services_BINARY2
},
883 {"wait /etc/services", 0, wait_services_appliction_TEST
},
884 {"gdb wait /etc/services", 0, gdb_wait_services_appliction_TEST
},
885 {"gdb abort", 0, gdb_abort_services_appliction_TEST
},
889 test_st get_free_port_TESTS
[] ={
890 {"get_free_port()", 0, get_free_port_TEST
},
891 {"default_port()", 0, default_port_TEST
},
895 test_st fatal_message_TESTS
[] ={
896 {"libtest::fatal", 0, fatal_TEST
},
897 {"fatal_message()", 0, fatal_message_TEST
},
901 test_st number_of_cpus_TESTS
[] ={
902 {"libtest::number_of_cpus()", 0, number_of_cpus_TEST
},
906 test_st create_tmpfile_TESTS
[] ={
907 {"libtest::create_tmpfile()", 0, create_tmpfile_TEST
},
911 test_st dns_TESTS
[] ={
912 {"libtest::lookup(true)", 0, lookup_true_TEST
},
913 {"libtest::lookup(false)", 0, lookup_false_TEST
},
914 {"libtest::check_dns()", 0, check_dns_TEST
},
918 test_st application_tests
[] ={
919 {"vchar_t", 0, vchar_t_TEST
},
920 {"vchar_t compare()", 0, vchar_t_compare_neg_TEST
},
921 {"true", 0, application_true_BINARY
},
922 {"gbd true --fubar", 0, application_gdb_true_BINARY
},
923 {"gbd true", 0, application_gdb_true_BINARY2
},
924 {"true --fubar", 0, application_true_fubar_BINARY
},
925 {"doesnotexist --fubar", 0, application_doesnotexist_BINARY
},
926 {"true --fubar=doh", 0, application_true_fubar_eq_doh_BINARY
},
927 {"true --fubar=doh add_option()", 0, application_true_fubar_eq_doh_option_BINARY
},
928 {"echo fubar", 0, application_echo_fubar_BINARY
},
929 {"echo fubar (as option)", 0, application_echo_fubar_BINARY2
},
933 static test_return_t
check_for_curl(void *)
935 test_skip(true, HAVE_LIBCURL
);
939 static test_return_t
disable_fatal_exception(void *)
945 static test_return_t
enable_fatal_exception(void *)
951 test_st http_tests
[] ={
952 {"GET", 0, GET_TEST
},
953 {"POST", 0, POST_TEST
},
954 {"TRACE", 0, TRACE_TEST
},
958 collection_st collection
[] ={
959 {"environment", 0, 0, environment_tests
},
960 {"return values", 0, 0, tests_log
},
961 {"test_skip()", 0, 0, test_skip_TESTS
},
962 {"local", 0, 0, local_log
},
963 {"directories", 0, 0, directories_tests
},
964 {"comparison", 0, 0, comparison_tests
},
965 {"gearmand", check_for_gearman
, 0, gearmand_tests
},
966 {"memcached", check_for_libmemcached
, 0, memcached_tests
},
967 {"drizzled", check_for_drizzle
, 0, drizzled_tests
},
968 {"cmdline", 0, 0, cmdline_tests
},
969 {"application", 0, 0, application_tests
},
970 {"http", check_for_curl
, 0, http_tests
},
971 {"http", check_for_curl
, 0, http_tests
},
972 {"get_free_port()", 0, 0, get_free_port_TESTS
},
973 {"fatal", disable_fatal_exception
, enable_fatal_exception
, fatal_message_TESTS
},
974 {"number_of_cpus()", 0, 0, number_of_cpus_TESTS
},
975 {"create_tmpfile()", 0, 0, create_tmpfile_TESTS
},
976 {"dns", 0, 0, dns_TESTS
},
980 static void *world_create(server_startup_st
& servers
, test_return_t
&)
985 void get_world(Framework
*world
)
987 world
->collections(collection
);
988 world
->create(world_create
);