From Fedora Project Wiki
Description
c-ares is a C library for asynchronous DNS requests (including name resolves).This test case ensures the proper installation and basic functionality of the c-ares
library for asynchronous DNS requests.
Setup
- Install the development package for
c-ares
:sudo dnf install c-ares-devel
. - Prepare a basic C code to test the functionality using
c-ares
.
How to test
- Write a simple C program to use the
c-ares
library for DNS resolution.
The program should: - Initialize the library. - Make a DNS request to resolve a known domain (e.g., "www.google.com"). - Print the results. - Cleanup.
- Here's a simple program [ongist]
- Compile the program:
gcc -o test_cares test_cares.c -lcares
. - Run the program:
./test_cares
.
Expected Results
- The C program should compile without any errors.
- Running the program should display the resolved IP addresses for the specified domain.
- The program should exit gracefully after printing the results.
Optional
For advanced testing:
- Test the program with multiple domains.
- Test DNS resolution for various record types (e.g., MX, TXT).
- Examine the behavior of the program when given invalid or non-existent domain names.
- Check the behavior with different DNS server configurations.