1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <errno.h> 17 #include <pthread.h> 18 19 #include "pthread_util.h" 20 21 #define DEFAULT_STACK_SIZE 131072 22 pthread_stack_size_0100(void)23static void pthread_stack_size_0100(void) 24 { 25 pthread_attr_t attr = {0}; 26 size_t stack_size = 0; 27 pthread_getattr_default_np(&attr); 28 pthread_attr_getstacksize(&attr, &stack_size); 29 #ifdef TARGET_STACK_SIZE 30 TEST(stack_size == TARGET_STACK_SIZE); 31 #else 32 TEST(stack_size == DEFAULT_STACK_SIZE); 33 #endif 34 } 35 36 TEST_FUN G_Fun_Array[] = { 37 pthread_stack_size_0100, 38 }; 39 main(void)40int main(void) 41 { 42 int num = sizeof(G_Fun_Array) / sizeof(TEST_FUN); 43 for (int pos = 0; pos < num; ++pos) { 44 G_Fun_Array[pos](); 45 } 46 return t_status; 47 }