FOSSology  4.4.0
Open Source License Compliance by Open Source Software
testAgent.c File Reference

Unit tests for agent operations. More...

#include <testRun.h>
#include <agent.h>
#include <job.h>
#include <scheduler.h>
Include dependency graph for testAgent.c:

Go to the source code of this file.

Functions

void create_pipe (int *int_dst, int *int_src, FILE **file_dst, FILE **file_src)
 Creates 2 pipes and initialize parameters. More...
 
void test_meta_agent_init ()
 Test for meta_agent_init() More...
 
void test_add_meta_agent ()
 Test for add_meta_agent() More...
 
void test_agent_death_event ()
 Test for agent_death_event() More...
 
void test_agent_create_event ()
 Test for agent_create_event() More...
 
void test_agent_init ()
 Test for agent_init() More...
 

Variables

CU_TestInfo tests_meta_agent []
 
CU_TestInfo tests_agent []
 

Detailed Description

Unit tests for agent operations.

Definition in file testAgent.c.

Function Documentation

◆ create_pipe()

void create_pipe ( int *  int_dst,
int *  int_src,
FILE **  file_dst,
FILE **  file_src 
)

Creates 2 pipes and initialize parameters.

Parameters
[out]int_dstInitial destination pipe
[out]int_srcInitial source pipe
[out]file_dstFile descriptor for int_dst with read only
[out]file_srcFile descriptor for int_src with write

Definition at line 48 of file testAgent.c.

◆ test_add_meta_agent()

void test_add_meta_agent ( )

Test for add_meta_agent()

Test:
  1. Call add_meta_agent() with appropriate parameters, should return true
  2. Call add_meta_agent() with false parameters, should return false
  3. check if the meta agent is added to the list and contains proper values

Definition at line 104 of file testAgent.c.

◆ test_agent_create_event()

void test_agent_create_event ( )

Test for agent_create_event()

Test:
  1. Create a meta agent and add to the scheduler calling agent_create_event()
  2. Check if the agent for added to the scheduler and is running
  3. Call agent_pause() and agent_unpause() and check if the agent status changes
  4. Call agent_ready_event() and check if the agent status updated
  5. Call agent_fail_event() and check if the agent status updated
  6. Call agent_update_event() and check if the agent status is not updated
  7. Call agent_death_event() and check if the agent status is failed and agent is removed from scheduler

Definition at line 219 of file testAgent.c.

◆ test_agent_death_event()

void test_agent_death_event ( )

Test for agent_death_event()

Test:
  1. Create an agent
  2. Add to the scheduler
  3. Call agent_death_event()
  4. Check if the agent is removed from the scheduler

Definition at line 167 of file testAgent.c.

◆ test_agent_init()

void test_agent_init ( )

Test for agent_init()

Todo:
finish

Definition at line 305 of file testAgent.c.

◆ test_meta_agent_init()

void test_meta_agent_init ( )

Test for meta_agent_init()

Test:
  1. Call meta_agent_init() with appropriate parameters
  2. Check if the meta_agent_t returned is not null
  3. Check if agent have appropriate name, max_run, special values, version raw_cmd and is assigned valid
  4. Call meta_agent_init() with NULL name, should return null
  5. Call meta_agent_init() with NULL command, should return null

Definition at line 76 of file testAgent.c.

Variable Documentation

◆ tests_agent

CU_TestInfo tests_agent[]
Initial value:
=
{
{"Test agent_init", test_agent_init },
{"Test agent_create_event", test_agent_create_event },
CU_TEST_INFO_NULL
}
void test_agent_init()
Test for agent_init()
Definition: testAgent.c:305
void test_agent_create_event()
Test for agent_create_event()
Definition: testAgent.c:219

Definition at line 353 of file testAgent.c.

◆ tests_meta_agent

CU_TestInfo tests_meta_agent[]
Initial value:
=
{
{"Test meta_agent_init", test_meta_agent_init },
{"Test add_meta_agent", test_add_meta_agent },
CU_TEST_INFO_NULL
}
void test_meta_agent_init()
Test for meta_agent_init()
Definition: testAgent.c:76
void test_add_meta_agent()
Test for add_meta_agent()
Definition: testAgent.c:104

Definition at line 345 of file testAgent.c.