mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 07:56:59 +00:00
[DNSAPI_APITEST]
- Handle unexpected failures without crashing ROSTESTS-226 svn path=/trunk/; revision=71717
This commit is contained in:
parent
0e71aef30a
commit
4a36ad96cb
1 changed files with 12 additions and 12 deletions
|
@ -15,9 +15,9 @@
|
||||||
void TestHostName(void)
|
void TestHostName(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
DNS_STATUS dns_status = NO_ERROR;
|
DNS_STATUS dns_status;
|
||||||
char host_name[255];
|
char host_name[255];
|
||||||
PDNS_RECORD dp = NULL;
|
PDNS_RECORD dp;
|
||||||
WCHAR host_nameW[255];
|
WCHAR host_nameW[255];
|
||||||
|
|
||||||
gethostname(host_name, sizeof(host_name));
|
gethostname(host_name, sizeof(host_name));
|
||||||
|
@ -33,25 +33,25 @@ void TestHostName(void)
|
||||||
//Testing HostName
|
//Testing HostName
|
||||||
dns_status = DnsQuery_A(host_name, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
dns_status = DnsQuery_A(host_name, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||||
ok(dns_status == NO_ERROR, "DnsQuery_A failed with error %lu\n", dns_status);
|
ok(dns_status == NO_ERROR, "DnsQuery_A failed with error %lu\n", dns_status);
|
||||||
DnsRecordListFree(dp, DnsFreeRecordList);
|
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||||
|
|
||||||
//127.0.0.1
|
//127.0.0.1
|
||||||
dns_status = DnsQuery_A("127.0.0.1", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
dns_status = DnsQuery_A("127.0.0.1", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||||
ok(dns_status == NO_ERROR, "DnsQuery_A failed with error %lu\n", dns_status);
|
ok(dns_status == NO_ERROR, "DnsQuery_A failed with error %lu\n", dns_status);
|
||||||
DnsRecordListFree(dp, DnsFreeRecordList);
|
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||||
|
|
||||||
//Localhost strings
|
//Localhost strings
|
||||||
dns_status = DnsQuery_A("LocalHost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
dns_status = DnsQuery_A("LocalHost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||||
ok(dns_status == NO_ERROR, "DnsQuery_A failed with error %lu\n", dns_status);
|
ok(dns_status == NO_ERROR, "DnsQuery_A failed with error %lu\n", dns_status);
|
||||||
DnsRecordListFree(dp, DnsFreeRecordList);
|
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||||
|
|
||||||
dns_status = DnsQuery_A("Localhost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
dns_status = DnsQuery_A("Localhost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||||
ok(dns_status == NO_ERROR, "DnsQuery_A failed with error %lu\n", dns_status);
|
ok(dns_status == NO_ERROR, "DnsQuery_A failed with error %lu\n", dns_status);
|
||||||
DnsRecordListFree(dp, DnsFreeRecordList);
|
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||||
|
|
||||||
dns_status = DnsQuery_A("localhost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
dns_status = DnsQuery_A("localhost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||||
ok(dns_status == NO_ERROR, "DnsQuery_A failed with error %lu\n", dns_status);
|
ok(dns_status == NO_ERROR, "DnsQuery_A failed with error %lu\n", dns_status);
|
||||||
DnsRecordListFree(dp, DnsFreeRecordList);
|
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||||
|
|
||||||
//DnsQuery_W:
|
//DnsQuery_W:
|
||||||
//NULL
|
//NULL
|
||||||
|
@ -74,25 +74,25 @@ void TestHostName(void)
|
||||||
//Testing HostName
|
//Testing HostName
|
||||||
dns_status = DnsQuery_W(host_nameW, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
dns_status = DnsQuery_W(host_nameW, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||||
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
||||||
DnsRecordListFree(dp, DnsFreeRecordList);
|
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||||
|
|
||||||
//127.0.0.1
|
//127.0.0.1
|
||||||
dns_status = DnsQuery_W(L"127.0.0.1", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
dns_status = DnsQuery_W(L"127.0.0.1", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||||
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
||||||
DnsRecordListFree(dp, DnsFreeRecordList);
|
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||||
|
|
||||||
//Localhost strings
|
//Localhost strings
|
||||||
dns_status = DnsQuery_W(L"LocalHost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
dns_status = DnsQuery_W(L"LocalHost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||||
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
||||||
DnsRecordListFree(dp, DnsFreeRecordList);
|
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||||
|
|
||||||
dns_status = DnsQuery_W(L"Localhost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
dns_status = DnsQuery_W(L"Localhost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||||
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
||||||
DnsRecordListFree(dp, DnsFreeRecordList);
|
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||||
|
|
||||||
dns_status = DnsQuery_W(L"localhost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
dns_status = DnsQuery_W(L"localhost", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||||
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
||||||
DnsRecordListFree(dp, DnsFreeRecordList);
|
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(DnsQuery)
|
START_TEST(DnsQuery)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue