X-Git-Url: http://git.meshlink.io/?p=catta;a=blobdiff_plain;f=tests%2Fdns-spin-test.c;h=f47e8ec0c4838b85931d60644ee495c8521df16c;hp=ebc5dd373dfa279e68c99f66446bf03077167dd5;hb=2c550daf4ac6a6aab7f21047c037b4dd53c57fa6;hpb=37d19f15523b6fe4d1fef2329abe421221b3d4b3 diff --git a/tests/dns-spin-test.c b/tests/dns-spin-test.c index ebc5dd3..f47e8ec 100644 --- a/tests/dns-spin-test.c +++ b/tests/dns-spin-test.c @@ -1,26 +1,26 @@ /*** - This file is part of avahi. + This file is part of catta. - avahi is free software; you can redistribute it and/or modify it + catta is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - avahi is distributed in the hope that it will be useful, but WITHOUT + catta is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with avahi; if not, write to the Free Software + License along with catta; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ -/* Regression test for Avahi bug #84. - * This program tests whether the avahi_dns_packet_consume_name function +/* Regression test for Catta bug #84. + * This program tests whether the catta_dns_packet_consume_name function * returns (rather than spinning forever). For a function as simple as - * avahi_dns_packet_consume_name, we assume that 1 second of CPU time ≈ forever + * catta_dns_packet_consume_name, we assume that 1 second of CPU time ≈ forever */ #ifdef HAVE_CONFIG_H @@ -76,7 +76,7 @@ void fail(const char *fmt, ...) { exit(EXIT_FAILURE); } -void handle(AVAHI_GCC_UNUSED int sig) { +void handle(CATTA_GCC_UNUSED int sig) { fail("Interrupted after %d second of CPU time", MAX_CPU_SECONDS); } @@ -86,13 +86,13 @@ void handle(AVAHI_GCC_UNUSED int sig) { unresolved("%s returned %s", #cmd, #badresult); \ } while (0) -int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { +int main(CATTA_GCC_UNUSED int argc, CATTA_GCC_UNUSED char *argv[]) { struct itimerval itval; - AvahiDnsPacket *packet; + CattaDnsPacket *packet; char name[512]; int ret; uint8_t badrr[] = { - 0xC0, AVAHI_DNS_PACKET_HEADER_SIZE, /* self-referential QNAME pointer */ + 0xC0, CATTA_DNS_PACKET_HEADER_SIZE, /* self-referential QNAME pointer */ 0, 1, /* QTYPE A (host addr) */ 0, 1, /* QCLASS IN (internet/ipv4) */ }; @@ -106,14 +106,14 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { if (setitimer(ITIMER_VIRTUAL, &itval, NULL) == -1) stdlib_fail("setitimer()"); - TRY_EXCEPT(packet = avahi_dns_packet_new_query(512), NULL); - TRY_EXCEPT(avahi_dns_packet_append_bytes(packet, badrr, sizeof(badrr)), NULL); + TRY_EXCEPT(packet = catta_dns_packet_new_query(512), NULL); + TRY_EXCEPT(catta_dns_packet_append_bytes(packet, badrr, sizeof(badrr)), NULL); /* This is expected to fail (if it returns) */ - ret = avahi_dns_packet_consume_name(packet, name, sizeof(name)); + ret = catta_dns_packet_consume_name(packet, name, sizeof(name)); if (ret != -1) - fail("avahi_dns_packet_consume_name() returned %d; -1 was expected", ret); + fail("catta_dns_packet_consume_name() returned %d; -1 was expected", ret); return EXIT_SUCCESS; }