- memory allocation now works with allocator-functions...

This commit is contained in:
Jan Hutter
2005-11-09 09:35:06 +00:00
parent 7953866962
commit 6c4b815f22
25 changed files with 57 additions and 37 deletions
+2 -1
View File
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <pthread.h>
#include "../allocator.h"
#include "event_queue_test.h"
#include "../tester.h"
#include "../event_queue.h"
@@ -76,7 +77,7 @@ static void event_queue_insert_thread(event_queue_test_t * testinfos)
{
for (j = 0; j < testinfos->entries_per_time;j++)
{
int *value = allocator_alloc_thing(int, "value");
int *value = allocator_alloc_thing(int);
*value = i;
job = job_create(INCOMING_PACKET,value);
time.tv_usec = 0;
+2 -1
View File
@@ -28,6 +28,7 @@
#include <pthread.h>
#include <unistd.h>
#include "../allocator.h"
#include "job_queue_test.h"
#include "../tester.h"
#include "../job_queue.h"
@@ -63,7 +64,7 @@ static void test_job_queue_sender(job_queue_test_t * testinfo)
int i;
for (i = 0; i < testinfo->insert_item_count; i++)
{
int *value = allocator_alloc_thing(int,"int in test_job_queue_sender");
int *value = allocator_alloc_thing(int);
*value = i;
job_t *job = job_create(INCOMING_PACKET,value);
testinfo->job_queue->add(testinfo->job_queue,job);
+2 -1
View File
@@ -23,6 +23,7 @@
#include <string.h>
#include <unistd.h>
#include "../allocator.h"
#include "sender_test.h"
#include "../globals.h"
#include "../receiver.h"
@@ -59,7 +60,7 @@ void test_receiver(tester_t *tester)
{
packet = packet_create(AF_INET);
packet->set_destination(packet,DESTINATION_IP,PORT_TO_SEND);
packet->data.ptr = allocator_alloc_thing(int, "packet data");
packet->data.ptr = allocator_alloc_thing(int);
packet->data.len = ( sizeof(int));
*((int *) (packet->data.ptr)) = i;
global_socket->send(global_socket,packet);
+1
View File
@@ -71,6 +71,7 @@ void test_scheduler(tester_t *tester)
usleep(100 * 1000);
global_event_queue->get_count(global_event_queue, &event_queue_size);
global_job_queue->get_count(global_job_queue, &job_queue_size);
tester->assert_true(tester, (job_queue_size == current + 1), "job-queue size after event");
tester->assert_true(tester, (event_queue_size == job_count - current - 1), "event-queue size after event");
}
+2 -1
View File
@@ -22,6 +22,7 @@
#include <string.h>
#include "../allocator.h"
#include "sender_test.h"
#include "../globals.h"
#include "../sender.h"
@@ -57,7 +58,7 @@ void test_sender(tester_t *tester)
{
packet = packet_create(AF_INET);
packet->set_destination(packet,DESTINATION_IP,PORT_TO_SEND);
packet->data.ptr = allocator_alloc_thing(int, "packet data");
packet->data.ptr = allocator_alloc_thing(int);
packet->data.len = ( sizeof(int));
*((int *) (packet->data.ptr)) = i;
global_send_queue->add(global_send_queue,packet);
+2 -1
View File
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include "../allocator.h"
#include "socket_test.h"
#include "../tester.h"
#include "../socket.h"
@@ -39,7 +40,7 @@ void test_socket(tester_t *tester)
char *test_string = "Testing functionality of socket_t";
pkt->data.ptr = allocator_alloc(strlen(test_string) + 1,"test_string");
pkt->data.ptr = allocator_alloc(strlen(test_string) + 1);
memcpy(pkt->data.ptr,test_string,strlen(test_string) + 1);
pkt->data.len = strlen(test_string) + 1;
+1 -1
View File
@@ -37,5 +37,5 @@ void test_thread_pool(tester_t *tester)
thread_pool_t *pool = thread_pool_create(desired_pool_size);
pool->get_pool_size(pool, &pool_size);
tester->assert_true(tester, (desired_pool_size == pool_size), "thread creation");
//tester->assert_true(tester, (pool->destroy(pool) == SUCCESS), "threadpool destruction");
tester->assert_true(tester, (pool->destroy(pool) == SUCCESS), "threadpool destruction");
}