diff --git a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_026.c b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_026.c index 134786beae585ac556b864777649eb439785c3bc..c9c4228462968af081370dcaa66e453f0cd2554f 100644 --- a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_026.c +++ b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_026.c @@ -54,28 +54,6 @@ struct _scenar_028 { #define NSCENAR (sizeof(g_scenarii028) / sizeof(g_scenarii028[0])) -/* pthread_mutex_destroy 2-2.c - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - * This sample test aims to check the following assertion: - * - * pthread_mutex_init() can be used to re-initialize a destroyed mutex. - - * The steps are: - * -> Initialize a mutex with a given attribute. - * -> Destroy the mutex - * -> Initialize again the mutex with another attribute. - */ static UINT32 Testcase(VOID) { int ret; @@ -85,25 +63,20 @@ static UINT32 Testcase(VOID) pthread_mutexattr_t *pma[NSCENAR + 2]; long pshared; - /* System abilities */ pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - /* Initialize the mutex attributes objects */ for (i = 0; i < NSCENAR; i++) { ret = pthread_mutexattr_init(&ma[i]); ICUNIT_ASSERT_EQUAL(ret, 0, ret); } - /* Default mutexattr object */ + ret = pthread_mutexattr_init(&ma[i]); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - /* Initialize the pointer array */ - /* 2, The loop frequency. */ - for (i = 0; i < NSCENAR + 2; i++) + for (i = 0; i < NSCENAR + 2; i++) // 2, The loop frequency. /* NULL pointer */ pma[i] = NULL; - /* Ok, we can now proceed to the test */ for (i = 0; i < NSCENAR + 2; i++) { // 2, The loop frequency. for (j = 0; j < NSCENAR + 2; j++) { // 2, The loop frequency. ret = pthread_mutex_init(&mtx, pma[i]); diff --git a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_038.c b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_038.c index cef2e59a5eecc615d0917942e2e52c3506c08062..9dde4c5a8ab601a378aedfe14b0f80a41cecc86d 100644 --- a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_038.c +++ b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_038.c @@ -40,51 +40,15 @@ extern "C" { static pthread_mutex_t g_mutex038; static sem_t g_sem038; -/* pthread_mutex_lock 4-1.c - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - * This sample test aims to check the following assertion: - * - * If the mutex type is PTHREAD_MUTEX_RECURSIVE, - * then the mutex maintains the concept of a lock count. - * When a thread successfully acquires a mutex for the first time, - * the lock count is set to one. Every time a thread relocks this mutex, - * the lock count is incremented by one. - * Each time the thread unlocks the mutex, - * the lock count is decremented by one. - * When the lock count reaches zero, - * the mutex becomes available and others threads can acquire it. - - * The steps are: - * ->Create a mutex with recursive attribute - * ->Create a threads - * ->Parent locks the mutex twice, unlocks once. - * ->Child attempts to lock the mutex. - * ->Parent unlocks the mutex. - * ->Parent unlocks the mutex (shall fail) - * ->Child unlocks the mutex. - */ static void *TaskF01(void *arg) { int ret; - /* Try to lock the mutex once. The call must fail here. */ ret = pthread_mutex_trylock(&g_mutex038); if (ret == 0) { ICUNIT_GOTO_EQUAL(1, 0, ret, EXIT); } - /* Free the parent thread and lock the mutex (must success) */ if ((ret = sem_post(&g_sem038))) { ICUNIT_GOTO_EQUAL(1, 0, ret, EXIT); } @@ -93,12 +57,10 @@ static void *TaskF01(void *arg) ICUNIT_GOTO_EQUAL(1, 0, ret, EXIT); } - /* Wait for the parent to let us go on */ if ((ret = sem_post(&g_sem038))) { ICUNIT_GOTO_EQUAL(1, 0, ret, EXIT); } - /* Unlock and exit */ if ((ret = pthread_mutex_unlock(&g_mutex038))) { ICUNIT_GOTO_EQUAL(1, 0, ret, EXIT); } @@ -113,12 +75,10 @@ static UINT32 Testcase(VOID) pthread_mutexattr_t ma; pthread_t child; - /* Initialize the semaphore */ if ((ret = sem_init(&g_sem038, 0, 0))) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } - /* We initialize the recursive mutex */ if ((ret = pthread_mutexattr_init(&ma))) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } @@ -135,9 +95,6 @@ static UINT32 Testcase(VOID) ICUNIT_ASSERT_EQUAL(1, 0, ret); } - /* -- The mutex is now ready for testing -- */ - - /* First, we lock it twice and unlock once */ if ((ret = pthread_mutex_lock(&g_mutex038))) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } @@ -150,40 +107,31 @@ static UINT32 Testcase(VOID) ICUNIT_ASSERT_EQUAL(1, 0, ret); } - /* Here this thread owns the mutex and the internal count is "1" */ - - /* We create the child thread */ if ((ret = pthread_create(&child, NULL, TaskF01, NULL))) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } - /* then wait for child to be ready */ if ((ret = sem_wait(&g_sem038))) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } - /* We can now unlock the mutex */ if ((ret = pthread_mutex_unlock(&g_mutex038))) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } - /* We wait for the child to lock the mutex */ if ((ret = sem_wait(&g_sem038))) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } - /* Then, try to unlock the mutex (owned by the child or unlocked) */ ret = pthread_mutex_unlock(&g_mutex038); if (ret == ENOERR) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } - /* Everything seems OK here */ if ((ret = pthread_join(child, NULL))) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } - /* Simple loop to double-check */ for (i = 0; i < 50; i++) { // 50, The loop frequency. if ((ret = pthread_mutex_lock(&g_mutex038))) { ICUNIT_ASSERT_EQUAL(1, 0, ret); @@ -199,7 +147,6 @@ static UINT32 Testcase(VOID) if (ret == 0) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } - /* The test passed, we destroy the mutex */ if ((ret = pthread_mutex_destroy(&g_mutex038))) { ICUNIT_ASSERT_EQUAL(1, 0, ret); } diff --git a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_042.c b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_042.c index f26da6a6c648aaa317824bb78734036c83e11bcd..6a80c922aaff169701118ebb2b3dc338f898d5c5 100644 --- a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_042.c +++ b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_042.c @@ -39,29 +39,6 @@ extern "C" { static pthread_mutex_t g_mutex042; -/* pthread_mutex_unlock 5-1.c - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - - * This sample test aims to check the following assertion: - * If the mutex type is PTHREAD_MUTEX_RECURSIVE, - * and a thread attempts to unlock a mutex that it does not own, - * an uwErr is returned. - - * The steps are: - * -> Initialize and lock a recursive mutex - * -> create a child thread which tries to unlock this mutex. * - */ static void *TaskF01(void *arg) { int ret; diff --git a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_043.c b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_043.c index 83461d75abc0056c5058660f5095031c0772efe2..ebbc4f660da6527861c7ba2d59ed4e22f606d547 100644 --- a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_043.c +++ b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_043.c @@ -36,31 +36,6 @@ extern "C" { #endif /* __cpluscplus */ #endif /* __cpluscplus */ - -/* pthread_mutex_unlock 5-2.c - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - - * This sample test aims to check the following assertion: - * If the mutex type is PTHREAD_MUTEX_RECURSIVE, - * and a thread attempts to unlock an unlocked mutex, - * an uwErr is returned. - - * The steps are: - * -> Initialize a recursive mutex - * -> Attempt to unlock the mutex when it is unlocked - * and when it has been locked then unlocked. - */ static UINT32 Testcase(VOID) { int ret; diff --git a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_045.c b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_045.c index 185691e503c0be08c1f90284611a5298eb19d756..9485153b95c6f1d4d04e91fb01e98f71924e8c05 100644 --- a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_045.c +++ b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_045.c @@ -39,33 +39,6 @@ extern "C" { static pthread_mutex_t g_mutex045; -/* pthread_mutex_trylock 1-2.c - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - * This sample test aims to check the following assertion: - * - * The pthread_mutex_trylock() function locks the mutex object - * when it is unlocked. - - * The steps are: - * - * -> For each kind of mutex, - * -> trylock the mutex. It shall suceed. - * -> trylock the mutex again. It shall fail (except in case of recursive mutex). - * -> create a new child (either thread or process) - * -> the new child trylock the mutex. It shall fail. - * -> undo everything. - */ static VOID *TaskF01(void *argument) { int ret; diff --git a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_046.c b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_046.c index 08ada66f2df0a44297a3f6f0fcc7a8311600c400..1c44de790798b3e130a5805f60caa4c4c9fef6eb 100644 --- a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_046.c +++ b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_046.c @@ -39,36 +39,6 @@ extern "C" { static pthread_mutex_t g_mutex046; static UINT32 g_nID; -/* pthread_mutex_trylock 2-1.c - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - * This sample test aims to check the following assertion: - * - * If the mutex is of type PTHREAD_MUTEX_RECURSIVE, - * and the calling thread already owns the mutex, - * the call is successful (the lock count is incremented). - - * The steps are: - * - * -> trylock the mutex. It shall suceed. - * -> trylock the mutex again. It shall suceed again - * -> unlock once - * -> create a new child (either thread or process) - * -> the new child trylock the mutex. It shall fail. - * -> Unlock. It shall succeed. - * -> Unlock again. It shall fail. - * -> undo everything. - */ static void *TaskF01(void *arg) { int ret; diff --git a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_049.c b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_049.c index 21baa319f0aefe7ab9085f76e8aad69b65fa0d6d..79f98cafb19f1a099f3ff0f4641bded951d01111 100644 --- a/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_049.c +++ b/testsuites/kernel/sample/posix/mutex/full/It_posix_mutex_049.c @@ -39,31 +39,6 @@ extern "C" { static pthread_mutex_t g_mutex049; -/* pthread_mutex_trylock 4-2.c - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - * This sample test aims to check the following assertion: - * - * If the mutex was already locked, the call returns EBUSY immediatly. - - * The steps are: - * -> Set a timeout. - * -> For each kind of mutex, - * -> Lock the mutex. - * -> create a new child (either thread or process) - * -> the new child trylock the mutex. It shall fail. - * -> undo everything. - */ static VOID *TaskF01(void *argument) { int ret; diff --git a/testsuites/kernel/sample/posix/mutex/smoke/It_posix_mutex_019.c b/testsuites/kernel/sample/posix/mutex/smoke/It_posix_mutex_019.c index 20be1cf9535ca6f7d3c3c8ca42339e8d493bdf80..7c5b1170a6a0508748e176dcb087100772625548 100644 --- a/testsuites/kernel/sample/posix/mutex/smoke/It_posix_mutex_019.c +++ b/testsuites/kernel/sample/posix/mutex/smoke/It_posix_mutex_019.c @@ -41,38 +41,6 @@ static pthread_mutex_t *g_mtx; static sem_t g_semA, g_semB; static pthread_mutex_t g_mtxNull, g_mtxDef; -/* pthread_mutex_init 1-2.c - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - * This sample test aims to check the following assertion: - * - * If the mutex attribute pointer passed to pthread_mutex_init is NULL, - * the effects on the mutex are the same as if a default mutex attribute object had been passed. - * - * The steps are: - * * create two mutexes. One is initialized with NULL attribute, the other with a default attribute object. - * * Compare the following features between the two mutexes: - * -> Can it cause / detect a deadlock? (attempt to lock a mutex the thread already owns). - * If detected, do both mutexes cause the same uwErr code? - * -> Is an uwErr returned when unlocking the mutex in unlocked state? - * When unlocking the mutex owned by another thread? - * - * The test will pass if the results of each feature are the same for the two mutexes - * (making no assumption on what is the default behavior). - * The test will be unresolved if any initialization fails. - * The test will fail if a feature differs between the two mutex objects. - */ - static void *TaskF01(void *arg) { int ret; diff --git a/tools/scripts/parse_exc/parse_excinfo.py b/tools/scripts/parse_exc/parse_excinfo.py index ee602ed3be82967e01d8913f85fb6cb0dba3664a..91cfb5c2bb59ae7a8469fbb1a4dcb41727d30ea2 100755 --- a/tools/scripts/parse_exc/parse_excinfo.py +++ b/tools/scripts/parse_exc/parse_excinfo.py @@ -1,20 +1,34 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. # -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: # -# http://www.apache.org/licenses/LICENSE-2.0 +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. # +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import sys import os diff --git a/tools/scripts/parse_memory/parse_mem_info.sh b/tools/scripts/parse_memory/parse_mem_info.sh index 35da158d191b737e9d86f0b2d76519890283c975..38d56859933390db2dbb546cdfe575f94a38a0a4 100755 --- a/tools/scripts/parse_memory/parse_mem_info.sh +++ b/tools/scripts/parse_memory/parse_mem_info.sh @@ -1,17 +1,33 @@ #!/bin/bash -#Copyright (c) 2020-2021 Huawei Device Co., Ltd. -#Licensed under the Apache License, Version 2.0 (the "License"); -#you may not use this file except in compliance with the License. -#You may obtain a copy of the License at +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. # -# http://www.apache.org/licenses/LICENSE-2.0 +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: # -#Unless required by applicable law or agreed to in writing, software -#distributed under the License is distributed on an "AS IS" BASIS, -#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -#See the License for the specific language governing permissions and -#limitations under the License. +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. LOAD_BASE="0x2000000" LLVM_ADDR2LINE=llvm-addr2line