summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-12-21 10:59:04 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-12-21 15:45:51 +0100
commitc5d27600f99a259430a73630255cbb01d397f96d (patch)
tree2f359ebd683beadb26ba5422f2084841c9c6562e /testsuites
parentscore: Add _Objects_Active_count() (diff)
downloadrtems-c5d27600f99a259430a73630255cbb01d397f96d.tar.bz2
libcsupport: Add rtems_resource_snapshot_take()
Add rtems_resource_rtems_api, rtems_resource_posix_api, rtems_resource_snapshot, rtems_resource_snapshot_equal(), and rtems_resource_snapshot_check().
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/psxtests/psxconfig01/init.c98
-rw-r--r--testsuites/psxtests/psxconfig01/psxconfig01.scn8
2 files changed, 101 insertions, 5 deletions
diff --git a/testsuites/psxtests/psxconfig01/init.c b/testsuites/psxtests/psxconfig01/init.c
index d8c835c624..b2bd6394bf 100644
--- a/testsuites/psxtests/psxconfig01/init.c
+++ b/testsuites/psxtests/psxconfig01/init.c
@@ -7,7 +7,7 @@
*/
/*
- * Copyright (c) 2011 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2011-2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
@@ -36,8 +36,12 @@
#include <stdio.h>
#include <time.h>
+#include <rtems/libcsupport.h>
+
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5
+#define CONFIGURE_MAXIMUM_BARRIERS 2
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 7
#define CONFIGURE_MAXIMUM_PARTITIONS 37
#define CONFIGURE_MAXIMUM_PERIODS 41
#define CONFIGURE_MAXIMUM_REGIONS 43
@@ -228,6 +232,7 @@ static rtems_task Init(rtems_task_argument argument)
rtems_id id = RTEMS_ID_NONE;
rtems_name name = rtems_build_name('C', 'O', 'N', 'F');
rtems_extensions_table table;
+ rtems_resource_snapshot snapshot;
int i = 0;
puts("\n\n*** POSIX TEST CONFIG 01 ***");
@@ -236,6 +241,10 @@ static rtems_task Init(rtems_task_argument argument)
print_info();
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(rtems_resource_snapshot_equal(&snapshot, &snapshot));
+ rtems_test_assert(rtems_resource_snapshot_check(&snapshot));
+
#ifdef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
for (i = 3; i < CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS; ++i) {
int oflag = O_WRONLY | O_CREAT | O_TRUNC;
@@ -244,6 +253,10 @@ static rtems_task Init(rtems_task_argument argument)
int fd = open(path, oflag, mode);
rtems_test_assert(fd == i);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.open_files == CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_USER_EXTENSIONS
@@ -252,6 +265,10 @@ static rtems_task Init(rtems_task_argument argument)
sc = rtems_extension_create(name, &table, &id);
directive_failed(sc, "rtems_extension_create");
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.rtems_api.active_extensions == CONFIGURE_MAXIMUM_USER_EXTENSIONS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_BARRIERS
@@ -259,6 +276,10 @@ static rtems_task Init(rtems_task_argument argument)
sc = rtems_barrier_create(name, RTEMS_DEFAULT_ATTRIBUTES, 1, &id);
directive_failed(sc, "rtems_barrier_create");
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.rtems_api.active_barriers == CONFIGURE_MAXIMUM_BARRIERS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
@@ -272,6 +293,11 @@ static rtems_task Init(rtems_task_argument argument)
);
directive_failed(sc, "rtems_message_queue_create");
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.rtems_api.active_message_queues
+ == CONFIGURE_MAXIMUM_MESSAGE_QUEUES
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_PARTITIONS
@@ -286,6 +312,10 @@ static rtems_task Init(rtems_task_argument argument)
);
directive_failed(sc, "rtems_partition_create");
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.rtems_api.active_partitions == CONFIGURE_MAXIMUM_PARTITIONS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_PERIODS
@@ -293,6 +323,10 @@ static rtems_task Init(rtems_task_argument argument)
sc = rtems_rate_monotonic_create(name, &id);
directive_failed(sc, "rtems_rate_monotonic_create");
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.rtems_api.active_periods == CONFIGURE_MAXIMUM_PERIODS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_REGIONS
@@ -307,6 +341,10 @@ static rtems_task Init(rtems_task_argument argument)
);
directive_failed(sc, "rtems_region_create");
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.rtems_api.active_regions == CONFIGURE_MAXIMUM_REGIONS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_SEMAPHORES
@@ -320,6 +358,10 @@ static rtems_task Init(rtems_task_argument argument)
);
directive_failed(sc, "rtems_semaphore_create");
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.rtems_api.active_semaphores >= CONFIGURE_MAXIMUM_SEMAPHORES
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_TASKS
@@ -334,6 +376,10 @@ static rtems_task Init(rtems_task_argument argument)
);
directive_failed(sc, "rtems_task_create");
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.rtems_api.active_tasks == CONFIGURE_MAXIMUM_TASKS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_TASK_VARIABLES
@@ -348,6 +394,10 @@ static rtems_task Init(rtems_task_argument argument)
sc = rtems_timer_create(name, &id);
directive_failed(sc, "rtems_timer_create");
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.rtems_api.active_timers == CONFIGURE_MAXIMUM_TIMERS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
@@ -356,6 +406,10 @@ static rtems_task Init(rtems_task_argument argument)
eno = pthread_barrier_init(&barrier, NULL, 1);
rtems_test_assert(eno == 0);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.posix_api.active_barriers == CONFIGURE_MAXIMUM_POSIX_BARRIERS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
@@ -364,6 +418,11 @@ static rtems_task Init(rtems_task_argument argument)
eno = pthread_cond_init(&cond, NULL);
rtems_test_assert(eno == 0);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.posix_api.active_condition_variables
+ == CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_POSIX_KEYS
@@ -372,6 +431,10 @@ static rtems_task Init(rtems_task_argument argument)
eno = pthread_key_create(&key, posix_key_dtor);
rtems_test_assert(eno == 0);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.posix_api.active_keys == CONFIGURE_MAXIMUM_POSIX_KEYS
+ );
#endif
#ifdef POSIX_MQ_COUNT
@@ -386,6 +449,15 @@ static rtems_task Init(rtems_task_argument argument)
mqd_t mq = mq_open(path, oflag, mode, &attr);
rtems_test_assert(mq >= 0);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.posix_api.active_message_queue_descriptors
+ == CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
+ );
+ rtems_test_assert(
+ snapshot.posix_api.active_message_queues
+ == CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES
@@ -394,6 +466,10 @@ static rtems_task Init(rtems_task_argument argument)
eno = pthread_mutex_init(&mutex, NULL);
rtems_test_assert(eno == 0);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.posix_api.active_mutexes == CONFIGURE_MAXIMUM_POSIX_MUTEXES
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
@@ -402,6 +478,10 @@ static rtems_task Init(rtems_task_argument argument)
eno = pthread_rwlock_init(&rwlock, NULL);
rtems_test_assert(eno == 0);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.posix_api.active_rwlocks == CONFIGURE_MAXIMUM_POSIX_RWLOCKS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
@@ -413,6 +493,10 @@ static rtems_task Init(rtems_task_argument argument)
sem_t *sem = sem_open(path, oflag, mode, value);
rtems_test_assert(sem != SEM_FAILED);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.posix_api.active_semaphores == CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
@@ -421,6 +505,10 @@ static rtems_task Init(rtems_task_argument argument)
eno = pthread_spin_init(&spinlock, 0);
rtems_test_assert(eno == 0);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.posix_api.active_spinlocks == CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_POSIX_THREADS
@@ -429,6 +517,10 @@ static rtems_task Init(rtems_task_argument argument)
eno = pthread_create(&thread, NULL, posix_thread, NULL);
rtems_test_assert(eno == 0);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.posix_api.active_threads == CONFIGURE_MAXIMUM_POSIX_THREADS
+ );
#endif
#ifdef CONFIGURE_MAXIMUM_POSIX_TIMERS
@@ -437,6 +529,10 @@ static rtems_task Init(rtems_task_argument argument)
rv = timer_create(CLOCK_REALTIME, NULL, &timer_id);
rtems_test_assert(rv == 0);
}
+ rtems_resource_snapshot_take(&snapshot);
+ rtems_test_assert(
+ snapshot.posix_api.active_timers == CONFIGURE_MAXIMUM_POSIX_TIMERS
+ );
#endif
printf("object creation done\n");
diff --git a/testsuites/psxtests/psxconfig01/psxconfig01.scn b/testsuites/psxtests/psxconfig01/psxconfig01.scn
index 7283494c8f..c2aeee5fe5 100644
--- a/testsuites/psxtests/psxconfig01/psxconfig01.scn
+++ b/testsuites/psxtests/psxconfig01/psxconfig01.scn
@@ -1,7 +1,7 @@
*** POSIX TEST CONFIG 01 ***
-used blocks = 46, largest used block = 8264, used space = 64344
-free blocks = 1, largest free block = 97040, free space = 97040
+used blocks = 61, largest used block = 8264, used space = 78792
+free blocks = 1, largest free block = 115944, free space = 115944
object creation done
-used blocks = 204, largest used block = 8264, used space = 160984
-free blocks = 1, largest free block = 400, free space = 400
+used blocks = 280, largest used block = 8264, used space = 193704
+free blocks = 1, largest free block = 1032, free space = 1032
*** END OF POSIX TEST CONFIG 01 ***