Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  *  sync tests
0003  *  Copyright 2015-2016 Collabora Ltd.
0004  *
0005  *  Based on the implementation from the Android Open Source Project,
0006  *
0007  *  Copyright 2012 Google, Inc
0008  *
0009  *  Permission is hereby granted, free of charge, to any person obtaining a
0010  *  copy of this software and associated documentation files (the "Software"),
0011  *  to deal in the Software without restriction, including without limitation
0012  *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
0013  *  and/or sell copies of the Software, and to permit persons to whom the
0014  *  Software is furnished to do so, subject to the following conditions:
0015  *
0016  *  The above copyright notice and this permission notice shall be included in
0017  *  all copies or substantial portions of the Software.
0018  *
0019  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0020  *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0021  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
0022  *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
0023  *  OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0024  *  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0025  *  OTHER DEALINGS IN THE SOFTWARE.
0026  */
0027 
0028 #ifndef SELFTESTS_SYNCTEST_H
0029 #define SELFTESTS_SYNCTEST_H
0030 
0031 #include <stdio.h>
0032 #include "../kselftest.h"
0033 
0034 #define ASSERT(cond, msg) do { \
0035     if (!(cond)) { \
0036         ksft_print_msg("[ERROR]\t%s", (msg)); \
0037         return 1; \
0038     } \
0039 } while (0)
0040 
0041 #define RUN_TEST(x) run_test((x), #x)
0042 
0043 /* Allocation tests */
0044 int test_alloc_timeline(void);
0045 int test_alloc_fence(void);
0046 int test_alloc_fence_negative(void);
0047 
0048 /* Fence tests with one timeline */
0049 int test_fence_one_timeline_wait(void);
0050 int test_fence_one_timeline_merge(void);
0051 
0052 /* Fence merge tests */
0053 int test_fence_merge_same_fence(void);
0054 
0055 /* Fence wait tests */
0056 int test_fence_multi_timeline_wait(void);
0057 
0058 /* Stress test - parallelism */
0059 int test_stress_two_threads_shared_timeline(void);
0060 
0061 /* Stress test - consumer */
0062 int test_consumer_stress_multi_producer_single_consumer(void);
0063 
0064 /* Stress test - merging */
0065 int test_merge_stress_random_merge(void);
0066 
0067 #endif