0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #include "sync.h"
0029 #include "sw_sync.h"
0030 #include "synctest.h"
0031
0032 int test_alloc_timeline(void)
0033 {
0034 int timeline, valid;
0035
0036 timeline = sw_sync_timeline_create();
0037 valid = sw_sync_timeline_is_valid(timeline);
0038 ASSERT(valid, "Failure allocating timeline\n");
0039
0040 sw_sync_timeline_destroy(timeline);
0041 return 0;
0042 }
0043
0044 int test_alloc_fence(void)
0045 {
0046 int timeline, fence, valid;
0047
0048 timeline = sw_sync_timeline_create();
0049 valid = sw_sync_timeline_is_valid(timeline);
0050 ASSERT(valid, "Failure allocating timeline\n");
0051
0052 fence = sw_sync_fence_create(timeline, "allocFence", 1);
0053 valid = sw_sync_fence_is_valid(fence);
0054 ASSERT(valid, "Failure allocating fence\n");
0055
0056 sw_sync_fence_destroy(fence);
0057 sw_sync_timeline_destroy(timeline);
0058 return 0;
0059 }
0060
0061 int test_alloc_fence_negative(void)
0062 {
0063 int fence, timeline;
0064
0065 timeline = sw_sync_timeline_create();
0066 ASSERT(timeline > 0, "Failure allocating timeline\n");
0067
0068 fence = sw_sync_fence_create(-1, "fence", 1);
0069 ASSERT(fence < 0, "Success allocating negative fence\n");
0070
0071 sw_sync_fence_destroy(fence);
0072 sw_sync_timeline_destroy(timeline);
0073 return 0;
0074 }