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

  1. Install the development package for c-ares: sudo dnf install c-ares-devel.
  2. Prepare a basic C code to test the functionality using c-ares.

How to test

  1. 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.
  1. Here's a simple program [ongist]
  2. Compile the program: gcc -o test_cares test_cares.c -lcares.
  3. Run the program: ./test_cares.

Expected Results

  1. The C program should compile without any errors.
  2. Running the program should display the resolved IP addresses for the specified domain.
  3. The program should exit gracefully after printing the results.

Optional

For advanced testing:

  1. Test the program with multiple domains.
  2. Test DNS resolution for various record types (e.g., MX, TXT).
  3. Examine the behavior of the program when given invalid or non-existent domain names.
  4. Check the behavior with different DNS server configurations.