1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * sync tests 3*4882a593Smuzhiyun * Copyright 2015-2016 Collabora Ltd. 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Based on the implementation from the Android Open Source Project, 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Copyright 2012 Google, Inc 8*4882a593Smuzhiyun * 9*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a 10*4882a593Smuzhiyun * copy of this software and associated documentation files (the "Software"), 11*4882a593Smuzhiyun * to deal in the Software without restriction, including without limitation 12*4882a593Smuzhiyun * the rights to use, copy, modify, merge, publish, distribute, sublicense, 13*4882a593Smuzhiyun * and/or sell copies of the Software, and to permit persons to whom the 14*4882a593Smuzhiyun * Software is furnished to do so, subject to the following conditions: 15*4882a593Smuzhiyun * 16*4882a593Smuzhiyun * The above copyright notice and this permission notice shall be included in 17*4882a593Smuzhiyun * all copies or substantial portions of the Software. 18*4882a593Smuzhiyun * 19*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22*4882a593Smuzhiyun * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23*4882a593Smuzhiyun * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24*4882a593Smuzhiyun * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25*4882a593Smuzhiyun * OTHER DEALINGS IN THE SOFTWARE. 26*4882a593Smuzhiyun */ 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun #ifndef SELFTESTS_SYNCTEST_H 29*4882a593Smuzhiyun #define SELFTESTS_SYNCTEST_H 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun #include <stdio.h> 32*4882a593Smuzhiyun #include "../kselftest.h" 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun #define ASSERT(cond, msg) do { \ 35*4882a593Smuzhiyun if (!(cond)) { \ 36*4882a593Smuzhiyun ksft_print_msg("[ERROR]\t%s", (msg)); \ 37*4882a593Smuzhiyun return 1; \ 38*4882a593Smuzhiyun } \ 39*4882a593Smuzhiyun } while (0) 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun #define RUN_TEST(x) run_test((x), #x) 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun /* Allocation tests */ 44*4882a593Smuzhiyun int test_alloc_timeline(void); 45*4882a593Smuzhiyun int test_alloc_fence(void); 46*4882a593Smuzhiyun int test_alloc_fence_negative(void); 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun /* Fence tests with one timeline */ 49*4882a593Smuzhiyun int test_fence_one_timeline_wait(void); 50*4882a593Smuzhiyun int test_fence_one_timeline_merge(void); 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun /* Fence merge tests */ 53*4882a593Smuzhiyun int test_fence_merge_same_fence(void); 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun /* Fence wait tests */ 56*4882a593Smuzhiyun int test_fence_multi_timeline_wait(void); 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun /* Stress test - parallelism */ 59*4882a593Smuzhiyun int test_stress_two_threads_shared_timeline(void); 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun /* Stress test - consumer */ 62*4882a593Smuzhiyun int test_consumer_stress_multi_producer_single_consumer(void); 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun /* Stress test - merging */ 65*4882a593Smuzhiyun int test_merge_stress_random_merge(void); 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun #endif 68