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

  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.