From: Julian Seward Date: Wed, 9 Jul 2003 21:53:32 +0000 (+0000) Subject: Add iffdeffery to allow testing the call to the DNS resolver in either X-Git-Tag: svn/VALGRIND_2_0_0~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ded9d33f2af3f94b7d54104f484c1cdbafcc17b9;p=thirdparty%2Fvalgrind.git Add iffdeffery to allow testing the call to the DNS resolver in either the main thread, or in some other thread (the failure case). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1742 --- diff --git a/corecheck/tests/res_search.c b/corecheck/tests/res_search.c index 0c0eed3e4d..b4ac82bd1b 100644 --- a/corecheck/tests/res_search.c +++ b/corecheck/tests/res_search.c @@ -10,6 +10,7 @@ void* fn(void* arg) char* dn = (char*)arg; unsigned char buff[8000]; + if(-1 == res_search(dn, 1, 1, buff, 8000)) { printf("Error: res_search()\n"); @@ -30,12 +31,14 @@ int main(int argc, char** argv) return 1; } + _res.options |= RES_DEBUG; if(0 != res_init()) { printf("Error: res_init()\n"); return(1); } - +#if 1 + /* Test it in a different thread -- the failure case */ if(0 != pthread_create(&pid, 0, fn, (void*)argv[1])) { printf("Failed to create thread.\n"); @@ -43,6 +46,21 @@ int main(int argc, char** argv) } pthread_join(pid, 0); +#else + { + unsigned char buff[8000]; + + if(-1 == res_search(argv[1], 1, 1, buff, 8000)) + { + printf("Error: res_search()\n"); + } + else + { + printf("Success!\n"); + } + } +#endif return 0; } +