From Fedora Project Wiki
(Created page with "{{QA/Test_Case |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`. |actions= # Write a simple C program to use the `c-ares` library for DNS resolution....") |
No edit summary |
||
Line 11: | Line 11: | ||
- Print the results. | - Print the results. | ||
- Cleanup. | - Cleanup. | ||
# Here's a simple program [[ | # Here's a simple program [[https://gist.github.com/sumantro93/2ccb1a30b582956f55e5b04b319cfaa5 ongist]] | ||
# Compile the program: `gcc -o test_cares test_cares.c -lcares`. | # Compile the program: `gcc -o test_cares test_cares.c -lcares`. | ||
# Run the program: `./test_cares`. | # Run the program: `./test_cares`. |
Latest revision as of 04:50, 13 August 2023
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.