diff --git a/src/tests/system/libroot/posix/posixtestsuite/AUTHORS b/src/tests/system/libroot/posix/posixtestsuite/AUTHORS deleted file mode 100644 index dd6ccbd89c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/AUTHORS +++ /dev/null @@ -1,8 +0,0 @@ -geoffrey.r.gustafson REMOVE-THIS AT intel DOT com -inaky.perez-gonzalez REMOVE-THIS AT intel DOT com -julie.n.fleischer REMOVE-THIS AT intel DOT com -majid.awad REMOVE-THIS AT intel DOT com -rolla.n.selbak REMOVE-THIS AT intel DOT com -rusty.lynch REMOVE-THIS AT intel DOT com -salwan.searty REMOVE-THIS AT intel DOT com -sunyi REMOVE-THIS AT users DOT sourceforge DOT net diff --git a/src/tests/system/libroot/posix/posixtestsuite/BUILD b/src/tests/system/libroot/posix/posixtestsuite/BUILD deleted file mode 100644 index 067b530b6a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/BUILD +++ /dev/null @@ -1,145 +0,0 @@ -Build Notes for POSIX Test Suite -================================ -Last update : 2004-04-04 updated for posixtestsuite-1.4.0 - -The POSIX Test Suite should be able to be run independently of any given -OS, so the OS-specific steps for configuring the POSIX Test Suite to run -are currently manual. - -IN GENERAL -========== -In general, if you need to link in a library, place the -l or -L commands -in the LDFLAGS file in the same directory as the Makefile. This will -ensure that these libraries are linked in. - -LINUX -===== -Notes for running POSIX Test Suite against Linux implementations of -POSIX functionality. (Note: If these implementations are accepted into -the kernel, then the manual intervention will no longer apply, and we will -update this document.) - -Please refer to your linux distribution's manual for the kernel and -library information. - -Notes for each test section are here. It is targeted for general linux -kernel 2.6 and glibc-2.3.3. - -============= -Clocks/Timers -============= -Both Linux kernel 2.6 and Glibc support Clocks/Timers now. -Add the '-lrt' option to the LDFLAGS. - -======= -Threads -======= - -LinuxThreads -------------- -If LinuxThreads is the default POSIX thread implementation, -to build against LinuxThreads, add the line -lpthread to LDFLAGS. - -NPTL ----- -If NPTL is the default POSIX thread implementation, -add the line -lpthread to LDFLAGS. - -Otherwise, to build against NPTL, export the following variable: - -export GLIBCDIR=/path/to/NPTL/libc-build - -Then in LDFLAGS, add the following lines: - -$GLIBCDIR/nptl/libpthread.so.0 $GLIBCDIR/libc.so.6 -Wl,-rpath,$GLIBCDIR:$GLIBCDIR/nptl:$GLIBCDIR/elf,-dynamic-linker,$GLIBCDIR/elf/ld-linux.so.2 - -NGPT ----- -To build against NGPT, export the following variables: - -export LD_PRELOAD=libpthread.so.0 -export LD_LIBRARY_PATH="/usr/lib:/lib:$LD_LIBRARY_PATH" - -Then make sure to add the line -lpthread to the file LDFLAGS. - -============== -Message Queues -============== -POSIX Message Queue (Wronski/Benedyczak's implementation) has been -included into linux kernel since 2.6.4-rc1-mm1. -But you still need to install a user library at the time of writing this -document. - -posix1b -------- -To build against the posix1b message queues, see the semaphores information for posix1b. -Also, add -I/usr/include/posix1b/ to LDFLAGS. - -Wronski/Benedyczak ------------------- -To build against the Michal Wronski/Krzysztof Benedyczak message queues, -install the kernel patches from http://www.mat.uni.torun.pl/~wrona/posix_ipc/ -and then build the user library from the same site. Add -lmqueue to -LDFLAGS to run tests. -To create the message queue file system, do: -# mkdir /dev/mqueue -# mount -t mqueue none /dev/mqueue - -========== -Semaphores -========== -NPTL ----- -If NPTL is installed as default POSIX thread library, use -'-lpthread' and '-lrt' flags. - -Otherwise, to build against NPTL, export the following variable: -export GLIBCDIR=/path/to/NPTL/libc-build -Then in LDFLAGS, add the following lines: - -$GLIBCDIR/nptl/libpthread.so.0 $GLIBCDIR/libc.so.6 -Wl,-rpath,$GLIBCDIR:$GLIBCDIR/nptl:$GLIBCDIR/elf,-dynamic-linker,$GLIBCDIR/elf/ld-linux.so.2 - - -posix1b -------- -To run the semaphore test suite against posix1b, you will need to download -and install the posix1b library. - -Start downloading it from: http://www.garret.ru/~knizhnik/posix1b.tar.gz -Once you have the library compiled and installed in /usr/lib. -Add the following library in the LDFLAGS: - - -lposix1b - -Make sure /usr/lib/ is in your PATH. - -======= -Signals -======= - -For the signals-related interfaces that start with "pthread_", refer to -the Threads section above to learn how to build those particular tests. - -Also, please note that if you using version of gcc older that version 3.2-7, -you may run into lots of build and link errors since our Makefile uses the -compiler options "-std=c99" and "-std=gnu99". The solution to this is to -use gcc version 3.2-7 or newer. - -===== -XCOFF -===== - -Since the XCOFF main is called .main, the line: -64 nm -g --defined-only $< | grep -q " T main" || exit 0; \ - -needs to replace main with .main to get these tests to compile. - -Maintainers: Julie Fleischer - Rolla Selbak - Salwan Searty - Majid Awad - Crystal Xiong - Adam Li -Contributors: Jerome Marchand - Ulrich Drepper - diff --git a/src/tests/system/libroot/posix/posixtestsuite/COPYING b/src/tests/system/libroot/posix/posixtestsuite/COPYING deleted file mode 100644 index d60c31a97a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/src/tests/system/libroot/posix/posixtestsuite/ChangeLog b/src/tests/system/libroot/posix/posixtestsuite/ChangeLog deleted file mode 100644 index 3a7b84ea93..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/ChangeLog +++ /dev/null @@ -1,147 +0,0 @@ -10-19-2005 1.5.2 Release - - Code cleanups by Sebastien Decugis - - Add a patch for cleaner build in cross environment from Joseph S. Myers - - Add a patch to _POSIX_CPUTIME and_POSIX_THREAD_CPUTIME handling from Joseph S. Myers - - Make the aio_read/write tests concerningthe offset maximum return PTS_UNTESTED by Sebastien Decugis - - A patch from Randy.Dunlap to fix shm conformance uninitialzedvariables - - A patch from Randy.Dunlap to fix 2 pthread conformance problems - - The patches for sem_post_5_1 and sem_post_8_1 from Yi Xu - - A patch for sem_close_1_1 from Yi Xu - - A patch from Randy.Dunlap for sem_lock to increase BUF_SIZE to prevent segment fault. -06-03-2005 1.5.1 Release - - conformance/interfaces/aio_* and - conformance/interface/lio_listio: add new cases and bug - fixes by Sebastien Decugis. - - add execute.sh by B. Thangaraju. - -01-05-2005 1.5.0 Release - -07-05-2004 1.4.3 Release - -07-05-2004 adam.li@intel.com - - functional/schedule/1-1.c 1-2.c: New case by Abhijeet Bisain. - - stress/threads/pthread_cond_timedwait/stress1.c stress2.c: - New case by Sebastien Decugis. -07-01-2004 adam.li@intel.com - - pthread_attr_setschedparam/1-3.c 1-4.c: - Add test cases by Abhijeet Bisain. - - stress/threads/assertions.xml, - stress/threads/pthread_cond_timedwait/: New case by Sebastien Decugis -06-29-2004 adam.li@intel.com - - pthread_attr_setinheritsched/2-3.c, 2-4.c - - functional/threads/condvar/, README: - Add test cases by Abhijeet Bisain. -06-28-2004 adam.li@intel.com - - stress/threads/pthread_mutex_init/, pthread_mutex_lock/, - pthread_cond_init/: Add stress/scalability cases by Sebastien Decugis -06-22-2004 adam.li@intel.com - - pthread_cond_destroy/speculative/4-1.c, pthread_mutex_destroy/ - speculative/4-2.c, pthread_exit/3-1.c: - Add new test case by Abhijeet Bisain -06-15-2004 adam.li@intel.com - - pthread_cond_init/1-2.c, 2-2.c,4-1.c 4-2.c: Add test case by - Sebastien Decugis. - - pthread_cancel/2-2.c, 2-3.c, 3-3.c: Add test case by - Abhijeet Bisain. -06-11-2004 adam.li@intel.com - - pthread_cond_signal: Add Sebastien DECUGIS's patch -06-07-2004 adam.li@intel.com - - locate-test: Remove -printf argument for 'find' for POSIX conformant. - - Makefile: Remove --defined-only option for 'nm' for POSIX conformant. - - sched_yield/1-1.c: Fix warning on 64-bit system. - - pthread_attr_setstacksize/1-1.c, pthread_attr_getstacksize/1-1.c: - Remove the output. -06-04-2004 adam.li@intel.com - - pthread_attr_getschedparam, pthread_attr_setschedparam: - Add new case by Abhijeet Bisain. - - pthread_attr_s(g)etschedpolicy: Fix. Misuse perror. -06-02-2004 adam.li@intel.com - - clock_getres/7-1.c,8-1.c: Fix incorrect output, compile warning. -05-27-2004 adam.li@intel.com - - sigaction/21-1.c: Fix. Add missing posixtest.h - - pthread_rwlock_trylock/3-1.c: Moved to speculative. -05-27-2004 1.4.2 Release -05-24-2004 adam.li@intel.com - - mmap/13-1.c: Fix. mmap() will update st_atime(). - - sigaction/9-1.c: Fix. Select not block. - - strftime/1-1.c: Fix. %B judgement is not correct. - - mmap/32-1.c: Fix. Change the scenario. -05-20-2004 adam.li@intel.com - - sched_yield/1-1.c: Fix. Incorrect thread return - status. - - Add test case by Sebastien - Decugis(sebastien.decugis@ext.bull.net) - pthread_mutex_unlock/5-1.c, 5-2.c - - pthread_mutexattr_settype/coverage.txt: Fix. - - behavior/signal.h/18-1.c,19-1.c,20-1.c,21-1.c: Fix - struct stack_t, struct siginfo_t. -05-13-2004 adam.li@intel.com - - Add case pthread_mutex_init/5-1.c, - pthread_mutex_init/speculative/5-2.c, - pthread_mutex_lock/3-1.c, 4-1.c, 5-1.c - by Sebastien Decugis(sebastien.decugis@ext.bull.net) - - sem_post/8-1.c: Fix. Will leave Zombie process if fail. -05-10-2004 adam.li@intel.com - - Apply Ulrich Drepper's patch: - sem_post/8-1.c: Add error check and clean up code - pthread_attr_getstackaddr/1-1.c: Fix printf format. - pthread_attr_setstack/2-1.c, pthread_attr_setstackaddr/2-1.c, - pthread_attr_setstacksize/2-1.c: define _GNU_SOURCE correctly. -05-09-2004 adam.li@intle.com - - Add cases pthread_mutex_init/1-2.c, 3-2.c, 5-3.c - by Sebastien Decugis(sebastien.decugis@ext.bull.net) -05-01-2004 1.4.1 Release -04-30-2004 adam.li@intel.com - - sigqueue/12-1.c: Use setuid() instead of seteuid() - - sigqueue/3-1.c: Same as above. - - shm_open/40-1.c: Remove it. This case cannot exit cleanly, - leaving zombie processes. - - shm_open/33-1.c: Remove. Improper scenario. - - shm_open/23-1.c: Rewrite the test scenario. - - pthread_attr_setinheritsched/2-2.c: Bug fix - - pthread_attr_setinheritsched/5-1.c: Remove. Not correct. - - pthread_attr_setscope/5-1.c: Return PTS_UNTESTED - - sched_setparam/23-6.c: Fix the case. It was untested before. - - sched_setscheduler/17-5.c: make -1 as a invalid policy. - - sched_setscheduler/20-1.c: Fix. It was untested before. -04-29-2004 adam.li@intel.com - - add mq_timedsend/16-1.c: Use CLOCK_REALTIME - - timer_getoverrun/2-3.c: Fix bug. It can pass on glibc now. -04-23-2004 adam.li@intel.com - - add mmap/11-4.c mmap/11-5.c - - mmap/11-2.c mmap/11-3.c: Misunderstand the spec. Fix. -04-22-2004 adam.li@intel.com - - pthread_mutexattr_settype/2-1.c: Bug fix -04-20-2004 adam.li@intel.com - - mmap/24-2.c 11-2.c 11-3.c: Bug fix -04-04-2004 1.4.0 Release - - Add test cases to implement tags: CS, CPT, TCT. - - Bug fix from Ulrich Drepper. - - Tested on Linux kernel 2.6, and fixed bugs exposed. -04-30-2003 1.0.0 Release - - Complete signals suite - - Complete process scheduling suite - - Snapshot of threads tests (most of the non-tag associated APIs) - - Bug fixes in all areas (including adding "_POSIX_C_SOURCE=200112L" to - the Makefile to make the actual test suite POSIX compliant) - - Added QUICK-START document to top-level dir - rolla.n.selbak REMOVE-THIS AT intel DOT com -03-21-2003 0.9.0 Release - - More timers bug fixes - - Complete semaphores suite (including bug fixes) - - snapshot of signals tests (including bug fixes) - - Complete message queues suite - - Snapshot of threads tests (most of the non-tag associated APIs) - - framework bug fixes. Added the ./run_tests script. - rolla.n.selbak REMOVE-THIS AT intel DOT com -02-10-2003 0.2.0 Release - - timers bug fixes - - snapshot of semaphores tests - - snapshot of signals tests - - snapshot of threads tests - - framework can build/run functional/stress tests - julie.n.fleischer REMOVE-THIS AT intel DOT com -12-16-2002 0.1.0 Release - - timers tests for TMR and CS tags (for timers) - julie.n.fleischer REMOVE-THIS AT intel DOT com - diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.mqueues b/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.mqueues deleted file mode 100644 index 4a1ff8d5af..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.mqueues +++ /dev/null @@ -1,58 +0,0 @@ -Coverage-Area: Message Queues (MSG) -Area-Code: msg - -/* -COVERAGE DOCUMENT FOR MESSAGE QUEUES -==================================== - -This document lists the items that will be tested for POSIX message queues. - - Item to Test Status -========================================================== -|| Definitions WON'T DO (for now) || -|| Behavior DONE || -|| Functionality WON'T DO (for now) || -|| Stress WON'T DO (for now) || -|| Performance WON'T DO (for now) || -========================================================== -*/ - -// Function Complete? Priority Est. Completion -// ============================================================================ -mq_close YES HIGH DONE -mq_getattr YES MED DONE -mq_notify YES LOW DONE -mq_open YES HIGH DONE -mq_receive YES HIGH DONE -mq_send YES HIGH DONE -mq_setattr YES MED DONE -mq_timedreceive YES LOW DONE -mq_timedsend YES LOW DONE -mq_unlink YES MED DONE -//msgctl NO LOW WON'T -//msgget NO LOW WON'T -//msgrcv NO LOW WON'T -//msgsnd NO LOW WON'T -// =================================================== - -/* - Notes: - msgclt, msgget, msgrcv, msgsnd will not be tested at this time as they do - not apply to the MSG tag (apply to XSI). - - BUILD INFO - ========== - - posix1b - See information in BUILD file (under Semaphores). You will - also need to add -I/usr/include/posix1b/ to LDFLAGS. - - http://www.mat.uni.torun.pl/~wrona/posix_ipc/ - - Install patches and compile/install binary. - - Add -lmqueue to LDFLAGS - - Create the mqueue FS: - mkdir /dev/mqueue - mount -t mqueue none /dev/mqueue - -*/ -Maintainer: Julie Fleischer -Contributor: Crystal Xiong diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.semaphores b/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.semaphores deleted file mode 100644 index 94f9c38384..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.semaphores +++ /dev/null @@ -1,51 +0,0 @@ -Coverage-Area: Semaphores (SEM) - -/* -COVERAGE DOCUMENT FOR SEMAPHORES -============================ - -This document lists the items that will be tested for POSIX semaphore. - - Item to Test Status -========================================================== -|| Definitions NOT STARTED || -|| Behavior IN PROGRESS || -|| Functionality NOT STARTED || -|| Stress NOT STARTED || -========================================================== -*/ - -// Function Complete? Priority -// ================================================= -sem_close YES HIGH -sem_destroy YES HIGH -sem_getvalue YES MED -sem_init YES HIGH -sem_open YES HIGH -sem_post YES HIGH -sem_timedwait YES MED -sem_trywait YES HIGH -sem_wait YES HIGH -sem_unlink YES HIGH -// =================================================== -/* - -Compile: -======== -See the BUILD file in the main directory for the most up-to-date -information on how to compile tests from within the framework. - -The way I'm compiling these test individually by: - - root# gcc 1-1.c -o 1-1 /usr/lib/libposix1b.a - - - -Clean up: -========= -file: cln.sh is a file to clean any open semaphores on the system if they remain -open after running such test. - - -*/ -Maintainer: Majid Awad diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.signals b/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.signals deleted file mode 100644 index 1a1ff7b477..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.signals +++ /dev/null @@ -1,78 +0,0 @@ -Coverage-Area: Signals -Area-Code: sig - -/* -This document lists the items that will be tested for POSIX signals. - - Item to Test Status -========================================================== -|| Definitions DONE || -|| Behavior see table below || -|| Functionality see table below || -|| Stress see table below || -========================================================== - -The signal functions that will be tested as well as the priority to -the POSIX Test Suite creators are listed below. - -Columns are: -Function - function name -Tag - tag that applies to the function in the POSIX spec -Complexity - POSIX test suite owners' intuitions at complexity of the function -as well as complexity required to create a test suite (subjective) -Recommended? - set to "NO" if the POSIX spec recomments using *other* -functions instead of this one going forward; set to "YES" otherwise -Priority - POSIX test suite owners' intuitions at priorities of these -functions (subjective) -Behavior? - Has a behavior test been created? Set to DONE if finished. Set -to tester's name if in progress. Blank items are open. -Functional? - Has a functional test been created? Set to DONE if finished. -Set to tester's name if in progress. Blank items are open. -Stress? - Has a stress test been created? Set to DONE if finished. Set -to tester's name if in progress. Blank items are open. - -*/ -//Function Complete? Pri -//============================================================================= -bsd_signal WONT LOW -kill YES HIGH -killpg YES HIGH -pthread_kill YES MED -pthread_sigmask YES MED -raise YES HIGH -sigaction YES HIGH -sigaddset YES MED -sigaltstack YES LOW -sigdelset YES MED -sigemptyset YES MED -sigfillset YES MED -sighold YES MED -sigignore YES MED -siginterrupt WONT LOW -sigismember YES MED -sigpause YES MED -sigpending YES MED -sigprocmask YES MED -sigqueue YES LOW -sigrelse YES MED -sigsuspend YES MED -sigtimedwait YES LOW -sigwait YES MED -sigwaitinfo YES LOW -signal YES MED -sigset YES LOW - -/* -Items left to prioritize: -- Any additional information listed in the POSIX System Interfaces document - on signals (Namely, any requirements in section 2.4.). -- Any functional requirements listed in the POSIX Base Definitions document. - (ex. Testing that each signal listed in the POSIX Base Definitions - document functionally performs in the manner in which that document - specifies.) -*/ - -Maintainer: Salwan Searty -Contributor: Rusty Lynch -Contributor: Rolla Selbak -Contributor: Julie Fleischer diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.threads b/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.threads deleted file mode 100644 index 63ae5f65cb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.threads +++ /dev/null @@ -1,94 +0,0 @@ -Coverage-Area: Threads (THR) -Area-Code: thr - -/* -COVERAGE DOCUMENT FOR TIMERS -============================ - -This document lists the items that will be tested for POSIX threads. - - Item to Test Status -========================================================== -|| Definitions DONE || -|| Interfaces see table below || -|| Functionality NOT STARTED || -|| Stress NOT STARTED || -========================================================== -*/ - -// Function Complete? Priority -// ================================================= -pthread_attr_destroy YES HIGH -pthread_attr_getdetachstate YES HIGH -pthread_attr_init YES HIGH -pthread_attr_setdetachstate YES HIGH -pthread_cancel YES HIGH -pthread_cond_broadcast YES MED -pthread_cond_destroy YES MED -pthread_cond_init YES MED -pthread_cond_signal YES MED -pthread_cond_timedwait YES MED -pthread_cond_wait YES MED -pthread_condattr_destroy YES LOW -pthread_condattr_init YES LOW -pthread_condattr_getpshared YES LOW -pthread_condattr_setpshared YES LOW -pthread_create YES HIGH -pthread_detach YES HIGH -pthread_equal YES HIGH -pthread_exit YES HIGH -pthread_join YES HIGH -pthread_mutex_destroy YES HIGH -pthread_mutex_init YES HIGH -pthread_mutex_lock YES HIGH -pthread_mutex_trylock YES HIGH -pthread_mutex_unlock YES HIGH -pthread_mutexattr_destroy YES HIGH -pthread_mutexattr_init YES HIGH -pthread_once YES HIGH -pthread_self YES HIGH -pthread_setcancelstate YES HIGH -pthread_setcanceltype YES HIGH -pthread_testcancel YES HIGH -// =================================================== - -/* -NOTES -===== -*For now, didn't include definitions that have specific tags attributed to them. -(i.e. TPS, XSI, BAR, etc.) - -*See BUILD file in top-level dir for info on how to build and execute threads on -different implementations on Linux. - -============================= -NON-HIGH PRIORITY FUNCTIONS -============================= - -// Function Complete? Priority -// ================================================= -pthread_atfork YES LOW -pthread_attr_getschedparam YES MED -pthread_attr_setschedparam YES MED -pthread_cleanup_push YES MED -pthread_cleanup_pop YES MED -pthread_getspecific YES MED -pthread_key_create YES MED -pthread_key_delete YES MED -pthread_mutexattr_getpshared YES LOW -pthread_mutexattr_setpshared YES LOW -pthread_rwlock_destory YES LOW -pthread_rwlock_init YES LOW -pthread_rwlock_rdlock YES LOW -pthread_rwlock_timedrdlock YES LOW -pthread_rwlock_timedwrlock YES LOW -pthread_rwlock_tryrdlock YES LOW -pthread_rwlock_trywrlock YES LOW -pthread_rwlock_unlock YES LOW -pthread_rwlock_wrlock YES LOW -pthread_rwlockattr_destory YES LOW -pthread_rwlockattr_getpshared YES LOW -pthread_setspecific YES MED -*/ - -Maintainer: Rolla Selbak diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.timers b/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.timers deleted file mode 100644 index 8e655f443e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/COVERAGE.timers +++ /dev/null @@ -1,80 +0,0 @@ -Coverage-Area: Clocks and Timers (TMR) -Area-Code: tmr - -/* -COVERAGE DOCUMENT FOR TIMERS -============================ - -This document lists the items that will be tested for POSIX timers. - - Item to Test Status -========================================================== -|| Definitions DONE || -|| Behavior DONE with TMR and CS || -|| tags planned. || -|| see table below || -|| Functionality STOPPED FOR NOW || -|| Stress STOPPED FOR NOW || -========================================================== -*/ - -// Function Complete? Priority -// ================================================= -clock YES MED -clock_getcpuclockid YES LOW -clock_getres YES MED -clock_gettime YES* MED -clock_settime YES* MED -clock_nanosleep YES* HIGH -nanosleep YES HIGH -timer_create YES* HIGH -timer_delete YES MED -timer_getoverrun YES HIGH -timer_gettime YES MED -timer_settime YES MED -// =================================================== - -// *Incomplete because process time clocks functionality not in current version -// under test. - -/* -NOTES -===== -See the BUILD file in the main directory for the most up-to-date -information on how to compile tests from within the framework. - -Some additional notes: -If you want to get CLOCK_MONOTONIC, though, one option that worked -with HRT 2.5.54bk6 and below and RH7.3 was to include -/usr/src/linux/Documentation/high-res-timers/lib/posix_time.h -and turn on -D_POSIX_TIMERS. - -Testing BIN List -================ -Items which I'd like to test more in the future (possibly in functional or -stress tests). - -- Absolute timers and clock changes: - - test setting the time for a timer where the interval is large - - also, test where the delta between old and new clock time is large - => forces division of large numbers, could have inaccuracies (would - probably? be a stress test) - -- test clock_nanosleep() or nanosleep() with a variety of different signals - being sent to interrupt it (esp. if they have no user-handler) - -> probably also stress - -- Also, there may be some ideas for stress tests in the Base Definitions -document. - -POSIX Timers Implementations -============================ -glibc Timers in user-space - http://ftp.gnu.org/gnu/glibc/ -High Res Timers - http://high-res-timers.sourceforge.net -Alternate High Res Timers - http://high-res-timers.sourceforge.net (look - on mailing list for Jim Houston's alternate - implementation -- patch that goes on top - of George Anzinger's HRT) -*/ - -Maintainer: Julie Fleischer diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Assertions b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Assertions deleted file mode 100644 index 58bc976640..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Assertions +++ /dev/null @@ -1,70 +0,0 @@ -ASSERTIONS -========== - -This document defines the format of assertions as well as the information -contained in the XML parameters. - -Format ------- -The general format of an assertion is: - - - -ID --- -The ID is a unique number corresponding to the test case number (see the -README for more information). - -Tag ---- -The tag uses the conventions defined below. - -The format of the tag is below. -Items in <> are replaced with the correct values. -Items in [] are optional. -()+ means the pattern can repeat and occurs at least once -(:::)+ [pt:] - -type - Refers to the type of source that the assertion was taken from. - Valid values are: - ref - For reference document (generally a POSIX specification) - oth - For any other material (design documents, analysis of - behavior, etc.) - -source - Refers to the source that the assertion was taken from. Valid - values are: - For ref: - (Note: # refers to the document version number) - XBD# - POSIX Base Definitions document - XSH# - POSIX System Interfaces document - XCU# - POSIX Shell and Utilities document - XRAT# - POSIX Rationale document - - When dealing with Technical Corrigendums, append TC# where # refers to - the technical corrigendum document number. - - e.g. XSH6TC1, XBDTC2, etc. - - For oth: - user defined - Ideally should be short (1-3 letters) to define the - source. - -start line/ - Refers to the first and last line in the source where the -last line assertion is taken from. If the type is oth and there are no - line numbers, this should be the page number (or 0 if no - page numbers). - - Note: If you do not have access to the line numbers in - the official POSIX Specs, then simply put in - brackets an unofficial reference - (ex.
) - -pt: - If the assertion is taken from a POSIX specification and there - is a POSIX tag (pt) associated with it, the additional string - pt: can designate this. is the three letter - POSIX tag. - -Contributors: geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - julie.n.fleischer REMOVE-THIS AT intel DOT com - ajosey REMOVE-THIS AT rdg DOT opengroup DOT org - rolla.n.selbak REMOVE-THIS AT intel DOT com diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_BoundaryTest b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_BoundaryTest deleted file mode 100644 index 231afc08fc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_BoundaryTest +++ /dev/null @@ -1,20 +0,0 @@ -BOUNDARY TESTS -============== -It is sometimes useful to test parameter boundaries as part of API testing. -In the POSIX Test Suite Framework, variables cannot be assigned to values that -would cause warnings (because warnings are treated as errors), so the following -list of boundary values has been created for boundary testing. - -These boundary values are those values that the gcc compiler would set an -invalid parameter to during compile time: - -INT32_MAX+1 -2147483647 (gcc compiler gave -2147483648) -INT32_MIN-1 2147483647 -unassigned val -1073743192 -unassigned val 1075002478 - -Potentially the MAX+1/MIN-1 values are deterministic. The others are just -empirical examples. - -Contributors: julie.n.fleischer REMOVE-THIS AT intel DOT com - geoffrey.r.gustafson REMOVE-THIS AT intel DOT com diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_BugReporting b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_BugReporting deleted file mode 100644 index 33d7939fc3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_BugReporting +++ /dev/null @@ -1,51 +0,0 @@ -This document describes the process for reporting bugs found _by_ the -POSIX Test Test Suites. - -A future document will cover how to report bugs found _within_ the -POSIX Test Test Suites. - -This document describes the steps we'd like to take to ensure we are finding -new, important issues and reporting them in a clear, consice, and effective -manner. - -1. Bug is found - i.e., Test case shows failure. - Ensure you were testing using: - - The latest version of the test case. - - The latest version of the code under test. - - Code under test that is targeted* for the POSIX Test Suite reporting. -2. Research. - Research as many of the following areas as possible to ensure the bug - is new: - - Mailing list for the code under test. - - Bug database for the code under test. - - LKML - (one archive: http://marc.theaimsgroup.com/?l=linux-kernel) - - Kernel bug database - http://bugme.osdl.org -3. Debug as much as possible. - Some steps include: - - Create a test case which clearly shows the bug. - - If possible, find the fault in the code under test causing the test case - failure. - - If possible, create a patch to fix the fault. -4. If the code under test is compatible with another POSIX version (e.g., - 1993), then determine whether this test case is for functionality - added by the 2001 spec. - If yes, document this in the assertions.xml file**. -5. Create an email bug report containing: - - description of the issue - - kernel used - - patches applied - - relevant configuration information - - hardware used - - test case to reproduce the issue (can be included in the email) -6. Send email bug report to the mailing list for the code under test (or - its bug database, if applicable). Copy LKML, if applicable. [If it - is a bug in the Linux Kernel, submit directly to the Linux Kernel - bug database.] - -*targeted implementation = an implementation which POSIX Test Suite will -be run against; not yet formally defined -**Process for tracing a test case to previous POSIX specifications not -yet defined. - -Contributors: geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - julie.n.fleischer REMOVE-THIS AT intel DOT com diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_CodingGuidelines b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_CodingGuidelines deleted file mode 100644 index 01fd8a5bb9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_CodingGuidelines +++ /dev/null @@ -1,12 +0,0 @@ -This document describes the coding guidelines for this project. - -Since one of the most common uses of these API tests is to find bugs -with the Linux kernel and submit bug reports to the linux-kernel -mailing list with a pointer to the source code of the test case that -demonstrates the bug, it makes sense to follow the coding guidelines -followed by the Linux kernel. These are available at: -http://www.purists.org/linux/ or in linux/Documentation/CodingStyle -in a Linux distribution. - -Contributors: rusty.lynch REMOVE-THIS AT intel DOT com - julie.n.fleischer REMOVE-THIS AT intel DOT com diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_ConformanceTest b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_ConformanceTest deleted file mode 100644 index 9b77fdea91..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_ConformanceTest +++ /dev/null @@ -1,93 +0,0 @@ -Conformance Test: Definition and Structure -=========================================== - -This document describes what conformance tests are, how they are created, -and the structure they follow in CVS. - -Conformance Test Definition ---------------------------- - -Conformance tests test conformance to the POSIX* specification. They test -both that the header files are correct and that the behavior defined in -the specification is implemented. - -Directory Structure -------------------- - -The directory structure for conformance tests is as follows. - -All tests are located in the conformance/ directory off of posixtestsuite/. - -Within this directory, there are the following three subdirectories: - -definitions/ - This directory contains tests for each *.h file in the POSIX -spec. Tests are taken from the Base Definitions document. - -interfaces/ - This directory contains tests for each function listed in the -POSIX spec. Tests are taken from the System Interfaces document. - -behavior/ - This directory contains tests from any document that do not -directly correlate to functions (as in interfaces/) or header files -(as in definitions/). - -The breakdown of these subdirectories is as follows: - -definitions/ ------------ -The definitions/ directory contains one subdirectory per *.h file. Each -subdirectory should have the name *_h (i.e., the *.h file name with "_" -replacing "."). - -interfaces/ ----------- -The interfaces directory contains one subdirectory per function listed -in the System Interfaces document. - -behavior/ --------- -This directory is broken down by functional area in a manner similar to -functional and stress tests (see HOWTO_ - for now, see email discussions -on functional/stress test structure). - -Writing Tests -------------- - -Within each lowest level directory (definitions/*_h for definitions, -interfaces/ for interfaces, and behavior/ for -behavior), an assertions.xml file is used to describe the tests, and tests -have the structure M-N.c or M-N.sh. More details are below. - -Speculative Tests ------------------ -Tests which the POSIX spec uses the words "may" or "implementation-defined" -to define are considered speculative by PTS and are created in a -speculative/ directory off of the functional area directory. (For -example, mq_timedsend/speculative.) -These tests attempt to determine which of the implementation-defined -alternatives the current implementation implements. PTS_PASS is always -returned if the test is able to finish. - -assertions.xml --------------- -This file contains a list of assertions to be tested, an ID for each -assertion, and descriptive attributes to be used in categorizing -assertions. For more information on creating and using these files, -see HOWTO_Assertions. - -Test Cases ----------- -Test cases are numbered M-N.c or M-N.sh where M corresponds to the -assertion ID of the assertion being tested, and N is an ID for the specific -tests. (ex. assertion 8 may have test cases 8-1.c 8-2.c and 8-3.sh) -Generally, *.sh scripts are only used when the test case is trivial. - -The following documents may be helpful in test case creation: - -- HOWTO_DefinitionsTest - describes how to create definitions tests -- HOWTO_ResultCodes - describes the result codes test cases should return -- HOWTO_BoundaryTest - describes how to create boundary tests for functions - -* POSIX (R) is a registered trademark of the IEEE - -Contributors: rusty.lynch REMOVE-THIS AT intel DOT com - julie.n.fleischer REMOVE-THIS AT intel DOT com diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Coverage b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Coverage deleted file mode 100644 index 8f4c0d8538..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Coverage +++ /dev/null @@ -1,93 +0,0 @@ -COVERAGE FILES -============== - -Every area of the POSIX spec that has tests written for it should be tracked by -a corresponding COVERAGE. file in the Documentation directory. The first -example file is COVERAGE.timers, which I will keep up to date with the latest -format. - -The idea with these files is to track the progress of test creation. Also, the -files will be parsed nightly to generate the Project Status web page at -http://posixtest.sf.net/status.html so they must conform to a certain format. - -To simplify the creation of a tool to parse these files, the following rules -should be observed in creating the file. - -Completion of POSIX Function Conformance Tests ----------------------------------------------- -There should be one line for each POSIX function included in this area of the -POSIX spec. The tests for these functions are currently found in the -conformance/behavior/ directory. (They may be moved to -conformance/interfaces/ shortly.) The function test directory -need not exist yet, but the list of functions in the COVERAGE file should be -complete. - -Each line should have this format: - - -That is, spaces or tabs as whitespace separating the function name and complete -fields, and any other fields, if present. Other fields will be ignored by the -parser currently. - -For example, from COVERAGE.timers: -clock_gettime NO* MED - -Only the first letter of the complete? field will be read, and should be either -N or Y. (So you are free to have asterisks as Julie has done.) - -She has a priority field after that HIGH/MED/LOW which is currently not used by -the parser. - -Information Fields ------------------- -Additional information should be provided with this format: -Field-Name: Value-Data - -The field "Coverage-Area" MUST be provided with a description of this area of -the POSIX spec such as "Clocks & Timers (TMR)". - -The field "Area-Code" MUST be provided, a unique code with no spaces to use -internally within the web page to link to the stats about this coverage area, -such as "tmr" or "sig". - -The field "Maintainer" SHOULD be provided with the name of the active -maintainer of this area. - -The field "Contributor" MAY be provided (one or more times) with a name of -someone who contributed to the tests in this area (other than the active -maintainer). - -Comment Lines -------------- -Any line that is not of the type defined above must be denoted as a comment -line. There are three types of comment lines that will be ignored: - -- Any blank line or line with whitespace only -- Any line beginning with // -- Any lines between an opening line of /* and a closing line of */ (inclusive) - -For example, only the clock_gettime line would be parsed below: - -// SAMPLE FILE: First Line - -// The line above is whitespace only, and the line below is blank - -/* -This section is for longer -comments. -*/ -clock_gettime NO* MED - -// SAMPLE FILE: Last Line - -Other Tests: Definitions, Functional, Stress, etc. --------------------------------------------------- -These tests are not currently handled by the parser tool, and thus should be -included in comment fields if the information is present. - -Future Extensions ------------------ -If other fields become required later, they will be moved to the front of the -text lines, so that optional fields can still appear after them. - -Contributors: geoffrey.r.gustafson REMOVE-THIS AT intel DOT com diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_DefinitionsTest b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_DefinitionsTest deleted file mode 100644 index 3df9a7bc94..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_DefinitionsTest +++ /dev/null @@ -1,73 +0,0 @@ -DEFINITIONS TESTING -=================== -A variety of header file definitions are listed in the POSIX Base Definitions -document. The steps below describe how to test the various types of -definitions that appear. - -Definitions Testing -> STRUCTURES ---------------------------------- -To test that a structure has been correctly defined, we add two tests into -one .c file. The first test tests that the structure has been declared, and -the second that all elements of the structure are correctly defined. - -To make the first test and setup the second, delcare the structure as: - -struct this_type_should_exist, t; - -To make the second test, create a dummy function and assign elements of -the correct structure to t or assign t to certain elements: - -int dummyfcn (void) -{ - t. = ; - = t.; -} - -For assignment, some rules of thumb are: -- For variables of a defined type, assign t. to these values. -ex. -sigset_t *set; -set = &t.sa_mask; - -- For variables which are other functions, assign a function to t.. -ex. -extern void signal_handler(int); -t.sa_handler = signal_handler; - -For examples, see posixtestsuite/conformance/definitions/signal/15-1.c - -Definitions Testing -> MACROS ------------------------------ -Macros are tested to see if they are defined. This is done via the -#ifdef preprocessor lines. - -ex. -#include - -#ifndef -#error not defined -#endif - -For examples, see posixtestsuite/conformance/definitions/signal/22-*.c - -Definitions Testing -> FUNCTIONS --------------------------------- -To test functions, declare a typedef of a test function identical to the -function under test, create a variable of that typedef, and try to assign -it to the function under test. - -ex. -typedef int (*fcn_test)(char *, char *); -int dummyfcn (void) -{ - fcn_test dummyvar; - dummyvar = fcn; - return 0; -} - -For examples, see posixtestsuite/conformance/definitions/signal/43-1.c - -Contributors: Inaky.Perez-Gonzalez REMOVE-THIS AT intel DOT com - Julie.N.Fleischer REMOVE-THIS AT intel DOT com - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_FunctionalStressTest b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_FunctionalStressTest deleted file mode 100644 index 8e15a300b5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_FunctionalStressTest +++ /dev/null @@ -1,79 +0,0 @@ -Functional and Stress Tests: Definition and Structure -====================================================== - -This document describes what functional and stress tests are, how they -are created, and the structure that they follow in CVS. - -Functional Test Definition --------------------------- - -Functional tests test the behavior of functional areas of the POSIX* -specification. They do not relate directly to lines in the POSIX -specifications, but rather test that the overall behavior specified by -the functional area is present. - -Stress Test Definition ----------------------- - -Stress tests are designed to monitor how the system behaves when it is -taxed by excessively using the functional areas in the POSIX specification -or monitoring how the functional areas in the POSIX specification behave -when the system is taxed. - -Directory Structure -------------------- -Functional and stress tests follow the same structure. - -The functional/ and stress directories off of posixtestsuite are where the -functional and stress tests, respectively, are stored. - -Each of these are further subdivided into POSIX area (Timers, Semaphores, -etc.). For example, functional/timers. - -Within the functional/ directory, you should create the -following files. -- Makefile - master Makefile which will make all tests within the area - -- run.sh - file which will run all functional tests. The run.sh can run -conformance tests, functional tests from a different area (i.e., -functional/threads/run.sh can call functional/timers/threadstests/test.c), -as well as functional tests in the current area. If there are tests that -apply to more than one area, they can go in either area and be called from -the other if needed. -Assume that the run.sh is called from the directory it is currently in -when writing path names to files. - -- assertions.xml - This file maps test descriptions to test cases as in -conformance tests. The grammar for functional/stress tests is: - - - -]> -Where the tag follows the same structure outlined in HOWTO_Assertions, and -the files="..." field tags a comma delimited list of files which are -used to test the assertion. For example, - - Three threads can be run in parallel. - - -- coverage.txt - This document contain information on the completion of -test cases for assertions as in the conformance tests. -Content is lines with content: - - -So long as the functional/stress tests follow these guidelines, they -can be built and run by the framework. How the directory is subdivided -is up to the area creator to define, but some suggestions have been: - - create directories corresponding to POSIX chapters (see .1-1990 or - .1-1996 specs) - - create a number corresponding to the assertion ID for each directory - -* POSIX (R) is a registered trademark of the IEEE - -Contributors: julie.n.fleischer REMOVE-THIS AT intel DOT com - ajosey REMOVE-THIS AT rdg DOT opengroup DOT org - geoffrey.r.gustafson REMOVE-THIS AT intel DOT com diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_INDEX b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_INDEX deleted file mode 100644 index 6ffd820c6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_INDEX +++ /dev/null @@ -1,16 +0,0 @@ -This is an index to the various HOWTO files in this directory. - -HOWTO_Assertions - describes format of assertions.xml files -HOWTO_BoundaryTest - information about testing boundary conditions -HOWTO_BugReport - dealing with a test failure the suite finds -HOWTO_CodingGuidelines- describes coding guidelines for this project -HOWTO_ConformanceTest - info on creation and structure of conformance tests -HOWTO_Coverage - describes format of COVERAGE. files -HOWTO_DefinitionsTest - ideas behind testing POSIX header files -HOWTO_Functional- - info on creation and structure of functional - StressTest and stress tests -HOWTO_INDEX - lists all HOWTO files with descriptions -HOWTO_Release - describes how to release a version of PTS -HOWTO_ResultCodes - standardized return codes for tests -HOWTO_RunTests - information on building/running tests -HOWTO_Tagging - describes how to tag files for inclusion in a release diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Release b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Release deleted file mode 100644 index 874a38b7be..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Release +++ /dev/null @@ -1,34 +0,0 @@ -HOWTO Release a Package of the POSIX Test Suite -=============================================== - -This document describes the procedure for releasing files for the POSIX -Test Suite. These actions should be taken to verify the integrity of the -released files. - -======================================================================= - -1. Pull all code on the developer tag and tag with the release tag (See - the HOWTO_Tagging document for more information on how to do this.). - -2. Create a posixtestsuite-...tar.gz file containing - everything with the release tag. - Note: Follow guidelines on: - http://en.tldp.org/HOWTO/Software-Release-Practice-HOWTO/distpractice.html - -3. Use the SF admin interface to add this file to the project. - -4. Download the *.tar.gz file from the SF interface and untar it in - a sandbox. - -5. Run "make" to try to build and execute all files in the release, and - ensure that they all build and execute correctly. - -6. Craft a release message and send to: posixtest-announce. - -7. Send a copy of that release message to: LKML, cc: posixtest-discuss. - [This ensures discussions happen on the discuss mailing list, not - the announce mailing list.] - -8. Update sourceforge homepage and project page with this information. - -9. Update freshmeat.net with this information. diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_ResultCodes b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_ResultCodes deleted file mode 100644 index 81a7397a2a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_ResultCodes +++ /dev/null @@ -1,43 +0,0 @@ -RESULT CODES -============ - -POSIX Test Suite tests all return standard result codes for ease in -interpreting the output. The result code terms are taken from -IEEE Test Methods for Measuring Conformance to POSIX (IEEE 1003.3-1991). -These result codes are a subset of the LSB result codes and, for -consistency with LSB, are given the same number. - -Initial Contributors: - ajosey REMOVE-THIS AT rdg DOT opengroup DOT org - julie.n.fleischer REMOVE-THIS AT intel DOT com - geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - -The PTS result codes are: - -#define PTS_PASS 0 -#define PTS_FAIL 1 -#define PTS_UNRESOLVED 2 -#define PTS_UNSUPPORTED 4 -#define PTS_UNTESTED 5 - -A brief discussion of each of these follows: - -PTP_PASS Used when the test executes fully with no problems and passes. -PTP_FAIL Used when the test executes fully, but fails. -PTP_UNRESOLVED Used when the test was blocked from fully completing and - the pass/failure results cannot be determined. -PTP_UNSUPPORTED Used if the test is for a conditional feature that is - not implemented. -PTP_UNTESTED Used when a feature does not have a test associated - with it because: - - The test is just a stub and doesn't do anything - - The test is only partially complete and can't really - finish the test - - The test is complete in some cases, but certain things - can happen that leave the test incomplete. When these - happen, it's PTP_UNTESTED. - -These result codes are contained in the header file posixtest.h, located -in the include/ directory. - -This header file should be included in each test suite created. diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_RunTests b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_RunTests deleted file mode 100644 index c9d17d621e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_RunTests +++ /dev/null @@ -1,98 +0,0 @@ - -SECTIONS: -1. Overview -2. Framework Functionality -3. Building and Running the Tests - - -1. Overview ------------- -This document describes how to run the tests in the POSIX Test Suite. - -Our framework currently has the ability to build and run conformance, -functional, and stress tests. Only conformance and functional tests are -built when a user tries to "make all" as stress tests leave the system -in an indeterminate state and should generally be run manually. - -2. Framework Functionality ----------------------------------------------------- - - * Conformance Tests -The build and execution process varies per conformance tests. - -For definitions tests, the build and execution process is the same since -the "test" is that the file compiles. A definitions test will be compiled, -not linked, by the compiler. - -For all other tests, they will have one test for the compile, one for the -link, and one for the execution of the test. Successfull tests return -PTS_PASS, which the compiler interprets as success. All other return -values are failures. [For more info, see HOWTO_ResultCodes.] - - * Functional/Stress Tests -Functional and stress tests have their own Makefile and method for running, -and the framework merely calls these mechanisms. To build functional and -stress tests, the framework calls the main Makefile for each functional -area. To run these tests, the framework calls the run.sh file for each -functional area. - -3. Building and Running the Tests ----------------------------------- - -**See the BUILD file for info on how to set up the build for the specific -area you are testing (threads, mqs, semaphores, etc.) - -To build and run the tests, you should be in the main posixtestsuite/ -directory. - -From there, execute: -# make - -This will build and run all conformance and functional tests [See above -for why stress tests are not built.]. - -If you'd like to build and run conformance tests for a specific area (threads, -timers, semaphores, message queues, signals), use the script run_tests and -run: -# ./run_tests [SIG|SEM|THR|TMR|MSG] - the argument is the 3 letter POSIX abbreviation for area - - * Conformance-specific items -To run conformance tests for a specific directory, first export the -POSIX_TARGET variable to the directory desired. -Ex. -# export POSIX_TARGET=conformance/definitions/time_h - - * Linking in a library -To link in a library or add any other flags at build or link time, -modify file LDFLAGS with the -L... -l... or -D... lines you would like -added. - -To just build conformance tests, run: -# make build-tests - -To just run conformance tests, run: -# make run-tests - - * Functional/Stress-specific items -To run only functional tests, run: -# make functional-tests - -To run only stress tests, run: -# make stress-tests - -To make only functional tests, run: -# make functional-make - -To make only stress tests, run: -# make stress-make - -To only run functional tests, run: -# make functional-run - -To only run stress tests, run: -# make stress-run - -Contributors: rusty.lynch REMOVE-THIS AT intel DOT com - julie.n.fleischer REMOVE-THIS AT intel DOT com - rolla.n.selbak REMOVE-THIS AT intel DOT com diff --git a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Tagging b/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Tagging deleted file mode 100644 index c08c97b0a1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Documentation/HOWTO_Tagging +++ /dev/null @@ -1,42 +0,0 @@ -HOWTO Tag Software -================== - -Releases of the POSIX Test Suite will happen at defined (TBD) intervals. -In order to get code included in the releases, the tagging scheme below -has been created. - -Developer Tagging -================= -When the code a developer is working on is ready for a release, the developer -should tag it with the tag: - posixtestsuite__source - -This code will then be pulled to make the official release. - -Note: Before code should be considered to be ready for release, it should -follow all HOWTOs currently created. - -Release Coordinator Tagging -=========================== -The person responsible for gathering and tarring all the files for the -official release will grab all files with the posixtestsuite__source -tag and tag them with the tag: - Release__M_N_P__posixtestsuite__YYMMDD -where M.N.P is the version number, and YYMMDD is the current date. - -The version numbering scheme is as follows: - -M = Major release. The initial scope of the POSIX Test Suite corresponds -to M=1. That includes tests for all initially scoped POSIX areas (signals, -threads, semaphores, message queues, timers). M<1 is for releases before -the first major release. M>1 will happen when the scope changes. - -N = Minor release. The various minor releases have yet to be determined, -but will most likely roughly correspond to the milestones defined. - -P = Release number. This is incremented each time a new release is made. -Restarts at 0 for each new Major/Minor combination. - -Contributors: rolla.n.selbak REMOVE-THIS AT intel DOT com - geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - julie.n.fleischer REMOVE-THIS AT intel DOT com diff --git a/src/tests/system/libroot/posix/posixtestsuite/INSTALL b/src/tests/system/libroot/posix/posixtestsuite/INSTALL deleted file mode 100644 index 9e3d3cd0ad..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/INSTALL +++ /dev/null @@ -1,9 +0,0 @@ - -This package does not install yet ... it is intended to be run -directly. - -See BUILD for information on how to configure your system to build -all tests. - -See Documentation/HOWTO_RunTests for information on how to run all tests. - diff --git a/src/tests/system/libroot/posix/posixtestsuite/LDFLAGS b/src/tests/system/libroot/posix/posixtestsuite/LDFLAGS deleted file mode 100644 index 6c0149e09e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/LDFLAGS +++ /dev/null @@ -1,18 +0,0 @@ -#This file contains all lines needed for linking the test suites. -#These may be on one line or multiple lines. -# -#Place the -l, -L, or -D piece before the item to link. -#Lines beginning with # are comments. -# -#For example, -#-lpthread -D_GNU_SOURCE -# -#Recommended flags: -#-D_XOPEN_SOURCE=600 -lpthread -lrt -lm -# -# For use with Linux, you may try the following flags to -# allow for the NPTL-specific compilation (used in some test cases) -# Note: this sometimes require the package nptl-devel.*.rpm to be installed. -#-I /usr/include/nptl -L /usr/lib/nptl -D_XOPEN_SOURCE=600 -lpthread -lrt -lm - --lposix_error_mapper -DB_USE_POSITIVE_POSIX_ERRORS diff --git a/src/tests/system/libroot/posix/posixtestsuite/Makefile b/src/tests/system/libroot/posix/posixtestsuite/Makefile deleted file mode 100644 index 5c2417293c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Makefile +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: inaky.perez-gonzalez REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. -# -# Kind of a little bit bastardized automakefile ... This is the -# temporary glue to hold it all together; once our needs change or we -# need something more advanced, we'll implement it. -# -# So far, I understand Make is not the best language, but I felt lazy -# today and wanted to use the default rules of automake [did I alredy -# mentioned I am bastardizing it?]. -# -# Ok, I don't use Automake any more -# -# Added patch from dank REMOVE-THIS AT kegel DOT com -# - -# Added tests timeout from Sebastien Decugis (http://nptl.bullopensource.org) -# Expiration delay is 240 seconds -TIMEOUT_VAL = 240 -# The following value is the shell return value of a timedout application. -# with the bash shell, the ret val of a killed application is 128 + signum -# and under Linux, SIGALRM=14, so we have (Linux+bash) 142. -TIMEOUT_RET = $(shell cat $(top_builddir)/t0.val) - -top_builddir = . - -LOGFILE = $(top_builddir)/logfile - -LDFLAGS := $(shell cat LDFLAGS | grep -v \^\#) - -RUN_TESTS := $(shell $(top_builddir)/locate-test \ - --execs $(top_builddir)/$(POSIX_TARGET)) -BUILD_TESTS := $(shell $(top_builddir)/locate-test \ - --buildable $(top_builddir)/$(POSIX_TARGET)) -FUNCTIONAL_MAKE := $(shell $(top_builddir)/locate-test --fmake) -FUNCTIONAL_RUN := $(shell $(top_builddir)/locate-test --frun) -STRESS_MAKE := $(shell $(top_builddir)/locate-test --smake) -STRESS_RUN := $(shell $(top_builddir)/locate-test --srun) -PWD := $(shell pwd) -TIMEOUT = $(top_builddir)/t0 $(TIMEOUT_VAL) - - -all: build-tests run-tests - -build-tests: $(BUILD_TESTS:.c=.test) -run-tests: $(RUN_TESTS:.test=.run-test) - -functional-tests: functional-make functional-run -stress-tests: stress-make stress-run - -tests-pretty: - $(MAKE) all | column -t -s: - -CFLAGS = -g -O2 -Wall -Werror -D_POSIX_C_SOURCE=200112L - -# add -std=c99, -std=gnu99 if compiler supports it (gcc-2.95.3 does not). -check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi) -CFLAGS += $(call check_gcc,-std=c99,) -CFLAGS += $(call check_gcc,-std=gnu99,) - -INCLUDE = -Iinclude - -# FIXME: exaust cmd line length -clean: - @rm -f $(LOGFILE) -# Timeout helper files - @rm -f $(top_builddir)/t0{,.val} -# Built runnable tests - @find $(top_builddir) -iname \*.test | xargs -n 40 rm -f {} - @find $(top_builddir) -iname \*~ -o -iname \*.o | xargs -n 40 rm -f {} - @$(foreach DIR,$(FUNCTIONAL_MAKE),make -C $(DIR) clean >> /dev/null 2>&1;) >> /dev/null 2>&1 - -# Rule to run a build test -# If the .o doesn't export main, then we don't need to link -.PRECIOUS: %.test -%.test: %.o - @COMPLOG=$(LOGFILE).$$$$; \ - [ -f $< ] || exit 0; \ - { nm -g $< | grep -q " T main"; } || \ - { echo "$(@:.test=): link: SKIP" | tee -a $(LOGFILE) && exit 0; }; \ - if $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) > $$COMPLOG 2>&1; \ - then \ - echo "$(@:.test=): link: PASS" | tee -a $(LOGFILE); \ - else \ - ( \ - echo "$(@:.test=): link: FAILED. Linker output: "; \ - cat $$COMPLOG; \ - ) >> $(LOGFILE); \ - echo "$(@:.test=): link: FAILED "; \ - fi; \ - rm -f $$COMPLOG; - -# Rule to run an executable test -# If it is only a build test, then the binary exist, so we don't need to run -.PHONY: %.run-test -%.run-test: %.test $(top_builddir)/t0 $(top_builddir)/t0.val - @COMPLOG=$(LOGFILE).$$$$; \ - [ -f $< ] || exit 0; \ - $(TIMEOUT) $< > $$COMPLOG 2>&1; \ - RESULT=$$?; \ - if [ $$RESULT -eq 1 ]; \ - then \ - MSG="FAILED"; \ - fi; \ - if [ $$RESULT -eq 2 ]; \ - then \ - MSG="UNRESOLVED"; \ - fi; \ - if [ $$RESULT -eq 4 ]; \ - then \ - MSG="UNSUPPORTED"; \ - fi; \ - if [ $$RESULT -eq 5 ]; \ - then \ - MSG="UNTESTED"; \ - fi; \ - if [ $$RESULT -eq $(TIMEOUT_RET) ]; \ - then \ - MSG="HUNG"; \ - fi; \ - if [ $$RESULT -gt 5 -a $$RESULT -ne $(TIMEOUT_RET) ]; \ - then \ - MSG="INTERRUPTED"; \ - fi; \ - if [ $$RESULT -eq 0 ]; \ - then \ - echo "$(@:.run-test=): execution: PASS" | tee -a $(LOGFILE); \ - else \ - ( \ - echo "$(@:.run-test=): execution: $$MSG: Output: "; \ - cat $$COMPLOG; \ - ) >> $(LOGFILE); \ - echo "$(@:.run-test=): execution: $$MSG "; \ - fi; \ - rm -f $$COMPLOG; - -$(top_builddir)/t0: $(top_builddir)/t0.c - @echo Building timeout helper files; \ - $(CC) -O2 -o $@ $< - -$(top_builddir)/t0.val: $(top_builddir)/t0 - echo `$(top_builddir)/t0 0; echo $$?` > $(top_builddir)/t0.val - -%.run-test: %.sh $(top_builddir)/t0 $(top_builddir)/t0.val - @COMPLOG=$(LOGFILE).$$$$; \ - chmod +x $<; \ - $(TIMEOUT) $< > $$COMPLOG 2>&1; \ - RESULT=$$?; \ - if [ $$RESULT -eq 0 ]; \ - then \ - echo "$(@:.run-test=): execution: PASS" | tee -a $(LOGFILE);\ - else \ - ( \ - echo "$(@:.run-test=): execution: FAILED: Output: ";\ - cat $$COMPLOG; \ - ) >> $(LOGFILE); \ - echo "$(@:.run-test=): execution: FAILED "; \ - fi; \ - rm -f $$COMPLOG; - - -.PRECIOUS: %.o -%.o: %.c - @COMPLOG=$(LOGFILE).$$$$; \ - if $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ $(LDFLAGS) > $$COMPLOG 2>&1; \ - then \ - echo "$(@:.o=): build: PASS" | tee -a $(LOGFILE); \ - else \ - ( \ - echo "$(@:.o=): build: FAILED: Compiler output: "; \ - cat $$COMPLOG; \ - ) >> $(LOGFILE); \ - echo "$(@:.o=): build: FAILED "; \ - fi; \ - rm -f $$COMPLOG; - -# Functional/Stress test build and execution -functional-make: - $(foreach DIR,$(FUNCTIONAL_MAKE),make -C $(DIR);) - -.PHONY: $(FUNCTIONAL_RUN) - -functional-run: $(FUNCTIONAL_RUN) - -$(FUNCTIONAL_RUN): - cd $@; ./run.sh - cd $(PWD) - -stress-make: - $(foreach DIR,$(STRESS_MAKE),make -C $(DIR);) - -.PHONY: $(STRESS_RUN) - -stress-run: $(STRESS_RUN) - -$(STRESS_RUN): - cd $@; ./run.sh - cd $(PWD) - diff --git a/src/tests/system/libroot/posix/posixtestsuite/NEWS b/src/tests/system/libroot/posix/posixtestsuite/NEWS deleted file mode 100644 index 8760f3ca8b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/NEWS +++ /dev/null @@ -1,29 +0,0 @@ -RELEASE DATES: ---------------- - --June 03, 2005 Version 1.5.1 Released -PTS-1.5.1 has a plenty of AIO interface test additions and bug-fixes by Sebastien Decugis. Also there are a lot of bug fixes by other people. Thanks to Sebastien Decugis and other people for continued support and contributions. -This release has been tested on glibc-2.3.3 and kernel 2.6.10 with libposix-aio-0.3. The test result for this release can be found here: http://posixtest.sourceforge.net/testpass/PTS_1.5.1-2.6.10-PAIO_ia32.htm - - --December 17, 2004 Version 1.5.0 Released -A much anticipated release with plenty of interface test additions and bug-fixes. Added AIO test suite by Laurent Vivier. Special thanks to Sebastien Decugis and Ulrich Drepper for continued support and contributions. Also exciting news about OSDL and Bull integrating PTS into OSDL's Scalable Test Platform (STP). - --July 06, 2004 Version 1.4.3 Released -Here goes posixtest-1.3. Besides many bug fixes, this release includes new pthread test cases (conformance, functional, stress) by Sebastien Decugis and Abhijeet Bisain. Special thanks goes to people who made contributions. And we are glad that PTS is helping kernel, library and application developers and OSDs on their POSIX related work. Please see the release page for downloads and more information. - --May 27, 2004 Version 1.4.2 Released -Posixtestsuite-1.4.2 adds several pthread test cases by Sebastien Decugis. Also there are a lot of bug fixes by Ulrich Drepper and other people. This suite has been run on latest glibc and linux kernel 2.6.5. All the failed cases has been analyzed. Please see the release page for downloads and more information. - --May 01, 2004 Version 1.4.1 Released -posixtestsuite-1.4.1 fixes a bunch of bugs in 1.4.0 version. This release has been tested on glibc-2004-04-29 cvs pull (NPTL enabled) and linux-2.6.5-mm6 kernel.It is noted that "POSIX Message Queues" has been integrated into linux kernel and glibc. Please see the release page for downloads and more information. The test result for this release can be found here: test results - PTS 1.4.1, Kernel 2.6.5-mm6, ia32 . - --April 15, 2004 Version 1.4.0 Released -POSIX Test Suite 1.4.0 includes more pthread conformance test cases. Now we have test cases covering almost all pthread APIs. Conformance test cases for options like CPT, TCT, TMR are also added. There are also a lot of bug fixes made from the previous 1.3.0 version (thanks for Ulrich Drepper's patches and to everyone who made contributions). Please see the release page for downloads and more information. - --March 11, 2004 Test Pass Results - (CVS pull 3-04-04) -POSIX Test Suite test pass results available for [CVS pull 3-04-04, Kernel 2.6.1, libc-2004-02-15 and message queue 4.17 patch on IA64 platform]. The results can be found here: test results - cvs 3-04-04, Kernel 2.6.1, ia64 . - --March 1, 2004 Test Pass Results - (CVS pull 2-20-04) -POSIX Test Suite test pass results available for [CVS pull 2-20-04, Kernel 2.6.1, libc-2004-02-01 and message queue 4.17 patch on IA32 platform]. We are currently in the process of setting up a main test results page, but until then, the results can be found here: test results - cvs 2-20-04, Kernel 2.6.1 . - diff --git a/src/tests/system/libroot/posix/posixtestsuite/QUICK-START b/src/tests/system/libroot/posix/posixtestsuite/QUICK-START deleted file mode 100644 index 46e57b3cfc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/QUICK-START +++ /dev/null @@ -1,65 +0,0 @@ - -QUICK-START -*********** - -So you're in a hurry and don't feel like reading all those docs in the Documentation section that we have worked so hard to write huh? - -No worries! Here's a quick doc to help you around POSIX** Test Suite. - -======================== -Setting up your machine -======================== - -* There is nothing to install, the suite is intended to be run directly. - -* See the "BUILD" file for info on how to set up the Makefile and your developer machine, -depending on what specific area you are concentrating on. -(Signals, Semaphores, Threads, Timers or Message Qs). - -* "LDFLAGS" is a file used by the Makefile to link to what you specify in it. e.g. if you want to link with lpthread, you would open LDFLAGS and insert the line "-lpthread". LDFLAGS has a few -simple examples contained in it. - -=================== -Running the tests -=================== - -* Easiest way to run all the tests is to do a "make" in the top-level directory. - -* To run tests for a specific directory, first export the POSIX_TARGET variable -to the directory you want, then perform a "make". e.g.: - # export POSIX_TARGET=conformance/interfaces/pthread_create - # make - -* An easy way to run all tests specific to your area of focus, run: - - # ./run_tests [MEM|MSG|SEM|SIG|THR|TMR|TPS] - the argument is the 3 letter POSIX abbreviation for area - -* For additional information on how to build and run the tests in this -suite, see Documentation/HOWTO_RunTests. - -========================== -Documentation & Resources -========================== - -POSIX* Test Suite project page: http://posixtest.sf.net - -BUILD - describes how to set up your developer machine to build and test -LDFLAGS - File that Makefile uses to link to what you specify - -The following files give developers information on how to write test -cases for the project (under Documentation): - -HOWTO_Assertions - describes format of the assertions files used to - map test case descriptions to test cases -HOWTO_BoundaryTest - information about testing boundary conditions -HOWTO_CodingGuidelines - describes coding guidelines for this project -HOWTO_Coverage - describes format of COVERAGE. files -HOWTO_DefinitionsTest - ideas behind testing POSIX header files -HOWTO_ResultCodes - standardized return codes for tests -HOWTO_Tagging - describes how to tag files for inclusion in a release -HOWTO_RunTests - describes how to build and run the tests - -** POSIX (R) is a registered trademark of the IEEE - -Maintainer: Ling Yu (ling.l.yu@intel.com) diff --git a/src/tests/system/libroot/posix/posixtestsuite/README b/src/tests/system/libroot/posix/posixtestsuite/README deleted file mode 100644 index d341df794e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/README +++ /dev/null @@ -1,122 +0,0 @@ - -SECTIONS: -1. Open POSIX* Test Suite Overview -2. Design Goals -3. Implementation -4. Developer Docs & Resources -5. How to Contribute -6. Who are you? -7. Disclaimer - - - -1. Open POSIX* Test Suite Overview ------------------------------------ - -The POSIX Test Suite is an open source test suite with the goal of -performing conformance, functional, and stress testing of the IEEE -1003.1-2001 System Interfaces specification in a manner that is -agnostic to any given implementation. - -While active development and testing is currently happening on Linux, -our choice of portable tools should make this test suite usable on any -POSIX operating system. - -All code is distributed under the GNU General Public License v2. A -copy of this license is contained in the COPYING file. - -This document gives a brief overview of the test suite, including its -design goals, implementation, and how to contribute. Within these -sections, we describe where to find more detailed information. - -2. Design Goals ----------------- -This project was created with the following design goals: -- Enable assertion based traceability for conformance testing of POSIX - specifications. We wanted to capture enough data to make deterministic - statements about our coverage of the POSIX specification. - -- Give the ability to send test case source to bug reports to appropriate - open source projects when our test cases revealed bugs in those projects. - (Meaning we wanted fairly simple, self-contained test cases which - illuminated a single failure.) - -- Make it easy for test cases to be contributed. - -3. Implementation ------------------- - -This project will cover conformance, functional, stress, performance, -and speculative testing. Conformance, functional, and stress tests are -the only tests formally documented and enabled by our framework, with our -focus mainly on conformance; however, the other types of testing will be -added as the need arises. - -For more information on these types of testing, under 'Documenation' see: -HOWTO_ConformanceTest - info on creation and structure of conformance tests -HOWTO_Functional- - info on creation and structure of functional - StressTest and stress tests - -For additional information on how to build and run the tests in this -suite, see Documentation/HOWTO_RunTests. - - -4. Developer Docs & Resources ------------------------------- - -The following files give developers information on how to write test -cases for the project (under Documentation): -HOWTO_Assertions - describes format of the assertions files used to - map test case descriptions to test cases -HOWTO_BoundaryTest - information about testing boundary conditions -HOWTO_CodingGuidelines- describes coding guidelines for this project -HOWTO_Coverage - describes format of COVERAGE. files -HOWTO_DefinitionsTest - ideas behind testing POSIX header files -HOWTO_ResultCodes - standardized return codes for tests -HOWTO_Tagging - describes how to tag files for inclusion in a release - -For additional information on how to build and run the tests in this -suite, see HOWTO_RunTests. - -5. How to Contribute ---------------------- - -* Patches welcome! - -* When you create a new test, please fill out an assertion description - if none is available. Create a simple C [.c] or shell script [.sh] - snippet that exploits the assertion and returns 0 or !0 - [passes/fails]. - - Please name the file after the assertion it tests-dash-the number of - the test [up to you, we can do the naming for you also]. - - The code snippets need to be as simple as possible, for the sake of - all. Please start them with a commentary briefly describing how - you will test the assertion. The idea is that at the end, we can have - automatic tools extracting the data from the XML and source files to - generate reports. - - -6. Who are you? ---------------- - -We are the ones currently developing this: - -julie.n.fleischer REMOVE-THIS AT intel DOT com -rusty.lynch REMOVE-THIS AT intel DOT com -geoffrey.r.gustafson REMOVE-THIS AT intel DOT com -inaky.perez-gonzalez REMOVE-THIS AT intel DOT com -rolla.n.selbak REMOVE-THIS AT intel DOT com -majid.awad REMOVE-THIS AT intel DOT com -salwan.searty REMOVE-THIS AT intel DOT com -sunyi REMOVE-THIS AT users DOT sourceforge DOT net - -Some like to say 'Nih!' from time to time ... - - -7. Disclaimer --------------- -The Open POSIX Test Suite is not affiliated with the IEEE or The Open Group. - -* POSIX (R) is a registered trademark of the IEEE diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/1-1.c deleted file mode 100644 index 1efd520ca1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/1-1.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - Test case for assertion #1 of the WIFEXITED macro defined in sys/wait.h - by forking a new process, having the process return -1, and then - verifying WIFEXITED returns a non-zero value. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - if (fork() == 0) { - /* child */ - return -1; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/1-2.c deleted file mode 100644 index a9d104ca09..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/1-2.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - Test case for assertion #1 of the WIFEXITED macro defined in sys/wait.h - by forking a new process, having the process return 0, and verifying - WIFEXITED returns a non-negative value. -*/ - -#include -#include -#include -#include -#include - -int main() -{ - if (fork() == 0) { - /* child */ - return 0; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return -1; - } - - if (WIFEXITED(s)) { - printf("Test PASSED\n"); - return 0; - } - } - - printf("Test FAILED\n"); - return -1; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/1-3.c deleted file mode 100644 index af23ebed20..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/1-3.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - Test case for assertion #1 of the WIFEXITED macro defined in sys/wait.h - by forking a new process, having the child SIGABRT, and verifying - WIFEXITED returns zero. -*/ - -#include -#include -#include -#include -#include - -int main() -{ - if (fork() == 0) { - /* child */ - raise(SIGABRT); - - /* shouldn't get here */ - return 0; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return -1; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return 0; - } - } - - printf("Test FAILED\n"); - return -1; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/assertions.xml deleted file mode 100644 index e6d86ff631..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/WIFEXITED/assertions.xml +++ /dev/null @@ -1,7 +0,0 @@ - - -Evaluates to a non-zero value if status was returned for a child process -that terminated normally. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/timers/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/timers/1-1.c deleted file mode 100644 index 52678fd4b8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/timers/1-1.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that TIMER_MAX timers can be created. - * - * For this test, clock CLOCK_REALTIME will be used. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char *argv[]) -{ - timer_t tid; - int i; - long scTIMER_MAX=0; - - scTIMER_MAX=sysconf(_SC_TIMER_MAX); - - for (i=0; i= _POSIX_TIMER_MAX - * - * For this test, clock CLOCK_REALTIME will be used. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char *argv[]) -{ - long scTIMER_MAX=0; - - scTIMER_MAX=sysconf(_SC_TIMER_MAX); - -#ifdef DEBUG - printf("TIMER_MAX = %ld\n_POSIX_TIMER_MAX=%ld\n", - scTIMER_MAX, (long) _POSIX_TIMER_MAX); -#endif - - if ((scTIMER_MAX != -1) && (scTIMER_MAX < _POSIX_TIMER_MAX)) { - printf("Test FAILED (%ld < %ld)\n", scTIMER_MAX, (long)_POSIX_TIMER_MAX); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/timers/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/timers/assertions.xml deleted file mode 100644 index bd4c2cee76..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/timers/assertions.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - TIMER_MAX in limits.h defines the maximum number of processes that - the implementation supports - - - TIMER_MAX must be >= _POSIX_TIMER_MAX - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/timers/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/timers/coverage.txt deleted file mode 100644 index 16ec132aac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/behavior/timers/coverage.txt +++ /dev/null @@ -1,5 +0,0 @@ -This file defines the coverage for the behavior/timers section. - -ASSERTION COVERED? -1 YES -2 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/1-1.c deleted file mode 100644 index a93da0f6cd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/1-1.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - - /* test if aio.h exists and can be included */ - -#include diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/1-2.c deleted file mode 100644 index d3cc59dce5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/1-2.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - - /* test if struct aiocb is defined in */ - -#include - -struct aiocb dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/2-1.c deleted file mode 100644 index ef0f2c5f86..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/2-1.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - - /* test if aio.h exists and can be included */ - -#include - -int main(void) -{ - struct aiocb aiocb; - struct sigevent sigevent; - - aiocb.aio_fildes = -1; - aiocb.aio_offset = -1; - aiocb.aio_buf = NULL; - aiocb.aio_nbytes = 0; - aiocb.aio_sigevent = sigevent; - aiocb.aio_reqprio = -1; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/3-1.c deleted file mode 100644 index d3a2183260..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/3-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - - /* test if aio.h exists and can be included */ - -#include - -int dummy0 = AIO_ALLDONE; -int dummy1 = AIO_CANCELED; -int dummy2 = AIO_NOTCANCELED; -int dummy3 = LIO_NOP; -int dummy4 = LIO_NOWAIT; -int dummy5 = LIO_READ; -int dummy6 = LIO_WAIT; -int dummy7 = LIO_WRITE; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/4-1.c deleted file mode 100644 index 9d6de6f9d0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/4-1.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#include - -int (*dummy0)(int, struct aiocb *) = aio_cancel; -int (*dummy1)(const struct aiocb *) = aio_error; -int (*dummy2)(int, struct aiocb *) = aio_fsync; -int (*dummy3)(struct aiocb *) = aio_read; -ssize_t (*dummy4)(struct aiocb *) = aio_return; -int (*dummy5)(const struct aiocb *const[], int, - const struct timespec *) = aio_suspend; -int (*dummy6)(struct aiocb *) = aio_write; -int (*dummy7)(int, struct aiocb *const [], - int, struct sigevent *restrict) = lio_listio; - -int main() -{ - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/assertions.xml deleted file mode 100644 index 3e1a19554f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/aio_h/assertions.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - An AIO control block structure aiocb is used in many asynchronous I/O - functions. It is defined in <aio.h> - - - The AIO control block structure aiocb has following members: - int aio_fildes - off_t aio_offset - volatile void* aio_buf - size_t aio_nbytes - int aio_reqprio - struct sigevent aio_sigevent - int aio_lio_opcode - - - The header <aio.h> shakk include following constants: - AIO_ALLDONE - AIO_CANCELED - AIO_NOTCANCELED - LIO_NOP - LIO_NOWAIT - LIO_READ - LIO_WAIT - LIO_WRITE - - - The header <aio.h> shall defines following functions or macros: - int aio_cancel(int, struct aiocb *); - int aio_error(const struct aiocb *); - int aio_fsync(int, struct aiocb *); - int aio_read(struct aiocb *); - ssize_t aio_return(struct aiocb *); - int aio_suspend(const struct aiocb *const[], int, - const struct timespec *); - int aio_write(struct aiocb *); - int lio_listio(int, struct aiocb *restrict const[restrict], - int, struct sigevent *restrict); - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/1-1.c deleted file mode 100644 index 53be2e9456..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/1-1.c +++ /dev/null @@ -1,6 +0,0 @@ -/* - * This test tests if error.h is exist and useble - *author:ysun@lnxw.com - */ - -#include diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/2-1.c deleted file mode 100644 index 9f88113a1c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/2-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - *The header shall provide a - *declaration for errno - *author:ysun@lnxw.com - */ - -#include - -int errno_test; - -int dummyfcn (void) -{ - errno_test = errno; - return 0; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/3-1.c deleted file mode 100644 index 40c8cb39ef..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/3-1.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - *Following symbles need to be defined in errno.h - *author:ysun@lnxw.com - */ - -#include - -int dummy1 = E2BIG; -int dummy2 = EACCES; -int dummy3 = EADDRINUSE ; -int dummy4 = EADDRNOTAVAIL; -int dummy5 = EAFNOSUPPORT; -int dummy6 = EAGAIN; -int dummy7 = EALREADY; -int dummy8 = EBADF; -int dummy9 = EBADMSG; -int dummy10 = EBUSY; -int dummy11 = ECANCELED; -int dummy12 = ECHILD; -int dummy13 = ECONNABORTED; -int dummy14 = ECONNREFUSED; -int dummy15 = ECONNRESET; -int dummy16 = EDEADLK; -int dummy17 = EDESTADDRREQ; -int dummy18 = EDOM; -int dummy19 = EDQUOT; -int dummy20 = EEXIST; -int dummy21 = EFAULT; -int dummy22 = EFBIG; -int dummy23 = EHOSTUNREACH; -int dummy24 = EIDRM; -int dummy25 = EILSEQ; -int dummy26 = EINPROGRESS; -int dummy27 = EINTR; -int dummy28 = EINVAL; -int dummy29 = EIO; -int dummy30 = EISCONN; -int dummy31 = EISDIR; -int dummy32 = ELOOP; -int dummy33 = EMFILE; -int dummy34 = EMLINK; -int dummy35 = EMSGSIZE; -int dummy36 = EMULTIHOP; -int dummy37 = ENAMETOOLONG; -int dummy38 = ENETDOWN; -int dummy39 = ENETRESET; -int dummy40 = ENETUNREACH; -int dummy41 = ENFILE; -int dummy42 = ENOBUFS; -int dummy43 = ENODATA; -int dummy44 = ENODEV; -int dummy45 = ENOENT; -int dummy46 = ENOEXEC; -int dummy47 = ENOLCK; -int dummy48 = ENOLINK; -int dummy49 = ENOMEM; -int dummy50 = ENOMSG; -int dummy51 = ENOPROTOOPT; -int dummy52 = ENOSPC; -int dummy53 = ENOSR; -int dummy54 = ENOSTR; -int dummy55 = ENOSYS; -int dummy56 = ENOTCONN; -int dummy57 = ENOTDIR; -int dummy58 = ENOTEMPTY; -int dummy59 = ENOTSOCK; -int dummy60 = ENOTSUP; -int dummy61 = ENOTTY; -int dummy62 = ENXIO; -int dummy63 = EOPNOTSUPP; -int dummy64 = EOVERFLOW; -int dummy65 = EPERM; -int dummy66 = EPIPE; -int dummy67 = EPROTO; -int dummy68 = EPROTONOSUPPORT; -int dummy69 = EPROTOTYPE; -int dummy70 = ERANGE; -int dummy71 = EROFS; -int dummy72 = ESPIPE; -int dummy73 = ESRCH; -int dummy74 = ESTALE; -int dummy75 = ETIME; -int dummy76 = ETIMEDOUT; -int dummy77 = ETXTBSY; -int dummy78 = EWOULDBLOCK; -int dummy79 = EXDEV; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/3-2.c deleted file mode 100644 index 35d056de3a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/3-2.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The most of error symbles shall have unique value - * I try to test every symble in a loop. There - * are two kind symbles, one have unique value, the others - * can have same value with certain other symbles - * Author:ysun@lnxw.com - */ -#include -#include -#include - -#define PTP_PASS 0 -#define PTP_FAIL 1 -#define PTP_UNRESOLVED 2 -#define PTP_NOTINUSE 3 -#define PTP_UNSUPPORTED 4 -#define PTP_UNTESTED 5 -#define PTP_UNINITIATED 6 -#define PTP_NORESULT 7 - - -struct unique { - int value; - char *name; - int duplicate; -} sym[] = {{E2BIG,"E2BIG",E2BIG},{EACCES,"EACCES",EACCES}, - {EADDRINUSE,"EADDRINUSE",EADDRINUSE}, - {EADDRNOTAVAIL,"EADDRNOTAVAIL",EADDRNOTAVAIL}, - {EAFNOSUPPORT,"EAFNOSUPPORT",EAFNOSUPPORT}, - {EAGAIN,"EAGAIN",EWOULDBLOCK}, - {EALREADY,"EALREADY",EALREADY}, {EBADF,"EBADF",EBADF}, - {EBADMSG,"EBADMSG",EBADMSG},{EBUSY,"EBUSY",EBUSY}, - {ECANCELED,"ECANCELED",ECANCELED},{ECHILD,"ECHILD",ECHILD}, - {ECONNABORTED,"ECONNABORTED",ECONNABORTED}, - {ECONNREFUSED,"ECONNREFUSED",ECONNREFUSED}, - {ECONNRESET,"ECONNRESET",ECONNRESET},{EDEADLK,"EDEADLK",EDEADLK,}, - {EDESTADDRREQ,"EDESTADDRREQ",EDESTADDRREQ},{EDOM,"EDOM",EDOM}, - {EDQUOT,"EDQUOT",EDQUOT},{EEXIST,"EEXIST",EEXIST}, - {EFAULT,"EFAULT",EFAULT},{EFBIG,"EFBIG",EFBIG}, - {EHOSTUNREACH,"EHOSTUNREACH",EHOSTUNREACH}, - {EIDRM,"EIDRM",EIDRM},{EILSEQ,"EILSEQ",EILSEQ}, - {EINPROGRESS,"EINPROGRESS",EINPROGRESS}, - {EINTR,"EINTR",EINTR},{EINVAL,"EINVAL",EINVAL}, - {EIO,"EIO",EIO},{EISCONN,"EISCONN",EISCONN}, - {EISDIR,"EISDIR",EISDIR},{ELOOP,"ELOOP",ELOOP}, - {EMFILE,"EMFILE",EMFILE},{EMLINK,"EMLINK",EMLINK}, - {EMSGSIZE,"EMSGSIZE",EMSGSIZE},{EMULTIHOP,"EMULTIHOP",EMULTIHOP}, - {ENAMETOOLONG,"ENAMETOOLONG",ENAMETOOLONG}, - {ENETDOWN,"ENETDOWN",ENETDOWN}, - {ENETRESET,"ENETRESET",ENETRESET},{ENETUNREACH,"ENETUNREACH",ENETUNREACH}, - {ENFILE,"ENFILE",ENFILE},{ENOBUFS,"ENOBUFS",ENOBUFS}, - {ENODATA,"ENODATA",ENODATA},{ENODEV,"ENODEV",ENODEV}, - {ENOENT,"ENOENT",ENOENT},{ENOEXEC,"ENOEXEC",ENOEXEC}, - {ENOLCK,"ENOLCK",ENOLCK},{ENOLINK,"ENOLINK",ENOLINK}, - {ENOMEM,"ENOMEM",ENOMEM},{ENOMSG,"ENOMSG",ENOMSG}, - {ENOPROTOOPT,"ENOPROTOOPT",ENOPROTOOPT},{ENOSPC,"ENOSPC",ENOSPC}, - {ENOSR,"ENOSR",ENOSR},{ENOSTR,"ENOSTR",ENOSTR}, - {ENOSYS,"ENOSYS",ENOSYS},{ENOTCONN,"ENOTCONN",ENOTCONN}, - {ENOTDIR,"ENOTDIR",ENOTDIR},{ENOTEMPTY,"ENOTEMPTY",ENOTEMPTY}, - {ENOTSOCK,"ENOTSOCK",ENOTSOCK},{ENOTSUP,"ENOTSUP",ENOTSUP}, - {ENOTTY,"ENOTTY",ENOTTY},{ENXIO,"ENXIO",ENXIO}, - {EOPNOTSUPP,"EOPNOTSUPP",EOPNOTSUPP},{EOVERFLOW,"EOVERFLOW",EOVERFLOW}, - {EPERM,"EPERM",EPERM},{EPIPE,"EPIPE",EPIPE},{EPROTO,"EPROTO",EPROTO}, - {EPROTONOSUPPORT,"EPROTONOSUPPORT",EPROTONOSUPPORT}, - {EPROTOTYPE,"EPROTOTYPE",EPROTOTYPE}, - {ERANGE,"ERANGE",ERANGE},{EROFS,"EROFS",EROFS}, - {EWOULDBLOCK,"EWOULDBLOCK",EAGAIN},{EXDEV,"EXDEV",EXDEV}, - {0,0,0} -}; - -int main() { - struct unique *tst; - int i,ret = PTP_PASS; - tst = sym; - - while (tst->name) { - for(i = 0; sym[i].name; i++) { - if (tst->value == sym[i].value - && tst->duplicate != sym[i].value - && strcmp(tst->name,sym[i].name)) {//In case EAGAIN is not equal to EWOULDBLOCK,compare the name - printf("%s has a duplicate value with %s\n", - tst->name,sym[i].name); - ret = PTP_FAIL; - } - } - tst++; - } - return ret; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/4-1.c deleted file mode 100644 index 017f6009f1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/4-1.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - *errno.h shall give positive values for the - *error number symbolic constants - *author:ysun@lnxw.com - */ -#include -#include -#define PTP_PASS 0 -#define PTP_FAIL 1 -#define PTP_UNRESOLVED 2 -#define PTP_NOTINUSE 3 -#define PTP_UNSUPPORTED 4 -#define PTP_UNTESTED 5 -#define PTP_UNINITIATED 6 -#define PTP_NORESULT 7 - - - -struct unique { - int value; - char *name; -} sym[] = {{E2BIG,"E2BIG"},{EACCES,"EACCES"}, - {EADDRINUSE,"EADDRINUSE"}, - {EADDRNOTAVAIL,"EADDRNOTAVAIL"}, - {EAFNOSUPPORT,"EAFNOSUPPORT"}, - {EAGAIN,"EAGAIN"}, - {EALREADY,"EALREADY"}, {EBADF,"EBADF"}, - {EBADMSG,"EBADMSG"},{EBUSY,"EBUSY"}, - {ECANCELED,"ECANCELED"},{ECHILD,"ECHILD"}, - {ECONNABORTED,"ECONNABORTED"}, - {ECONNREFUSED,"ECONNREFUSED"}, - {ECONNRESET,"ECONNRESET"},{EDEADLK,"EDEADLK"}, - {EDESTADDRREQ,"EDESTADDRREQ"},{EDOM,"EDOM"}, - {EDQUOT,"EDQUOT"},{EEXIST,"EEXIST"}, - {EFAULT,"EFAULT"},{EFBIG,"EFBIG"}, - {EHOSTUNREACH,"EHOSTUNREACH"}, - {EIDRM,"EIDRM"},{EILSEQ,"EILSEQ"}, - {EINPROGRESS,"EINPROGRESS"}, - {EINTR,"EINTR"},{EINVAL,"EINVAL"}, - {EIO,"EIO"},{EISCONN,"EISCONN"}, - {EISDIR,"EISDIR"},{ELOOP,"ELOOP"}, - {EMFILE,"EMFILE"},{EMLINK,"EMLINK"}, - {EMSGSIZE,"EMSGSIZE"},{EMULTIHOP,"EMULTIHOP"}, - {ENAMETOOLONG,"ENAMETOOLONG"}, - {ENETDOWN,"ENETDOWN"}, - {ENETRESET,"ENETRESET"},{ENETUNREACH,"ENETUNREACH"}, - {ENFILE,"ENFILE"},{ENOBUFS,"ENOBUFS"}, - {ENODATA,"ENODATA"},{ENODEV,"ENODEV"}, - {ENOENT,"ENOENT"},{ENOEXEC,"ENOEXEC"}, - {ENOLCK,"ENOLCK"},{ENOLINK,"ENOLINK"}, - {ENOMEM,"ENOMEM"},{ENOMSG,"ENOMSG"}, - {ENOPROTOOPT,"ENOPROTOOPT"},{ENOSPC,"ENOSPC"}, - {ENOSR,"ENOSR"},{ENOSTR,"ENOSTR"}, - {ENOSYS,"ENOSYS"},{ENOTCONN,"ENOTCONN"}, - {ENOTDIR,"ENOTDIR"},{ENOTEMPTY,"ENOTEMPTY"}, - {ENOTSOCK,"ENOTSOCK"},{ENOTSUP,"ENOTSUP"}, - {ENOTTY,"ENOTTY"},{ENXIO,"ENXIO"}, - {EOPNOTSUPP,"EOPNOTSUPP"},{EOVERFLOW,"EOVERFLOW"}, - {EPERM,"EPERM"},{EPIPE,"EPIPE"},{EPROTO,"EPROTO"}, - {EPROTONOSUPPORT,"EPROTONOSUPPORT"}, - {EPROTOTYPE,"EPROTOTYPE"}, - {ERANGE,"ERANGE"},{EROFS,"EROFS"}, - {EWOULDBLOCK,"EWOULDBLOCK"},{EXDEV,"EXDEV"}, - {0,0} -}; -int main() { - struct unique *tst=sym; - int ret = PTP_PASS; - while(tst->name){ - if (tst->value < 0){ - printf("Value of symbol %s is less than zero\n",tst->name); - ret = PTP_FAIL; - } - tst++; - } - return ret; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/assertions.xml deleted file mode 100644 index 55c6a9fba8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/errno_h/assertions.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - The errno.h header file exists. - - - The errno.h header shall provide a declaration for errno - - - All values listed in this section shall be unique integer constant - expressions with type int suitable for - use in #if preprocessing directives. - [E2BIG] - [EACCES] - [EADDRINUSE] - [EADDRNOTAVAIL] - [EAFNOSUPPORT] - [EAGAIN] - [EALREADY] - [EBADF] - [EBADMSG] - [EBUSY] - [ECANCELED] - [ECHILD] - [ECONNABORTED] - [ECONNREFUSED] - [ECONNRESET] - [EDEADLK] - [EDESTADDRREQ] - [EDOM] - [EDQUOT] - [EEXIST] - [EFAULT] - [EFBIG] - [EHOSTUNREACH] - [EIDRM] - [EILSEQ] - [EINPROGRESS] - [EINTR] - [EINVAL] - [EIO] - [EISCONN] - [EISDIR] - [ELOOP] - [EMFILE] - [EMLINK] - [EMSGSIZE] - [EMULTIHOP] - [ENAMETOOLONG] - [ENETDOWN] - [ENETRESET] - [ENETUNREACH] - [ENFILE] - [ENOBUFS] - [ENODATA] - [ENODEV] - [ENOENT] - [ENOEXEC] - [ENOLCK] - [ENOLINK] - [ENOMEM] - [ENOMSG] - [ENOPROTOOPT] - [ENOSPC] - [ENOSR] - [ENOSTR] - [ENOSYS] - [ENOTCONN] - [ENOTDIR] - [ENOTEMPTY] - [ENOTSOCK] - [ENOTSUP] - [ENOTTY] - [ENXIO] - [EOPNOTSUPP] - [EOVERFLOW] - [EPERM] - [EPIPE] - [EPROTO] - [EPROTONOSUPPORT] - [EPROTOTYPE] - [ERANGE] - [EROFS] - [ESPIPE] - [ESRCH] - [ESTALE] - [ETIME] - [ETIMEDOUT] - [ETXTBSY] - [EWOULDBLOCK] - [EXDEV] - - - errno.h shall give positive values for the following symbolic constants - [E2BIG] - [EACCES] - [EADDRINUSE] - [EADDRNOTAVAIL] - [EAFNOSUPPORT] - [EAGAIN] - [ELREADY] - [EBADF] - [EBADMSG] - [EBUSY] - [ECANCELED] - [ECHILD] - [ECONNABORTED] - [ECONNREFUSED] - [ECONNRESET] - [EDEADLK] - [EDESTADDRREQ] - [EDOM] - [EDQUOT] - [EEXIST] - [EFAULT] - [EFBIG] - [EHOSTUNREACH] - [EIDRM] - [EILSEQ] - [EINPROGRESS] - [EINTR] - [EINVAL] - [EIO] - [EISCONN] - [EISDIR] - [ELOOP] - [EMFILE] - [EMLINK] - [EMSGSIZE] - [EMULTIHOP] - [ENAMETOOLONG] - [ENETDOWN] - [ENETRESET] - [ENETUNREACH] - [ENFILE] - [ENOBUFS] - [ENODATA] - [ENODEV] - [ENOENT] - [ENOEXEC] - [ENOLCK] - [ENOLINK] - [ENOMEM] - [ENOMSG] - [ENOPROTOOPT] - [ENOSPC] - [ENOSR] - [ENOSTR] - [ENOSYS] - [ENOTCONN] - [ENOTDIR] - [ENOTEMPTY] - [ENOTSOCK] - [ENOTSUP] - [ENOTTY] - [ENXIO] - [EOPNOTSUPP] - [EOVERFLOW] - [EPERM] - [EPIPE] - [EPROTO] - [EPROTONOSUPPORT] - [EPROTOTYPE] - [ERANGE] - [EROFS] - [ESPIPE] - [ESRCH] - [ESTALE] - [ETIME] - [ETIMEDOUT] - [ETXTBSY] - [EWOULDBLOCK] - [EXDEV] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/1-1.c deleted file mode 100644 index bdefbc4d95..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/1-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - Test for the existance and valid format - of the mq_attr structure as specified on - line 9678 of the Base Definitions document -*/ - -#include -#include "posixtest.h" -#include - -int main() -{ - fprintf(stderr, "Not Implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/10-1.c deleted file mode 100644 index 76f2e820e6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/10-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - Test for the existance and valid prototype - of the mq_timedsend function as specified on - line 9694 of the Base Definitions document -*/ - -#include -#include "posixtest.h" -#include - -int main() -{ - fprintf(stderr, "Test not implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/11-1.c deleted file mode 100644 index 8ee7d6efc6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/11-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* -Test for the existance and valid prototype -of the mq_unlink function as specified on -line 9696 of the Base Definitions document -*/ - -#include -#include "posixtest.h" -#include - -int main() -{ - fprintf(stderr, "Test not implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/2-1.c deleted file mode 100644 index d6614c12d1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/2-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - Test for the existance and valid prototype - of the mq_close function as specified on - line 9684 of the Base Definitions document -*/ - -#include -#include "posixtest.h" -#include - -int main() -{ - fprintf(stderr, "Test not implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/3-1.c deleted file mode 100644 index 6cae3a05cd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/3-1.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "posixtest.h" -#include - -/* - Test for the existance and valid prototype - of the mq_getattr function as specified on - line 9685 of the Base Definitions document -*/ - -int main() -{ - fprintf(stderr, "Test not implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/4-1.c deleted file mode 100644 index 44cca9b27c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/4-1.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include "posixtest.h" -#include -/* - Test for the existance and valid prototype - of the mq_notify function as specified on - line 9686 of the Base Definitions document -*/ - -int main() -{ - fprintf(stderr, "Test not implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/5-1.c deleted file mode 100644 index 6da6f415d4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/5-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - Test for the existance and valid prototype - of the mq_open function as specified on - line 9687 of the Base Definitions document -*/ - -#include -#include "posixtest.h" -#include - -int main() -{ - fprintf(stderr, "Test not implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/6-1.c deleted file mode 100644 index 6a0c3d7fd6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/6-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - Test for the existance and valid prototype - of the mq_receive function as specified on - line 9688 of the Base Definitions document -*/ - -#include -#include "posixtest.h" -#include - -int main() -{ - fprintf(stderr, "Test not implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/7-1.c deleted file mode 100644 index 19326d7048..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/7-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - Test for the existance and valid prototype - of the mq_send function as specified on - line 9689 of the Base Definitions document -*/ - -#include -#include "posixtest.h" -#include - -int main() -{ - fprintf(stderr, "Test not implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/8-1.c deleted file mode 100644 index 0bb87c4a84..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/8-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - Test for the existance and valid prototype - of the mq_setattr function as specified on - line 9690 of the Base Definitions document -*/ - -#include -#include "posixtest.h" -#include - -int main() -{ - fprintf(stderr, "Test not implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/9-1.c deleted file mode 100644 index 971817e540..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/9-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - Test for the existance and valid prototype - of the mq_timedreceive function as specified on - line 9692 of the Base Definitions document -*/ - -#include -#include "posixtest.h" -#include - -int main() -{ - fprintf(stderr, "Test not implemented!\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/assertions.xml deleted file mode 100644 index 7f58d23fda..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/mqueue_h/assertions.xml +++ /dev/null @@ -1,32 +0,0 @@ - - -A valid mq_attr structure is defined. - - -A valid mq_close function is defined. - - -A valid mq_getattr function is defined. - - -A valid mq_notify function is defined. - - -A valid mq_open function is defined. - - -A valid mq_receive function is defined. - - -A valid mq_send function is defined. - - -A valid mq_setattr function is defined. - - -A valid mq_timedreceive function is defined. - - -A valid mq_timedsend function is defined. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/1-1.c deleted file mode 100644 index 749d289efa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/1-1.c +++ /dev/null @@ -1,13 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test the header file pthread.h exists and can be included - */ - -#include - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/10.c deleted file mode 100644 index d94c38ed7c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/10.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_attr_init(pthread_attr_t *); - */ - -#include - -pthread_attr_t a; - -void dummy_func () -{ - pthread_attr_init(&a); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/11-1.c deleted file mode 100644 index ab24cab7b6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/11-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_attr_destroy(pthread_attr_t *); - */ - -#include - -pthread_attr_t a; - -void dummy_func () -{ - pthread_attr_destroy(&a); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/12-1.c deleted file mode 100644 index 521896399a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/12-1.c +++ /dev/null @@ -1,25 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_attr_getdetachstate(const pthread_attr_t *, int *); - */ - -#include - - -pthread_attr_t a; -int *detachstate; - -void dummy_func () -{ - - pthread_attr_getdetachstate(&a, detachstate); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/13-1.c deleted file mode 100644 index 3ae23d2316..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/13-1.c +++ /dev/null @@ -1,24 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_attr_setdetachstate(const pthread_attr_t *, int); - */ - -#include - - -pthread_attr_t a; - -void dummy_func () -{ - - pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/14-1.c deleted file mode 100644 index 7ea43b6408..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/14-1.c +++ /dev/null @@ -1,25 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_mutex_init(pthread_mutex_t *restrict, const pthread_mutexattr_t - *restrict); - */ - -#include - - -pthread_mutex_t a; - -void dummy_func () -{ - - pthread_mutex_init(&a, NULL); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/15-1.c deleted file mode 100644 index 9671d1798d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/15-1.c +++ /dev/null @@ -1,24 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_mutex_destroy(pthread_mutex_t *); - */ - -#include - - -pthread_mutex_t a; - -void dummy_func () -{ - - pthread_mutex_destroy(&a); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/16-1.c deleted file mode 100644 index c7336e6f74..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/16-1.c +++ /dev/null @@ -1,24 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_mutex_lock(pthread_mutex_t *); - */ - -#include - - -pthread_mutex_t a; - -void dummy_func () -{ - - pthread_mutex_lock(&a); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/17-1.c deleted file mode 100644 index 44b277cee4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/17-1.c +++ /dev/null @@ -1,24 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_mutex_trylock(pthread_mutex_t *); - */ - -#include - - -pthread_mutex_t a; - -void dummy_func () -{ - - pthread_mutex_trylock(&a); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/18-1.c deleted file mode 100644 index 0118066092..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/18-1.c +++ /dev/null @@ -1,24 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_mutex_unlock(pthread_mutex_t *); - */ - -#include - - -pthread_mutex_t a; - -void dummy_func () -{ - - pthread_mutex_unlock(&a); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/19-1.c deleted file mode 100644 index 25c8f8f65c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/19-1.c +++ /dev/null @@ -1,24 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_mutexattr_init(pthread_mutexattr_t *); - */ - -#include - - -pthread_mutexattr_t a; - -void dummy_func () -{ - - pthread_mutexattr_init(&a); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/2-1.c deleted file mode 100644 index c161e4a0bf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/2-1.c +++ /dev/null @@ -1,68 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test the following symbols are defined by pthread.h - */ - -#include - -#ifndef PTHREAD_CANCEL_ASYNCHRONOUS -#error PTHREAD_CANCEL_ASYNCHRONOUS not defined -#endif - -#ifndef PTHREAD_CANCEL_ENABLE -#error PTHREAD_CANCEL_ENABLE not defined -#endif - -#ifndef PTHREAD_CANCEL_DEFERRED -#error PTHREAD_CANCEL_DEFERRED not defined -#endif - -#ifndef PTHREAD_CANCEL_DISABLE -#error PTHREAD_CANCEL_DISABLE not defined -#endif - -#ifndef PTHREAD_CANCELED -#error PTHREAD_CANCELED not defined -#endif - -#ifndef PTHREAD_COND_INITIALIZER -#error PTHREAD_COND_INTIALIZER not defined -#endif - -#ifndef PTHREAD_CREATE_DETACHED -#error PTHREAD_CREATE_DETACHED not defined -#endif - -#ifndef PTHREAD_CREATE_JOINABLE -#error PTHREAD_CREATE_JOINABLE not defined -#endif - -#ifndef PTHREAD_EXPLICIT_SCHED -#error PTHREAD_EXPLICIT_SCHED not defined -#endif - -#ifndef PTHREAD_INHERIT_SCHED -#error PTHREAD_INHERIT_SCHED not defined -#endif - -#ifndef PTHREAD_MUTEX_INITIALIZER -#error PTHREAD_MUTEX_INITIALIZED not defined -#endif - -#ifndef PTHREAD_ONCE_INIT -#error PTHREAD_ONCE_INIT not defined -#endif - -#ifndef PTHREAD_PROCESS_SHARED -#error PTHREAD_PROCESS_SHARED not defined -#endif - -#ifndef PTHREAD_PROCESS_PRIVATE -#error PTHREAD_PROCESS_PRIVATE not defined -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/2-2.c deleted file mode 100644 index 65300d7cbf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/2-2.c +++ /dev/null @@ -1,63 +0,0 @@ - - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test the following symbols are defined by pthread.h - */ - -#include - -/* BAR */ -#ifndef PTHREAD_BARRIER_SERIAL_THREAD -#error PTHREAD_BARRIER_SERIAL_THREAD not defined -#endif - -/* XSI */ -#ifndef PTHREAD_MUTEX_DEFAULT -#error PTHREAD_MUTEX_DEFAULT not defined -#endif - -/* XSI */ -#ifndef PTHREAD_MUTEX_ERRORCHECK -#error PTHREAD_MUTEX_ERRORCHECK not defined -#endif - -/* XSI */ -#ifndef PTHREAD_MUTEX_NORMAL -#error PTHREAD_MUTEX_NORMAL not defined -#endif - -/* XSI */ -#ifndef PTHREAD_MUTEX_RECURSIVE -#error PTHREAD_MUTEX_RECURSIVE not defined -#endif - -/* TPP|TPI */ -#ifndef PTHREAD_PRIO_INHERIT -#error PTHREAD_PRIO_INHERIT not defined -#endif - -/* TPP|TPI */ -#ifndef PTHREAD_PRIO_NONE -#error PTHREAD_PRIO_NONE not defined -#endif - -/* TPP|TPI */ -#ifndef PTHREAD_PRIO_PROTECT -#error PTHREAD_PRIO_PROTECT not defined -#endif - -/* TPS */ -#ifndef PTHREAD_SCOPE_PROCESS -#error PTHREAD_SCOPE_PROCESS not defined -#endif - -/* TPS */ -#ifndef PTHREAD_SCOPE_SYSTEM -#error PTHREAD_SCOPE_SYSTEM not defined -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/20-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/20-1.c deleted file mode 100644 index 9fef0dcbf1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/20-1.c +++ /dev/null @@ -1,24 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_mutexattr_destroy(pthread_mutexattr_t *); - */ - -#include - - -pthread_mutexattr_t a; - -void dummy_func () -{ - - pthread_mutexattr_destroy(&a); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-1.c deleted file mode 100644 index dda5018a35..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-1.c +++ /dev/null @@ -1,14 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_attr_t - */ - -#include - -pthread_attr_t dummy; - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-10.c deleted file mode 100644 index 684dedfcca..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-10.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_rwlock_t - */ - -#include - -pthread_rwlock_t dummy; - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-11.c deleted file mode 100644 index 245c2e9d4c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-11.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_rwlockattr_t - */ - -#include - -pthread_rwlockattr_t dummy; - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-12.c deleted file mode 100644 index 2e61f37b4f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-12.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_spinlock_t - SPI - */ - -#include - -pthread_spinlock_t dummy; - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-13.c deleted file mode 100644 index 2994f3cd40..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-13.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_t - */ - -#include - -pthread_t dummy; - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-2.c deleted file mode 100644 index 2d086e84df..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-2.c +++ /dev/null @@ -1,14 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_barrier_t - BAR - */ - -#include - -pthread_barrier_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-3.c deleted file mode 100644 index 828af058e3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-3.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_barrierattr_t - BAR - */ - -#include - -pthread_barrierattr_t dummy; - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-4.c deleted file mode 100644 index 94b6435533..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-4.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_cond_t - */ - -#include - -pthread_cond_t dummy; - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-5.c deleted file mode 100644 index d78f5a26c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-5.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_condattr_t - */ - -#include - -pthread_condattr_t dummy; - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-6.c deleted file mode 100644 index edb73924e2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-6.c +++ /dev/null @@ -1,14 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_key_t - */ - -#include - -pthread_key_t dummy; - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-7.c deleted file mode 100644 index c2e9551ec4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-7.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_mutex_t - */ - -#include - -pthread_mutex_t dummy; - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-8.c deleted file mode 100644 index 8cddd611a4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-8.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_mutexattr_t - */ - -#include - -pthread_mutexattr_t dummy; - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-9.c deleted file mode 100644 index df12d2827c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/3-9.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_once_t - */ - -#include - -pthread_once_t dummy; - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/4-1.c deleted file mode 100644 index b5220f2657..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/4-1.c +++ /dev/null @@ -1,29 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, - void *(*)(void *), void *restrict); - */ - -#include - -void * thread_function(void * arg) -{ - return NULL; -} - -void dummy_func() -{ - pthread_t a_thread; - - pthread_create(&a_thread, NULL, thread_function, NULL); - - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/5-1.c deleted file mode 100644 index 0860e5a413..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/5-1.c +++ /dev/null @@ -1,20 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - void pthread_exit(void *); - */ - -#include - -void dummy_func () -{ - pthread_exit(NULL); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/6-1.c deleted file mode 100644 index f5fcfdf718..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/6-1.c +++ /dev/null @@ -1,21 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - pthread_t pthread_self(void); - */ - -#include - -void dummy_func () -{ - pthread_t ptid = pthread_self(); - if (ptid == 0) - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/7-1.c deleted file mode 100644 index aa1c7d0f49..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/7-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_equal(pthread_t, pthread_t); - */ - -#include - -pthread_t a,b; -int tmp; - -void dummy_func () -{ - tmp = pthread_equal(a,b); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/8-1.c deleted file mode 100644 index 8b998734fc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/8-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_join(pthread_t, void **); - */ - -#include - -pthread_t a; - -void dummy_func () -{ - pthread_join(a,NULL); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/9-1.c deleted file mode 100644 index e28e65d9b8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/9-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test this function is defined: - - int pthread_detach(pthread_t); - */ - -#include - -pthread_t a; - -void dummy_func () -{ - pthread_detach(a); - return; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/assertions.xml deleted file mode 100644 index 492fa17a6b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/assertions.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - The pthread.h file exists and can be included. - - - pthread.h header shall define the following symbols - - PTHREAD_BARRIER_SERIAL_THREAD BAR - PTHREAD_CANCEL_ASYNCHRONOUS - PTHREAD_CANCEL_ENABLE - PTHREAD_CANCEL_DEFERRED - PTHREAD_CANCEL_DISABLE - PTHREAD_CANCELED - PTHREAD_COND_INITIALIZER - PTHREAD_CREATE_DETACHED - PTHREAD_CREATE_JOINABLE - PTHREAD_EXPLICIT_SCHED - PTHREAD_INHERIT_SCHED - PTHREAD_MUTEX_DEFAULT XSI - PTHREAD_MUTEX_ERRORCHECK XSI - PTHREAD_MUTEX_INITIALIZER - PTHREAD_MUTEX_NORMAL XSI - PTHREAD_MUTEX_RECURSIVE XSI - PTHREAD_ONCE_INIT - PTHREAD_PRIO_INHERIT TPP|TPI - PTHREAD_PRIO_NONE TPP|TPI - PTHREAD_PRIO_PROTECT TPP|TPI - PTHREAD_PROCESS_SHARED - PTHREAD_PROCESS_PRIVATE - PTHREAD_SCOPE_PROCESS TPS - PTHREAD_SCOPE_SYSTEM TPS - - - Type 'pthread_attr_t' shall be defined as described in sys/types.h - Type 'pthread_barrier_t' shall be defined as described in sys/types.h - Type 'pthread_barrierattr_t' shall be defined as described in sys/types.h - Type 'pthread_cond_t' shall be defined as described in sys/types.h - Type 'pthread_condattr_t' shall be defined as described in sys/types.h - Type 'pthread_key_t' shall be defined as described in sys/types.h - Type 'pthread_mutex_t' shall be defined as described in sys/types.h - Type 'pthread_mutexattr_t' shall be defined as described in sys/types.h - Type 'pthread_once_t' shall be defined as described in sys/types.h - Type 'pthread_rwlock_t' shall be defined as described in sys/types.h - Type 'pthread_rwlockattr_t' shall be defined as described in sys/types.h - Type 'pthread_spinlock_t' shall be defined as described in sys/types.h - Type 'pthread_t' shall be defined as described in sys/types.h - - - This function is defined: - pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, - void *(*)(void *), void *restrict); - - - This function is defined: - void pthread_exit(void *); - - - This function is defined: - pthread_t pthread_self(void); - - - This function is defined: - int pthread_equal(pthread_t, pthread_t); - - - This function is defined: - int pthread_join(pthread_t, void **); - - - This function is defined: - int pthread_detach(pthread_t); - - - This function is defined: - int pthread_attr_init(pthread_attr_t *); - - - This function is defined: - int pthread_attr_destroy(pthread_attr_t *); - - - This function is defined: - int pthread_attr_getdetachstate(const pthread_attr_t *, int *); - - - This function is defined: - int pthread_attr_setdetachstate(pthread_attr_t *, int); - - - This function is defined: - int pthread_mutex_init(pthread_mutex_t *restrict, const pthread_mutexattr_t - *restrict); - - - This function is defined: - int pthread_mutex_destroy(pthread_mutex_t *); - - - This function is defined: - int pthread_mutex_lock(pthread_mutex_t *); - - - This function is defined: - int pthread_mutex_trylock(pthread_mutex_t *); - - - This function is defined: - int pthread_mutex_unlock(pthread_mutex_t *); - - - This function is defined: - int pthread_mutexattr_init(pthread_mutexattr_t *); - - - This function is defined: - int pthread_mutexattr_destroy(pthread_mutexattr_t *); - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/coverage.txt deleted file mode 100644 index 683201422d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/pthread_h/coverage.txt +++ /dev/null @@ -1,30 +0,0 @@ -This document defines the coverage for -conformance/definitions/pthread_h -testing - - -Assertion # Covered? Notes -1 YES -2 YES The symbols with tags associated with them - usually fail on my implementaion of linux (e.g. - BAR, XSI, etc.) -3 YES #2,3,10,11,12 fail on my implemention of linux - #2 and 3 with BAR tag, #12 with - SPI tag, and #11 and 12 with no tag. -4 YES -5 YES -6 YES -7 YES -8 YES -9 YES -10 YES -11 YES -12 YES -13 YES -14 YES -15 YES -16 YES -17 YES -18 YES -19 YES -20 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/1-1.c deleted file mode 100644 index dfb52b91d6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/1-1.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test the existence of the sched.h file and that it can be included. - */ - -#include diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/10-1.c deleted file mode 100644 index 179a502e7d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/10-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * The policies symbols shall have unique value - * I try to test every symbol in a loop. - */ -#include -#include -#include -#include -#include "posixtest.h" - -struct unique { - int value; - char *name; -} sym[] = { - - { - SCHED_FIFO, "SCHED_FIFO" - }, - { - SCHED_RR, "SCHED_RR" - }, -#if defined(_POSIX_SPORADIC_SERVER) || defined(_POSIX_THREAD_SPORADIC_SERVER) - { - SCHED_SPORADIC,"SCHED_SPORADIC" - }, -#endif - { - SCHED_OTHER, "SCHED_OTHER" - }, - { - 0, 0 - } -}; - -int main() -{ - struct unique *tst; - int i, ret = PTS_PASS; - tst = sym; - - while (tst->name) { - for (i = 0; sym[i].name; i++) { - if (tst->value == sym[i].value - && strcmp(tst->name, sym[i].name)) { - printf("%s has a duplicate value with %s\n", - tst->name, sym[i].name); - ret = PTS_FAIL; - } - } - tst++; - } - return ret; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/11-1.c deleted file mode 100644 index 76ff05ec71..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/11-1.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the function: - * int sched_get_priority_max(int); - * is declared. - */ - -#include - -typedef int (*sched_get_priority_max_test) (int); - -int dummyfcn(void) -{ - sched_get_priority_max_test dummyvar; - dummyvar = sched_get_priority_max; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/12-1.c deleted file mode 100644 index 4ad5d926a0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/12-1.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the function: - * int sched_get_priority_min(int); - * is declared. - */ - -#include - -typedef int (*sched_get_priority_min_test) (int); - -int dummyfcn(void) -{ - sched_get_priority_min_test dummyvar; - dummyvar = sched_get_priority_min; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/13-1.c deleted file mode 100644 index 910a1517c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/13-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the function: - * int sched_getparam(pid_t, struct sched_param *); - * is declared. - */ - -#include -#include - -typedef int (*sched_getparam_test) (pid_t, struct sched_param *); - -int dummyfcn(void) -{ - sched_getparam_test dummyvar; - dummyvar = sched_getparam; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/14-1.c deleted file mode 100644 index 3b8dc67c74..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/14-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the function: - * int sched_getscheduler(pid_t); - * is declared. - */ - -#include -#include - -typedef int (*sched_getscheduler_test) (pid_t); - -int dummyfcn(void) -{ - sched_getscheduler_test dummyvar; - dummyvar = sched_getscheduler; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/15-1.c deleted file mode 100644 index dbcae14bf6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/15-1.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the function: - * int sched_rr_get_interval(pid_t, struct timespec *); - * is declared. - */ - -#include -#include -#include - -typedef int (*sched_rr_get_interval_test) (pid_t, struct timespec *); - -int dummyfcn(void) -{ - sched_rr_get_interval_test dummyvar; - dummyvar = sched_rr_get_interval; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/16-1.c deleted file mode 100644 index a020cbaa96..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/16-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the function: - * int sched_setparam(pid_t, const struct sched_param *); - * is declared. - */ - -#include -#include - -typedef int (*sched_setparam_test) (pid_t, const struct sched_param *); - -int dummyfcn(void) -{ - sched_setparam_test dummyvar; - dummyvar = sched_setparam; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/17-1.c deleted file mode 100644 index 08a002252f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/17-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the function: - * int sched_setscheduler(pid_t, int, const struct sched_param *); - * is declared. - */ - -#include -#include - -typedef int (*sched_setscheduler_test) (pid_t, int, const struct sched_param *); - -int dummyfcn(void) -{ - sched_setscheduler_test dummyvar; - dummyvar = sched_setscheduler; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/18-1.c deleted file mode 100644 index 54142d4f46..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/18-1.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the function: - * int sched_yield(void); - * is declared. - */ - -#include - -typedef int (*sched_yield_test) (void); - -int dummyfcn(void) -{ - sched_yield_test dummyvar; - dummyvar = sched_yield; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/19-1.c deleted file mode 100644 index 17c4c12381..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/19-1.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that inclusion of sched.h makes visible all symbols in time.h. - * - * NOTE - THIS TEST CASE IS NOT COMPLETE. NEEDS TO GROW MUCH LARGER - * see posixtestsuite / conformance / definitions / signal_h / 50-1.c - */ - -#include - -struct tm *mytime; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/2-1.c deleted file mode 100644 index 441506b7ad..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/2-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_param structure is declared and includes at a minimum: - * int sched_priority - */ -#include - -struct sched_param this_type_should_exist, s; - -int dummyfcn(void) -{ - s.sched_priority = 0; - - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/3-1.c deleted file mode 100644 index 06f500a711..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/3-1.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that when _POSIX_SPORADIC_SERVER is defined, sched_param structure - * includes the following: - * int sched_ss_low_priority - * struct timespec sched_ss_repl_period - * struct timespec sched_ss_init_budget - * int sched_ss_max_repl -*/ -#include -#include - -#ifdef _POSIX_SPORADIC_SERVER - -struct sched_param s; - -int dummyfcn(void) -{ - struct timespec ss_repl_period, ss_init_budget; - - s.sched_ss_low_priority = 0; - ss_repl_period = s.sched_ss_repl_period; - ss_init_budget = s.sched_ss_init_budget; - s.sched_ss_max_repl = 0; - - return 0; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/4-1.c deleted file mode 100644 index 7a5de7f280..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/4-1.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that when _POSIX_THREAD_SPORADIC_SERVER is defined, - * sched_param structure includes the following: - * int sched_ss_low_priority - * struct timespec sched_ss_repl_period - * struct timespec sched_ss_init_budget - * int sched_ss_max_repl -*/ -#include -#include - -#ifdef _POSIX_THREAD_SPORADIC_SERVER - -struct sched_param s; - -int dummyfcn(void) -{ - struct timespec ss_repl_period, ss_init_budget; - - s.sched_ss_low_priority = 0; - ss_repl_period = s.sched_ss_repl_period; - ss_init_budget = s.sched_ss_init_budget; - s.sched_ss_max_repl = 0; - - return 0; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-1.c deleted file mode 100644 index 96dccbaae1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-1.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that SCHED_FIFO is defined - */ - -#include - -#ifndef SCHED_FIFO -#error SCHED_FIFO not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-2.c deleted file mode 100644 index f8a5d9f4f2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-2.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that SCHED_RR is defined - */ - -#include - -#ifndef SCHED_RR -#error SCHED_RR not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-3.c deleted file mode 100644 index 8dde471dec..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-3.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * @pt:SS - * @pt:TSP - * Test that SCHED_SPORADIC is defined - */ - -#include - -#ifndef SCHED_SPORADIC -#error SCHED_SPORADIC not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-4.c deleted file mode 100644 index 3988c1b090..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/8-4.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that SCHED_OTHER is defined - */ - -#include - -#ifndef SCHED_OTHER -#error SCHED_OTHER not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/assertions.xml deleted file mode 100644 index 0bea4ed82b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/assertions.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - The sched.h header file exists - - - The sched.h header defines the structure sched_param which includes - the following, at a minimum: - int sched_priority - - - When _POSIX_SPORADIC_SERVER is defined, the structure sched_param - shall also include the following: - int sched_ss_low_priority - struct timespec sched_ss_repl_period - struct timespec sched_ss_init_budget - int sched_ss_max_repl - - - When _POSIX_THREAD_SPORADIC_SERVER is defined, the structure - sched_param shall also includes the following: - int sched_ss_low_priority - struct timespec sched_ss_repl_period - struct timespec sched_ss_init_budget - int sched_ss_max_repl - - - Each process is controlled by an associated scheduling policy - and priority - - - Associated with each policy is a priority range - - - Each policy definition specifies the minimum priority range for that - policy - - - The symbolic constants below are defining the four standard policies: - SCHED_FIFO - SCHED_RR - SCHED_SPORADIC (SS, TSP) - SCHED_OTHER - - - Other policies may be defined by the implementation. - - - The symbolic constants defined below have all distinct values - SCHED_FIFO - SCHED_RR - SCHED_SPORADIC (SS, TSP) - SCHED_OTHER - - - This function is defined: - int sched_get_priority_max(int); - - - This function is defined: - int sched_get_priority_min(int); - - - This function is defined: - int sched_getparam(pid_t, struct sched_param *); - - - This function is defined: - int sched_getscheduler(pid_t); - - - This function is defined: - int sched_rr_get_interval(pid_t, struct timespec *); - - - This function is defined: - int sched_setparam(pid_t, const struct sched_param *); - - - This function is defined: - int sched_setscheduler(pid_t, int, const struct sched_param *); - - - This function is defined: - int sched_yield(void); - - - Inclusion of the sched.h header may make visible all symbols from - the time.h header. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/coverage.txt deleted file mode 100644 index 91d43bca51..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sched_h/coverage.txt +++ /dev/null @@ -1,26 +0,0 @@ - -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES -3 YES -4 YES -5 NO implementation defined on where are the scheduling policy and priority stored -6 NO implementation defined on how to get the priority range -7 NO implementation defined on how to get the minimum priority range for a policy -8 YES -9 NO implementation defined on how to get the other policies -10 YES -11 YES -12 YES -13 YES -14 YES -15 YES -16 YES -17 YES -18 YES -19 NO NOT COMPLETE diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/1-1.c deleted file mode 100644 index 61e711b646..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/1-1.c +++ /dev/null @@ -1,6 +0,0 @@ - /* - Test the existence of the signal.h file and that it can be - included. - */ - -#include diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/13-1.c deleted file mode 100644 index a991546498..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/13-1.c +++ /dev/null @@ -1,44 +0,0 @@ - /* - Test that 0 is reserved for the null signal. - This test must be executed. - */ - -#include -#include - -int main() { - if ( (0 == SIGABRT) || - (0 == SIGALRM) || - (0 == SIGBUS) || - (0 == SIGCHLD) || - (0 == SIGCONT) || - (0 == SIGFPE) || - (0 == SIGHUP) || - (0 == SIGILL) || - (0 == SIGINT) || - (0 == SIGKILL) || - (0 == SIGPIPE) || - (0 == SIGQUIT) || - (0 == SIGSEGV) || - (0 == SIGSTOP) || - (0 == SIGTERM) || - (0 == SIGTSTP) || - (0 == SIGTTIN) || - (0 == SIGTTOU) || - (0 == SIGUSR1) || - (0 == SIGUSR2) || - (0 == SIGPOLL) || - (0 == SIGPROF) || - (0 == SIGSYS) || - (0 == SIGTRAP) || - (0 == SIGURG) || - (0 == SIGVTALRM) || - (0 == SIGXCPU) || - (0 == SIGXFSZ) ) { - printf("Test FAILED\n"); - return -1; - } else { - printf("Test PASSED\n"); - return 0; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/14-1.c deleted file mode 100644 index 959c1e7571..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/14-1.c +++ /dev/null @@ -1,34 +0,0 @@ - /* - Test that the signals below are supported. - */ - -#include - -int dummy1 = SIGABRT; -int dummy2 = SIGALRM; -int dummy3 = SIGBUS; -int dummy4 = SIGCHLD; -int dummy5 = SIGCONT; -int dummy6 = SIGFPE; -int dummy7 = SIGHUP; -int dummy8 = SIGILL; -int dummy9 = SIGINT; -int dummy10 = SIGKILL; -int dummy11 = SIGPIPE; -int dummy12 = SIGQUIT; -int dummy13 = SIGSEGV; -int dummy14 = SIGSTOP; -int dummy15 = SIGTERM; -int dummy16 = SIGTSTP; -int dummy17 = SIGTTIN; -int dummy18 = SIGTTOU; -int dummy19 = SIGUSR1; -int dummy20 = SIGUSR2; -int dummy21 = SIGPOLL; -int dummy22 = SIGPROF; -int dummy23 = SIGSYS; -int dummy24 = SIGTRAP; -int dummy25 = SIGURG; -int dummy26 = SIGVTALRM; -int dummy27 = SIGXCPU; -int dummy28 = SIGXFSZ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/15-1.c deleted file mode 100644 index cdcecc93c3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/15-1.c +++ /dev/null @@ -1,21 +0,0 @@ - /* - Test the definition of sigaction. - */ - -#include - -struct sigaction this_type_should_exist, t; -extern void signal_handler (int); -sigset_t *set; -int flags; -extern void signal_action(int, siginfo_t *, void *); - -int dummyfcn (void) -{ - t.sa_handler = signal_handler; - set = &t.sa_mask; - flags = t.sa_flags; - t.sa_sigaction = signal_action; - - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/16-1.c deleted file mode 100644 index 1d7d98b620..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/16-1.c +++ /dev/null @@ -1,20 +0,0 @@ - /* - Test that the constants below are supported. - */ - -#include - -int dummy1 = SA_NOCLDSTOP; -int dummy2 = SIG_BLOCK; -int dummy3 = SIG_UNBLOCK; -int dummy4 = SIG_SETMASK; -int dummy5 = SA_ONSTACK; -int dummy6 = SA_RESETHAND; -int dummy7 = SA_RESTART; -int dummy8 = SA_SIGINFO; -int dummy9 = SA_NOCLDWAIT; -int dummy10 = SA_NODEFER; -int dummy11 = SS_ONSTACK; -int dummy12 = SS_DISABLE; -int dummy13 = MINSIGSTKSZ; -int dummy14 = SIGSTKSZ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/17-1.c deleted file mode 100644 index fe58495338..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/17-1.c +++ /dev/null @@ -1,7 +0,0 @@ - /* - Test the definition of ucontext_t. - */ - -#include - -ucontext_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/18-1.c deleted file mode 100644 index fe58495338..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/18-1.c +++ /dev/null @@ -1,7 +0,0 @@ - /* - Test the definition of ucontext_t. - */ - -#include - -ucontext_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/19-1.c deleted file mode 100644 index 51ea611506..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/19-1.c +++ /dev/null @@ -1,19 +0,0 @@ - /* - Test the definition of stack_t. - */ - -#include - -stack_t this_type_should_exist, t; -void *sp; -size_t size; -int flags; - -int dummyfcn (void) -{ - sp = t.ss_sp; - size = t.ss_size; - flags = t.ss_flags; - - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-1.c deleted file mode 100644 index 85a1c4aa81..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-1.c +++ /dev/null @@ -1,7 +0,0 @@ - /* - Test the definition of SIG_DFL. - */ - -#include - -void (*dummy) (int) = SIG_DFL; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-2.c deleted file mode 100644 index b64a642e85..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-2.c +++ /dev/null @@ -1,7 +0,0 @@ - /* - Test the definition of SIG_ERR. - */ - -#include - -void (*dummy) (int) = SIG_ERR; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-3.c deleted file mode 100644 index 86e6300f18..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-3.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - @pt:CX - - Test the definition of SIG_HOLD. - */ - -#include - -void (*dummy) (int) = SIG_HOLD; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-4.c deleted file mode 100644 index 92540d7fce..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/2-4.c +++ /dev/null @@ -1,7 +0,0 @@ - /* - Test the definition of SIG_IGN. - */ - -#include - -void (*dummy) (int) = SIG_IGN; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/20-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/20-1.c deleted file mode 100644 index bb72e7259f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/20-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - Test the definition of sigstack. - */ - -#include - -struct sigstack this_type_should_exist, t; -int onstack; -void *sp; - -int dummyfcn (void) -{ - sp = t.ss_sp; - onstack = t.ss_onstack; - - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/21-1.c deleted file mode 100644 index 9aabe86e11..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/21-1.c +++ /dev/null @@ -1,32 +0,0 @@ - /* - Test the definition of siginfo_t. - */ - -#include -#include - -siginfo_t this_type_should_exist, t; -int tsigno; -int terrno; -int tcode; -pid_t tpid; -uid_t tuid; -void *taddr; -int tstatus; -long tband; -union sigval tvalue; - -int dummyfcn (void) -{ - tsigno = t.si_signo; - terrno = t.si_errno; - tcode = t.si_code; - tpid = t.si_pid; - tuid = t.si_uid; - taddr = t.si_addr; - tstatus = t.si_status; - tband = t.si_band; - tvalue = t.si_value; - - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-1.c deleted file mode 100644 index 551f3f806d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-1.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the ILL_ILLOPC macro is defined. - */ - -#include - -#ifndef ILL_ILLOPC -#error ILL_ILLOPC not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-10.c deleted file mode 100644 index 185467dddd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-10.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the FPE_INTOVF macro is defined. - */ - -#include - -#ifndef FPE_INTOVF -#error FPE_INTOVF not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-11.c deleted file mode 100644 index 07bf09d9dd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-11.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the FPE_FLTDIV macro is defined. - */ - -#include - -#ifndef FPE_FLTDIV -#error FPE_FLTDIV not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-12.c deleted file mode 100644 index 48b64075a6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-12.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the FPE_FLTOVF macro is defined. - */ - -#include - -#ifndef FPE_FLTOVF -#error FPE_FLTOVF not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-13.c deleted file mode 100644 index c7680fe777..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-13.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the FPE_FLTUND macro is defined. - */ - -#include - -#ifndef FPE_FLTUND -#error FPE_FLTUND not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-14.c deleted file mode 100644 index 988d0abcbc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-14.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the FPE_FLTRES macro is defined. - */ - -#include - -#ifndef FPE_FLTRES -#error FPE_FLTRES not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-15.c deleted file mode 100644 index af565347ca..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-15.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the FPE_FLTINV macro is defined. - */ - -#include - -#ifndef FPE_FLTINV -#error FPE_FLTINV not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-16.c deleted file mode 100644 index 4b4e94e6b0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-16.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the FPE_FLTSUB macro is defined. - */ - -#include - -#ifndef FPE_FLTSUB -#error FPE_FLTSUB not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-17.c deleted file mode 100644 index b527c3e6d8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-17.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the SEGV_MAPERR macro is defined. - */ - -#include - -#ifndef SEGV_MAPERR -#error SEGV_MAPERR not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-18.c deleted file mode 100644 index 2fd4b58132..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-18.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the SEGV_ACCERR macro is defined. - */ - -#include - -#ifndef SEGV_ACCERR -#error SEGV_ACCERR not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-19.c deleted file mode 100644 index 69e4f25577..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-19.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the BUS_ADRALN macro is defined. - */ - -#include - -#ifndef BUS_ADRALN -#error BUS_ADRALN not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-2.c deleted file mode 100644 index 78acaf6f99..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-2.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the ILL_ILLOPN macro is defined. - */ - -#include - -#ifndef ILL_ILLOPN -#error ILL_ILLOPN not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-20.c deleted file mode 100644 index ddc2636306..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-20.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the BUS_ADRERR macro is defined. - */ - -#include - -#ifndef BUS_ADRERR -#error BUS_ADRERR not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-21.c deleted file mode 100644 index e0812be753..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-21.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the BUS_OBJERR macro is defined. - */ - -#include - -#ifndef BUS_OBJERR -#error BUS_OBJERR not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-22.c deleted file mode 100644 index 2039b9c47f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-22.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the TRAP_BRKPT macro is defined. - */ - -#include - -#ifndef TRAP_BRKPT -#error TRAP_BRKPT not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-23.c deleted file mode 100644 index c9de0db37b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-23.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the TRAP_TRACE macro is defined. - */ - -#include - -#ifndef TRAP_TRACE -#error TRAP_TRACE not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-24.c deleted file mode 100644 index e9e091cbe9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-24.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the CLD_EXITED macro is defined. - */ - -#include - -#ifndef CLD_EXITED -#error CLD_EXITED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-25.c deleted file mode 100644 index a444870094..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-25.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the CLD_KILLED macro is defined. - */ - -#include - -#ifndef CLD_KILLED -#error CLD_KILLED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-26.c deleted file mode 100644 index 2c328477df..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-26.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the CLD_DUMPED macro is defined. - */ - -#include - -#ifndef CLD_DUMPED -#error CLD_DUMPED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-27.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-27.c deleted file mode 100644 index c2931ace11..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-27.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the CLD_TRAPPED macro is defined. - */ - -#include - -#ifndef CLD_TRAPPED -#error CLD_TRAPPED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-28.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-28.c deleted file mode 100644 index 4cca86b6c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-28.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the CLD_STOPPED macro is defined. - */ - -#include - -#ifndef CLD_STOPPED -#error CLD_STOPPED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-29.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-29.c deleted file mode 100644 index c8917feeaf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-29.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the CLD_CONTINUED macro is defined. - */ - -#include - -#ifndef CLD_CONTINUED -#error CLD_CONTINUED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-3.c deleted file mode 100644 index 62a2704408..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-3.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the ILL_ILLADR macro is defined. - */ - -#include - -#ifndef ILL_ILLADR -#error ILL_ILLADR not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-30.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-30.c deleted file mode 100644 index 743df7eb37..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-30.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the POLL_IN macro is defined. - */ - -#include - -#ifndef POLL_IN -#error POLL_IN not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-31.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-31.c deleted file mode 100644 index 1f33abb2be..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-31.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the POLL_OUT macro is defined. - */ - -#include - -#ifndef POLL_OUT -#error POLL_OUT not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-32.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-32.c deleted file mode 100644 index cbad184ee2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-32.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the POLL_MSG macro is defined. - */ - -#include - -#ifndef POLL_MSG -#error POLL_MSG not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-33.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-33.c deleted file mode 100644 index a9d2e5d8fb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-33.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the POLL_ERR macro is defined. - */ - -#include - -#ifndef POLL_ERR -#error POLL_ERR not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-34.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-34.c deleted file mode 100644 index 813373f3aa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-34.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the POLL_PRI macro is defined. - */ - -#include - -#ifndef POLL_PRI -#error POLL_PRI not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-35.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-35.c deleted file mode 100644 index 6edf4efc8a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-35.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the POLL_HUP macro is defined. - */ - -#include - -#ifndef POLL_HUP -#error POLL_HUP not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-36.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-36.c deleted file mode 100644 index d0d92c57e5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-36.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the SI_USER macro is defined. - */ - -#include - -#ifndef SI_USER -#error SI_USER not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-37.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-37.c deleted file mode 100644 index 9c9b437c6b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-37.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the SI_QUEUE macro is defined. - */ - -#include - -#ifndef SI_QUEUE -#error SI_QUEUE not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-38.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-38.c deleted file mode 100644 index ad42db6c86..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-38.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the SI_TIMER macro is defined. - */ - -#include - -#ifndef SI_TIMER -#error SI_TIMER not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-39.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-39.c deleted file mode 100644 index 50bcfecc25..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-39.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the SI_ASYNCIO macro is defined. - */ - -#include - -#ifndef SI_ASYNCIO -#error SI_ASYNCIO not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-4.c deleted file mode 100644 index 4d0d33e657..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-4.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the ILL_ILLTRP macro is defined. - */ - -#include - -#ifndef ILL_ILLTRP -#error ILL_ILLTRP not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-40.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-40.c deleted file mode 100644 index e4224f215d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-40.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the SI_MESGQ macro is defined. - */ - -#include - -#ifndef SI_MESGQ -#error SI_MESGQ not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-5.c deleted file mode 100644 index 224befc823..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-5.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the ILL_PRVOPC macro is defined. - */ - -#include - -#ifndef ILL_PRVOPC -#error ILL_PRVOPC not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-6.c deleted file mode 100644 index 4b221dd748..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-6.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the ILL_PRVREG macro is defined. - */ - -#include - -#ifndef ILL_PRVREG -#error ILL_PRVREG not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-7.c deleted file mode 100644 index fda84225c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-7.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the ILL_COPROC macro is defined. - */ - -#include - -#ifndef ILL_COPROC -#error ILL_COPROC not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-8.c deleted file mode 100644 index ab62700958..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-8.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the ILL_BADSTK macro is defined. - */ - -#include - -#ifndef ILL_BADSTK -#error ILL_BADSTK not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-9.c deleted file mode 100644 index e2ce813026..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/22-9.c +++ /dev/null @@ -1,9 +0,0 @@ - /* - Test that the FPE_INTDIV macro is defined. - */ - -#include - -#ifndef FPE_INTDIV -#error FPE_INTDIV not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/23-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/23-1.c deleted file mode 100644 index 4d67493220..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/23-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - @pt:XSI - Test that the function: - void (*bsd_signal(int, void (*)(int)))(int); - is declared. - */ - -#include - -typedef void (*(*bsd_signal_test)(int, void (*)(int)))(int); - -int dummyfcn (void) -{ - bsd_signal_test dummyvar; - dummyvar=bsd_signal; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/24-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/24-1.c deleted file mode 100644 index 8f54ad8966..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/24-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - Test that the function: - int kill(pid_t, int); - is declared. - */ - -#include -#include - -typedef int (*kill_test)(pid_t, int); - -int dummyfcn (void) -{ - kill_test dummyvar; - dummyvar = kill; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/25-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/25-1.c deleted file mode 100644 index 8745e4f339..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/25-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - Test that the function: - int killpg(pid_t, int); - is declared. - */ - -#include -#include - -typedef int (*killpg_test)(pid_t, int); - -int dummyfcn (void) -{ - killpg_test dummyvar; - dummyvar = killpg; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/26-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/26-1.c deleted file mode 100644 index fe39720a2c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/26-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int pthread_kill(pthread_t, int); - is declared. - */ - -#include - -typedef int (*pthread_kill_test)(pthread_t, int); - -int dummyfcn (void) -{ - pthread_kill_test dummyvar; - dummyvar = pthread_kill; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/27-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/27-1.c deleted file mode 100644 index 4ce29120e0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/27-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int pthread_sigmask(int, const sigset_t *, sigset_t *); - is declared. - */ - -#include - -typedef int (*pthread_sigmask_test)(int, const sigset_t *, sigset_t *); - -int dummyfcn (void) -{ - pthread_sigmask_test dummyvar; - dummyvar = pthread_sigmask; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/28-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/28-1.c deleted file mode 100644 index d9905b374f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/28-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int raise(int); - is declared. - */ - -#include - -typedef int (*raise_test)(int); - -int dummyfcn (void) -{ - raise_test dummyvar; - dummyvar = raise; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/29-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/29-1.c deleted file mode 100644 index e9b2740424..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/29-1.c +++ /dev/null @@ -1,18 +0,0 @@ - /* - Test that the function: - int sigaction(int, const struct sigaction *restrict, - struct sigaction *restrict); - is declared. - Removed restrict keyword from typedef. - */ - -#include - -typedef int (*sigaction_test)(int, const struct sigaction *, struct sigaction *); - -int dummyfcn (void) -{ - sigaction_test dummyvar; - dummyvar = sigaction; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/3-1.c deleted file mode 100644 index 34d5ea647d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/3-1.c +++ /dev/null @@ -1,7 +0,0 @@ - /* - Test the definition of sig_atomic_t. - */ - -#include - -sig_atomic_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/30-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/30-1.c deleted file mode 100644 index 9b04cec66c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/30-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int sigaddset(sigset_t *, int); - is declared. - */ - -#include - -typedef int (*sigaddset_test)(sigset_t *, int); - -int dummyfcn (void) -{ - sigaddset_test dummyvar; - dummyvar = sigaddset; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/31-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/31-1.c deleted file mode 100644 index b94a25bdd7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/31-1.c +++ /dev/null @@ -1,18 +0,0 @@ - /* - Test that the function: - int sigaltstack(const stack_t *restrict, stack_t *restrict); - is declared. - - Removed restrict keyword from typedef. - */ - -#include - -typedef int (*sigaltstack_test)(const stack_t *, stack_t *); - -int dummyfcn (void) -{ - sigaltstack_test dummyvar; - dummyvar = sigaltstack; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/32-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/32-1.c deleted file mode 100644 index 4f869e2ba2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/32-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int sigdelset(sigset_t *, int); - is declared. - */ - -#include - -typedef int (*sigdelset_test)(sigset_t *, int); - -int dummyfcn (void) -{ - sigdelset_test dummyvar; - dummyvar = sigdelset; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/33-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/33-1.c deleted file mode 100644 index 7cd94a2baa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/33-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int sigemptyset(sigset_t *); - is declared. - */ - -#include - -typedef int (*sigemptyset_test)(sigset_t *); - -int dummyfcn (void) -{ - sigemptyset_test dummyvar; - dummyvar = sigemptyset; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/34-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/34-1.c deleted file mode 100644 index 901a2ea442..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/34-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int sigfillset(sigset_t *); - is declared. - */ - -#include - -typedef int (*sigfillset_test)(sigset_t *); - -int dummyfcn (void) -{ - sigfillset_test dummyvar; - dummyvar = sigfillset; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/35-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/35-1.c deleted file mode 100644 index 406b0d74de..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/35-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - @:pt:XSI - Test that the function: - int sighold(int); - is declared. - */ - -#include - -typedef int (*sighold_test)(int); - -int dummyfcn (void) -{ - sighold_test dummyvar; - dummyvar = sighold; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/36-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/36-1.c deleted file mode 100644 index 58cdc2498e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/36-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - @:pt:XSI - Test that the function: - int sigignore(int); - is declared. - */ - -#include - -typedef int (*sigignore_test)(int); - -int dummyfcn (void) -{ - sigignore_test dummyvar; - dummyvar = sigignore; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/37-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/37-1.c deleted file mode 100644 index 3df39b7228..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/37-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int siginterrupt(int, int); - is declared. - */ - -#include - -typedef int (*siginterrupt_test)(int, int); - -int dummyfcn (void) -{ - siginterrupt_test dummyvar; - dummyvar = siginterrupt; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/38-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/38-1.c deleted file mode 100644 index b57837fc27..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/38-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int sigismember(const sigset_t *, int); - is declared. - */ - -#include - -typedef int (*sigismember_test)(const sigset_t *, int); - -int dummyfcn (void) -{ - sigismember_test dummyvar; - dummyvar = sigismember; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/39-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/39-1.c deleted file mode 100644 index dbc0a275c4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/39-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - void (*signal(int, void (*)(int)))(int); - is declared. - */ - -#include - -typedef void (*(*signal_test)(int, void (*)(int)))(int); - -int dummyfcn (void) -{ - signal_test dummyvar; - dummyvar = signal; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/4-1.c deleted file mode 100644 index 5a63457381..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/4-1.c +++ /dev/null @@ -1,7 +0,0 @@ - /* - Test the definition of sigset_t. - */ - -#include - -sigset_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/40-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/40-1.c deleted file mode 100644 index 0d18c511dd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/40-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - @:pt:XSI - Test that the function: - int sigpause(int); - is declared. - */ - -#include - -typedef int (*sigpause_test)(int); - -int dummyfcn (void) -{ - sigpause_test dummyvar; - dummyvar = sigpause; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/41-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/41-1.c deleted file mode 100644 index d8981b79ec..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/41-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - @:pt:CX - Test that the function: - int sigpending(sigset_t *); - is declared. - */ - -#include - -typedef int (*sigpending_test)(sigset_t *); - -int dummyfcn (void) -{ - sigpending_test dummyvar; - dummyvar = sigpending; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/42-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/42-1.c deleted file mode 100644 index b884b1c0c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/42-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - Test that the function: - int sigprocmask(int, const sigset_t *restrict, sigset_t *restrict); - is declared. - Removed restrict keyword from typedef. - */ - -#include - -typedef int (*sigprocmask_test)(int, const sigset_t *, sigset_t *); - -int dummyfcn (void) -{ - sigprocmask_test dummyvar; - dummyvar = sigprocmask; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/43-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/43-1.c deleted file mode 100644 index 31f42df978..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/43-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - Test that the function: - int sigqueue(pid_t, int, const union sigval); - is declared. - */ - -#include -#include - -typedef int (*sigqueue_test)(pid_t, int, const union sigval); - -int dummyfcn (void) -{ - sigqueue_test dummyvar; - dummyvar = sigqueue; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/44-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/44-1.c deleted file mode 100644 index 26b924fba6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/44-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int sigrelse(int); - is declared. - */ - -#include - -typedef int (*sigrelse_test)(int); - -int dummyfcn (void) -{ - sigrelse_test dummyvar; - dummyvar = sigrelse; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/45-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/45-1.c deleted file mode 100644 index bafcc6b653..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/45-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - void (*sigset(int, void (*)(int)))(int); - is declared. - */ - -#include - -typedef void (*(*sigset_test)(int, void (*)(int)))(int); - -int dummyfcn (void) -{ - sigset_test dummyvar; - dummyvar = sigset; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/46-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/46-1.c deleted file mode 100644 index 3018201dfc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/46-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int sigsuspend(const sigset_t *); - is declared. - */ - -#include - -typedef int (*sigsuspend_test)(const sigset_t *); - -int dummyfcn (void) -{ - sigsuspend_test dummyvar; - dummyvar = sigsuspend; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/47-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/47-1.c deleted file mode 100644 index 9fb22aefbe..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/47-1.c +++ /dev/null @@ -1,19 +0,0 @@ - /* - @pt:RTS - Test that the function: - int sigtimedwait(const sigset_t *restrict, siginfo_t *restrict, - const struct timespec *restrict); - is declared. - */ - -#include - -typedef int (*sigtimedwait_test)(const sigset_t *restrict, siginfo_t *restrict, - const struct timespec *restrict); - -int dummyfcn (void) -{ - sigtimedwait_test dummyvar; - dummyvar = sigtimedwait; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/48-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/48-1.c deleted file mode 100644 index c8392c6b69..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/48-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int sigwait(const sigset_t *restrict, int *restrict); - is declared. - */ - -#include - -typedef int (*sigwait_test)(const sigset_t *restrict, int *restrict); - -int dummyfcn (void) -{ - sigwait_test dummyvar; - dummyvar = sigwait; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/49-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/49-1.c deleted file mode 100644 index dc24d979b5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/49-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - Test that the function: - int sigwaitinfo(const sigset_t *restrict, siginfo_t *restrict); - is declared. - */ - -#include - -typedef int (*sigwaitinfo_test)(const sigset_t *restrict, siginfo_t *restrict); - -int dummyfcn (void) -{ - sigwaitinfo_test dummyvar; - dummyvar = sigwaitinfo; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/5-1.c deleted file mode 100644 index 87c4645233..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/5-1.c +++ /dev/null @@ -1,7 +0,0 @@ - /* - Test the definition of pid_t. - */ - -#include - -pid_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/50-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/50-1.c deleted file mode 100644 index 64b128d54f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/50-1.c +++ /dev/null @@ -1,10 +0,0 @@ - /* - Test that inclusion of signal.h makes visible all symbols in time.h. - - NOTE - THIS TEST CASE IS NOT COMPLETE. NEEDS TO GROW MUCH LARGER. - */ - -#include - -struct tm *mytime; - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/assertions.xml deleted file mode 100644 index 525e4ba55d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/assertions.xml +++ /dev/null @@ -1,302 +0,0 @@ - - - The signal.h header file exists - - - The signal.h header defines the symbols SIG_DFL, SIG_ERR, SIG_HOLD - and SIG_IGN as 'void (*) int'. - - - The signal.h header defines sig_atomic_t. - - - The signal.h header defines sigset_t. - - - The sys/types.h header defines pid_t. - - - The signal.h header defines a structure named sigevent which has at least: - int sigev_notify - int sigev_signo - union sigval sigev_value - void(*)(union sigval) sigev_notify_function - (pthread_attr_t *) sigev_notify_attributes - - - For sigev_notify (assertion 6), the following values are defined: - SIGEV_NONE - SIGEV_SIGNAL - SIGEV_THREAD - - - The sigval union (assertion 6) is defined as: - int sival_int - void *sival_ptr - - - The signal.h header declares SIGRTMIN and SIGRTMAX. These are macros - that evaluate to integer expressions for the minimum and maximum signal - numbers reserved for realtime signals. - - - The range SIGRTMIN-SIGRTMAX doesn't overlap pre-defined signals (see - below). - - - The SIGRTMIN-SIGRTMAX range includes at least {RTSIG_MAX} signal - numbers. - - - Realtime signal behavior may or may not be supported for non-realtime - signals. This is defined by the implementation. - - - The value 0 is not used in any signals, but is reserved as the null signal. - - - The following signals are always (on all implementations) supported: - SIGABRT - SIGALRM - SIGBUS - SIGCHLD - SIGCONT - SIGFPE - SIGHUP - SIGILL - SIGINT - SIGKILL - SIGPIPE - SIGQUIT - SIGSEGV - SIGSTOP - SIGTERM - SIGTSTP - SIGTTIN - SIGTTOU - SIGUSR1 - SIGUSR2 - SIGPOLL - SIGPROF - SIGSYS - SIGTRAP - SIGURG - SIGVTALRM - SIGXCPU - SIGXFSZ - - - The signal.h header declares the struct sigaction which has, at a minimum, - the following members: - void (*sa_handler)(int) - sigset_t sa_mask - int sa_flags - void (*)(int, siginfo_t *, void *) sa_sigaction - - - The constants below are declared: - SA_NOCLDSTOP - SIG_BLOCK - SIG_UNBLOCK - SIG_SETMASK - SA_ONSTACK - SA_RESETHAND - SA_RESTART - SA_SIGINFO - SA_NOCLDWAIT - SA_NODEFER - SS_ONSTACK - SS_DISABLE - MINSIGSTKSZ - SIGSTKSZ - - - The ucontext.h header shall define ucontext_t. - - - The ucontext.h header shall define mcontext_t. - - - The signal.h header defines the structure stack_t which includes the - following, at a minimum: - void *ss_sp - size_t ss_size - int ss_flags - - - The signal.h header defines the structure sigstack which includes the - following, at a minimum: - int ss_onstack - void *ss_sp - - - The signal.h header defines the structure siginfo_t which includes the - following, at a minimum: - int si_signo - int si_errno - int si_code - pid_t si_pid - uid_t si_uid - void *si_addr - int si_status - long si_band - union sigval si_value - - - The following macros are defined: - ILL_ILLOPC - ILL_ILLOPN - ILL_ILLADR - ILL_ILLTRP - ILL_PRVOPC - ILL_PRVREG - ILL_COPROC - ILL_BADSTK - FPE_INTDIV - FPE_INTOVF - FPE_FLTDIV - FPE_FLTOVF - FPE_FLTUND - FPE_FLTRES - FPE_FLTINV - FPE_FLTSUB - SEGV_MAPERR - SEGV_ACCERR - BUS_ADRALN - BUS_ADRERR - BUS_OBJERR - TRAP_BRKPT - TRAP_TRACE - CLD_EXITED - CLD_KILLED - CLD_DUMPED - CLD_TRAPPED - CLD_STOPPED - CLD_CONTINUED - POLL_IN - POLL_OUT - POLL_MSG - POLL_ERR - POLL_PRI - POLL_HUP - SI_USER - SI_QUEUE - SI_TIMER - SI_ASYNCIO - SI_MESGQ - - - The function below is declared: - void (*bsd_signal(int, void (*)(int)))(int); - - - The function below is declared: - int kill(pid_t, int); - - - The function below is declared: - int killpg(pid_t, int); - - - The function below is declared: - int pthread_kill(pthread_t, int); - - - The function below is declared: - int pthread_sigmask(int, const sigset_t *, sigset_t *); - - - The function below is declared: - int raise(int); - - - The function below is declared: - int sigaction(int, const struct sigaction *restrict, - struct sigaction *restrict); - - - The function below is declared: - int sigaddset(sigset_t *, int); - - - The function below is declared: - int sigaltstack(const stack_t *restrict, stack_t *restrict); - - - The function below is declared: - int sigdelset(sigset_t *, int); - - - The function below is declared: - int sigemptyset(sigset_t *); - - - The function below is declared: - int sigfillset(sigset_t *); - - - The function below is declared: - int sighold(int); - - - The function below is declared: - int sigignore(int); - - - The function below is declared: - int siginterrupt(int, int); - - - The function below is declared: - int sigismember(const sigset_t *, int); - - - The function below is declared: - void (*signal(int, void (*)(int)))(int); - - - The function below is declared: - int sigpause(int); - - - The function below is declared: - int sigpending(sigset_t *); - - - The function below is declared: - int sigprocmask(int, const sigset_t *restrict, sigset_t *restrict); - - - The function below is declared: - int sigqueue(pid_t, int, const union sigval); - - - The function below is declared: - int sigrelse(int); - - - The function below is declared: - void (*sigset(int, void (*)(int)))(int); - - - The function below is declared: - int sigsuspend(const sigset_t *); - - - The function below is declared: - int sigtimedwait(const sigset_t *restrict, siginfo_t *restrict, - const struct timespec *restrict); - - - The function below is declared: - int sigwait(const sigset_t *restrict, int *restrict); - - - The function below is declared: - int sigwaitinfo(const sigset_t *restrict, siginfo_t *restrict); - - - Inclusion of the signal.h header may make visible all symbols from - the time.h header. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/coverage.txt deleted file mode 100644 index c1fc824aa0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/coverage.txt +++ /dev/null @@ -1,15 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - -6 through 12 - Did not test RTS assertions. -50 - This test case needs to be much larger. - - -Other items I am currently investigating (as of 10/28/02): -The assertions: -19 -21 -45 -fail on the system I am testing on. -These appear to be valid header file failures. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/make22tests b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/make22tests deleted file mode 100755 index 51076e8ef7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/make22tests +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Make the tests for assertion 22. -# Not named *.sh because then it would be executed during build time. - -declare -i i -i=1 -for sigmacro in `cat sigmacrolist.txt` -do - echo " /*" >> 22-$i.c 2>&1 - echo " Test that the $sigmacro macro is defined." >> 22-$i.c 2>&1 - echo " */" >> 22-$i.c 2>&1 - echo "" >> 22-$i.c 2>&1 - echo "#include " >> 22-$i.c 2>&1 - echo "" >> 22-$i.c 2>&1 - echo "#ifndef $sigmacro" >> 22-$i.c 2>&1 - echo "#error $sigmacro not defined" >> 22-$i.c 2>&1 - echo "#endif" >> 22-$i.c 2>&1 - i=$i+1 -done diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/sigmacrolist.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/sigmacrolist.txt deleted file mode 100644 index 3d52b51fc9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/signal_h/sigmacrolist.txt +++ /dev/null @@ -1,40 +0,0 @@ -ILL_ILLOPC -ILL_ILLOPN -ILL_ILLADR -ILL_ILLTRP -ILL_PRVOPC -ILL_PRVREG -ILL_COPROC -ILL_BADSTK -FPE_INTDIV -FPE_INTOVF -FPE_FLTDIV -FPE_FLTOVF -FPE_FLTUND -FPE_FLTRES -FPE_FLTINV -FPE_FLTSUB -SEGV_MAPERR -SEGV_ACCERR -BUS_ADRALN -BUS_ADRERR -BUS_OBJERR -TRAP_BRKPT -TRAP_TRACE -CLD_EXITED -CLD_KILLED -CLD_DUMPED -CLD_TRAPPED -CLD_STOPPED -CLD_CONTINUED -POLL_IN -POLL_OUT -POLL_MSG -POLL_ERR -POLL_PRI -POLL_HUP -SI_USER -SI_QUEUE -SI_TIMER -SI_ASYNCIO -SI_MESGQ diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/1-1.c deleted file mode 100644 index a983d5a083..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/1-1.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the sys/mman.h header file exists when the implementation supports - * at least one of the following options: - * MF - * SHM - * ML - * MPR - * TYM - * SIO - * ADV - */ - -#include - - -#if defined(_POSIX_ADVISORY_INFO) || defined(_POSIX_MAPPED_FILES) || \ - defined(_POSIX_MEMLOCK) || defined(_POSIX_MEMORY_PROTECTION) || \ - defined(_POSIX_SHARED_MEMORY_OBJECTS) || \ - defined(_POSIX_SYNCHRONIZED_IO) || defined(_POSIX_TYPED_MEMORY_OBJECTS) - -#include - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/10-1.c deleted file mode 100644 index fd3a3ee76d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/10-1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header declares struct posix_typed_mem_info with at least the - * following member: - * size_t posix_tmi_length - * - * @pt:TYM - */ - -#include - -struct posix_typed_mem_info this_type_should_exist, t; - -int dummyfcn(void) -{ - size_t sz = 0; - - t.posix_tmi_length = sz; - - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/11-1.c deleted file mode 100644 index 52b07d18d5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/11-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int mlock(const void *, size_t) - * is declared. - * - * @pt:MR - */ - -#include - -typedef int (*mlock_test)(const void *, size_t); - -int dummyfcn (void) -{ - mlock_test dummyvar; - dummyvar = mlock; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/12-1.c deleted file mode 100644 index 083acc3e91..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/12-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int mlockall(int) - * is declared. - * - * @pt:ML - */ - -#include - -typedef int (*mlockall_test)(int); - -int dummyfcn (void) -{ - mlockall_test dummyvar; - dummyvar = mlockall; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/13-1.c deleted file mode 100644 index 32d7465f00..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/13-1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * void *mmap(void *, size_t, int, int, int, off_t) - * is declared. - * - * @pt:MF - * @pt:SHM - * @pt:TYM - */ - -#include - -typedef void* (*mmap_test)(void *, size_t, int, int, int, off_t); - -int dummyfcn (void) -{ - mmap_test dummyvar; - dummyvar = mmap; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/14-1.c deleted file mode 100644 index 74df9b08c1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/14-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int mprotect(void *, size_t, int) - * is declared. - * - * @pt:MPR - */ - -#include - -typedef int (*mprotect_test)(void *, size_t, int); - -int dummyfcn (void) -{ - mprotect_test dummyvar; - dummyvar = mprotect; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/15-1.c deleted file mode 100644 index 315cd3cd88..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/15-1.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int msync(void *, size_t, int) - * is declared. - * - * @pt:MF - * @pt:SIO - */ - -#include - -typedef int (*msync_test)(void *, size_t, int); - -int dummyfcn (void) -{ - msync_test dummyvar; - dummyvar = msync; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/16-1.c deleted file mode 100644 index 1d853381c4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/16-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int munlock(const void *, size_t) - * is declared. - * - * @pt:MR - */ - -#include - -typedef int (*munlock_test)(const void *, size_t); - -int dummyfcn (void) -{ - munlock_test dummyvar; - dummyvar = munlock; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/17-1.c deleted file mode 100644 index 371c58e2d2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/17-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int munlockall(void) - * is declared. - * - * @pt:ML - */ - -#include - -typedef int (*munlockall_test)(void); - -int dummyfcn (void) -{ - munlockall_test dummyvar; - dummyvar = munlockall; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/18-1.c deleted file mode 100644 index 6c52edb07f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/18-1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int munmap(void *, size_t) - * is declared. - * - * @pt:MF - * @pt:SHM - * @pt:TYM - */ - -#include - -typedef int (*munmap_test)(void *, size_t); - -int dummyfcn (void) -{ - munmap_test dummyvar; - dummyvar = munmap; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/19-1.c deleted file mode 100644 index 6f5b9979d0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/19-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int posix_madvise(void *, size_t, int) - * is declared. - * - * @pt:ADV - */ - -#include - -typedef int (*posix_madvise_test)(void *, size_t, int); - -int dummyfcn (void) -{ - posix_madvise_test dummyvar; - dummyvar = posix_madvise; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-1.c deleted file mode 100644 index cdf1af4468..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the PROT_READ protection option. - * - * @pt:MF - * @pt:SHM - * @pt:ADV - */ - -#include - -#ifndef PROT_READ -#error PROT_READ not defined -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-2.c deleted file mode 100644 index 7e16a42a43..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-2.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the PROT_WRITE protection option. - * - * @pt:MF - * @pt:SHM - * @pt:ADV - */ - -#include - -#ifndef PROT_WRITE -#error PROT_WRITE not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-3.c deleted file mode 100644 index 6ab232ac7a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-3.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the PROT_EXEC protection option. - * - * @pt:MF - * @pt:SHM - * @pt:ADV - */ - -#include - -#ifndef PROT_EXEC -#error PROT_EXEC not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-4.c deleted file mode 100644 index e4f42d2c94..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/2-4.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the PROT_NONE protection option. - * - * @pt:MF - * @pt:SHM - * @pt:ADV - */ - -#include - -#ifndef PROT_NONE -#error PROT_NONE not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/20-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/20-1.c deleted file mode 100644 index 546ae8cf4e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/20-1.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int posix_mem_offset(const void *restrict, size_t, off_t *restrict, - * size_t *restrict, int *restrict) - * is declared. - * - * @pt:TYM - */ - -#include - -typedef int (*posix_mem_offset_test)(const void *restrict, size_t, - off_t *restrict, size_t *restrict, - int *restrict); - -int dummyfcn (void) -{ - posix_mem_offset_test dummyvar; - dummyvar = posix_mem_offset; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/21-1.c deleted file mode 100644 index 9900ef949a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/21-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int posix_typed_mem_get_info(int, struct posix_typed_mem_info *) - * is declared. - * - * @pt:TYM - */ - -#include - -typedef int (*posix_typed_mem_get_info_test)(int, struct posix_typed_mem_info *); - -int dummyfcn (void) -{ - posix_typed_mem_get_info_test dummyvar; - dummyvar = posix_typed_mem_get_info; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/22-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/22-1.c deleted file mode 100644 index eaae4d79fc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/22-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int posix_typed_mem_open(const char *, int, int) - * is declared. - * - * @pt:TYM - */ - -#include - -typedef int (*posix_typed_mem_open_test)(const char *, int, int); - -int dummyfcn (void) -{ - posix_typed_mem_open_test dummyvar; - dummyvar = posix_typed_mem_open; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/23-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/23-1.c deleted file mode 100644 index 488c06d40e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/23-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int shm_open(const char *, int, mode_t) - * is declared. - * - * @pt:SHM - */ - -#include - -typedef int (*shm_open_test)(const char *, int, mode_t); - -int dummyfcn (void) -{ - shm_open_test dummyvar; - dummyvar = shm_open; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/24-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/24-1.c deleted file mode 100644 index 5473624822..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/24-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int shm_unlink(const char *) - * is declared. - * - * @pt:SHM - */ - -#include - -typedef int (*shm_unlink_test)(const char *); - -int dummyfcn (void) -{ - shm_unlink_test dummyvar; - dummyvar = shm_unlink; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/3-1.c deleted file mode 100644 index aedfc2f132..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/3-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the MAP_SHARED flag option. - * - * @pt:MF - * @pt:SHM - */ - -#include - -#ifndef MAP_SHARED -#error MAP_SHARED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/3-2.c deleted file mode 100644 index dd051dbcd8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/3-2.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the MAP_PRIVATE flag option. - * - * @pt:MF - * @pt:SHM - */ - -#include - -#ifndef MAP_PRIVATE -#error MAP_PRIVATE not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/3-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/3-3.c deleted file mode 100644 index a4c7fec531..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/3-3.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the MAP_FIXED flag option. - * - * @pt:MF - * @pt:SHM - */ - -#include - -#ifndef MAP_FIXED -#error MAP_FIXED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/4-1.c deleted file mode 100644 index fa4d5ba214..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/4-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the MS_ASYNC flag option for msync(). - * - * @pt:MF - * @pt:SIO - */ - -#include - -#ifndef MS_ASYNC -#error MS_ASYNC not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/4-2.c deleted file mode 100644 index 5a8f999b41..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/4-2.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the MS_SYNC flag option for msync(). - * - * @pt:MF - * @pt:SIO - */ - -#include - -#ifndef MS_SYNC -#error MS_SYNC not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/4-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/4-3.c deleted file mode 100644 index f8b2d2539c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/4-3.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the MS_INVALIDATE flag option for msync(). - * - * @pt:MF - * @pt:SIO - */ - -#include - -#ifndef MS_INVALIDATE -#error MS_INVALIDATE not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/5-1.c deleted file mode 100644 index 4010873a30..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/5-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the MCL_CURRENT symbolic constant for - * mlockall(). - * - * @pt:ML - */ - -#include - -#ifndef MCL_CURRENT -#error MCL_CURRENT not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/5-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/5-2.c deleted file mode 100644 index 11368546b4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/5-2.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the MCL_FUTURE symbolic constant for - * mlockall(). - * - * @pt:ML - */ - -#include - -#ifndef MCL_FUTURE -#error MCL_FUTURE not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/6-1.c deleted file mode 100644 index bb884212e9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/6-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the MAP_FAILED symbolic constant. - * - * @pt:MF - * @pt:SHM - */ - -#include - -#ifndef MAP_FAILED -#error MAP_FAILED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-1.c deleted file mode 100644 index 1d33b95e52..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the POSIX_MADV_NORMAL symbolic value. - * - * @pt:ADV - * @pt:MF - * @pt:SHM - */ - -#include - -#ifndef POSIX_MADV_NORMAL -#error POSIX_MADV_NORMAL not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-2.c deleted file mode 100644 index 3492cff25c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-2.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the POSIX_MADV_SEQUENTIAL symbolic value. - * - * @pt:ADV - * @pt:MF - * @pt:SHM - */ - -#include - -#ifndef POSIX_MADV_SEQUENTIAL -#error POSIX_MADV_SEQUENTIAL not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-3.c deleted file mode 100644 index 6a52d0ac75..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-3.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the POSIX_MADV_RANDOM symbolic value. - * - * @pt:ADV - * @pt:MF - * @pt:SHM - */ - -#include - -#ifndef POSIX_MADV_RANDOM -#error POSIX_MADV_RANDOM not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-4.c deleted file mode 100644 index a5088bf42e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-4.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the POSIX_MADV_WILLNEED symbolic value. - * - * @pt:ADV - * @pt:MF - * @pt:SHM - */ - -#include - -#ifndef POSIX_MADV_WILLNEED -#error POSIX_MADV_WILLNEED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-5.c deleted file mode 100644 index ed66ce9ae0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/7-5.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the POSIX_MADV_DONTNEED symbolic value. - * - * @pt:ADV - * @pt:MF - * @pt:SHM - */ - -#include - -#ifndef POSIX_MADV_DONTNEED -#error POSIX_MADV_DONTNEED not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/8-1.c deleted file mode 100644 index 1b8003195d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/8-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the POSIX_TYPED_MEM_ALLOCATE flag for - * posix_typed_mem_open()(). - * - * @pt:TYM - */ - -#include - -#ifndef POSIX_TYPED_MEM_ALLOCATE -#error POSIX_TYPED_MEM_ALLOCATE not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/8-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/8-2.c deleted file mode 100644 index 887fc7aa2d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/8-2.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the POSIX_TYPED_MEM_ALLOCATE_CONTIG flag for - * posix_typed_mem_open()(). - * - * @pt:TYM - */ - -#include - -#ifndef POSIX_TYPED_MEM_ALLOCATE_CONTIG -#error POSIX_TYPED_MEM_ALLOCATE_CONTIG not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/8-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/8-3.c deleted file mode 100644 index e3f5e8cbf4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/8-3.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header defines the POSIX_TYPED_MEM_MAP_ALLOCATABLE flag for - * posix_typed_mem_open()(). - * - * @pt:TYM - */ - -#include - -#ifndef POSIX_TYPED_MEM_MAP_ALLOCATABLE -#error POSIX_TYPED_MEM_MAP_ALLOCATABLE not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/9-1.c deleted file mode 100644 index bb3fa8a9de..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/9-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that mode_t type is defined as described in sys/types.h. - */ - -#include - -mode_t this_type_should_exist; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/9-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/9-2.c deleted file mode 100644 index 4793ed989e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/9-2.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that off_t type is defined as described in sys/types.h. - */ - -#include - -off_t this_type_should_exist; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/9-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/9-3.c deleted file mode 100644 index 1b98f3318f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/9-3.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that size_t type is defined as described in sys/types.h. - */ - -#include - -size_t this_type_should_exist; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/assertions.xml deleted file mode 100644 index 8cb7495728..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/assertions.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - The sys/mman.h header file exists if the implementation supports at least - one of the following options: - MF - SHM - ML - MPR - TYM - SIO - ADV - - - The header defines the following protection options: - PROT_READ - PROT_WRITE - PROT_EXEC - PROT_NONE - - - The header defines the following flag options: - MAP_SHARED - MAP_PRIVATE - MAP_FIXED - - - The header defines the following flag options for msync(): - MS_ASYNC - MS_SYNC - MS_INVALIDATE - - - The header defines the following flag options for mlockall(): - MCL_CURRENT - MCL_FUTURE - - - The header defines the following symbolic constant: - MAP_FAILED - - - The header defines the following symbolic values: - POSIX_MADV_NORMAL - POSIX_MADV_SEQUENTIAL - POSIX_MADV_RANDOM - POSIX_MADV_WILLNEED - POSIX_MADV_DONTNEED - - - The header defines the following flags for posix_typed_mem_open(): - POSIX_TYPED_MEM_ALLOCATE - POSIX_TYPED_MEM_ALLOCATE_CONTIG - POSIX_TYPED_MEM_MAP_ALLOCATABLE - - - The mode_t, off_t, and size_t types shall be defined as described in - sys/types.h - - - The sys/mman.h header shall define the structure posix_typed_mem_info, - which includes at least the following member: - size_t posix_tmi_length - - - This function is defined: - int mlock(const void *, size_t) - - - This function is defined: - int mlockall(int) - - - This function is defined: - void *mmap(void *, size_t, int, int, int, off_t) - - - This function is defined: - int mprotect(void *, size_t, int) - - - This function is defined: - int msync(void *, size_t, int) - - - This function is defined: - int munlock(const void *, size_t) - - - This function is defined: - int munlockall(void) - - - This function is defined: - int munmap(void *, size_t) - - - This function is defined: - int posix_madvise(void *, size_t, int) - - - This function is defined: - int posix_mem_offset(const void *restrict, size_t, off_t *restrict, - size_t *restrict, int *restrict) - - - This function is defined: - int posix_typed_mem_get_info(int, struct posix_typed_mem_info *) - - - This function is defined: - int posix_typed_mem_open(const char *, int, int) - - - This function is defined: - int shm_open(const char *, int, mode_t) - - - This function is defined: - int shm_unlink(const char *) - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/coverage.txt deleted file mode 100644 index 9ac66dda76..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/mman_h/coverage.txt +++ /dev/null @@ -1,31 +0,0 @@ - -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES -8 YES -9 YES -10 YES -11 YES -12 YES -13 YES -14 YES -15 YES -16 YES -17 YES -18 YES -19 YES -20 YES -21 YES -22 YES -23 YES -24 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/1-1.c deleted file mode 100644 index afc329d4ec..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/1-1.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the sys/shm.h header file exists. - */ - -#include diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/10-1.c deleted file mode 100644 index 1a3c73c68c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/10-1.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int shmdt(const void *) - * is declared. - */ - -#include - -typedef int (*shmdt_test)(const void *); - -int dummyfcn (void) -{ - shmdt_test dummyvar; - dummyvar = shmdt; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/11-1.c deleted file mode 100644 index f18ff252a2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/11-1.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int shmget(key_t, size_t, int) - * is declared. - */ - -#include - -typedef int (*shmget_test)(key_t, size_t, int); - -int dummyfcn (void) -{ - shmget_test dummyvar; - dummyvar = shmget; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/12-1.c deleted file mode 100644 index 4e71c54469..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/12-1.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that all of the folowing symbolic constants from sys/ipc.h are defined: - * IPC_CREAT - * IPC_EXCL - * IPC_NOWAIT - * IPC_PRIVATE - * IPC_RMID - * IPC_SET - * IPC_STAT - */ - -#include - -#ifndef IPC_CREAT -#error IPC_CREAT not defined -#endif - -#ifndef IPC_EXCL -#error IPC_EXCL not defined -#endif - -#ifndef IPC_NOWAIT -#error IPC_NOWAIT not defined -#endif - -#ifndef IPC_PRIVATE -#error IPC_PRIVATE not defined -#endif - -#ifndef IPC_RMID -#error IPC_RMID not defined -#endif - -#ifndef IPC_SET -#error IPC_SET not defined -#endif - -#ifndef IPC_STAT -#error IPC_STAT not defined -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/12-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/12-2.c deleted file mode 100644 index 816b161cd9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/12-2.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the stuct ipc_perm from sys/ipc.h is defined. - */ - -#include - -struct ipc_perm this_type_should_exist; - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/12-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/12-3.c deleted file mode 100644 index 8cbdbffb9b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/12-3.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * key_t ftok(const char *, int) - * from sys/ipc.h is declared. - */ - -#include - -typedef key_t (*ftok_test)(const char *, int); - -int dummyfcn (void) -{ - ftok_test dummyvar; - dummyvar = ftok; - return 0; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/2-1.c deleted file mode 100644 index ad21354546..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/2-1.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header define the SHM_RDONLY symbolic constant. - */ - -#include - -#ifndef SHM_RDONLY -#error SHM_RDONLY not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/2-2.c deleted file mode 100644 index 8d160d0299..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/2-2.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header define the SHM_RND symbolic constant. - */ - -#include - -#ifndef SHM_RND -#error SHM_RND not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/3-1.c deleted file mode 100644 index 3cb1ffdfcc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/3-1.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header define the SHMLBA symbolic value. - */ - -#include - -#ifndef SHMLBA -#error SHMLBA not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/4-1.c deleted file mode 100644 index 0ccf30f4ee..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/4-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header define the shmatt_t type through typedef. - */ - -#include - -shmatt_t this_type_should_exist; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/5-1.c deleted file mode 100644 index bc32532af1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/5-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shmatt_t type is an unsigned integer that must be able to - * store values at least as large than unsigned short. - */ - - -#include -#include - -/* The minimun acceptable value for USHRT_MAX */ -#define MIN_USHRT_MAX 65535 - -shmatt_t tmin = 0; -shmatt_t tmax = USHRT_MAX; -shmatt_t tminmax = MIN_USHRT_MAX; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/6-1.c deleted file mode 100644 index d31e78ff1e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/6-1.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the header declares struct shmid_ds with the members below, at a - * minimum: - * struct ipc_perm shm_perm - * size_t shm_segsz - * pid_t shm_lpid - * pid_t shm_cpid - * shmatt_t shm_nattch - * time_t shm_atime - * time_t shm_dtime - * time_t shm_ctime - */ - -#include - -struct shmid_ds this_type_should_exist, t; - -int dummyfcn(void) -{ - struct ipc_perm perm = {0}; - size_t sz = 0; - pid_t lpid = 0, cpid = 0; - shmatt_t nattch = 0; - time_t atime = 0, dtime = 0, ctime = 0; - - t.shm_perm = perm; - t.shm_segsz = sz; - t.shm_lpid = lpid; - t.shm_cpid = cpid; - t.shm_nattch = nattch; - t.shm_atime = atime; - t.shm_dtime = dtime; - t.shm_ctime = ctime; - - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-1.c deleted file mode 100644 index 91016c5a1a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that pid_t type is defined as described in sys/types.h. - */ - -#include - -pid_t this_type_should_exist; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-2.c deleted file mode 100644 index 49e124c860..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-2.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that time_t type is defined as described in sys/types.h. - */ - -#include - -time_t this_type_should_exist; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-3.c deleted file mode 100644 index e59792231d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-3.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that key_t type is defined as described in sys/types.h. - */ - -#include - -key_t this_type_should_exist; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-4.c deleted file mode 100644 index 8abe8aad1a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/7-4.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that size_t type is defined as described in sys/types.h. - */ - -#include - -size_t this_type_should_exist; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/8-1.c deleted file mode 100644 index f921c5ffac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/8-1.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * void *shmat(int, const void *, int) - * is declared. - */ - -#include - -typedef void* (*shmat_test)(int, const void *, int); - -int dummyfcn (void) -{ - shmat_test dummyvar; - dummyvar = shmat; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/9-1.c deleted file mode 100644 index b9e340d5e3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/9-1.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the function: - * int shmctl(int, int, struct shmid_ds *) - * is declared. - */ - -#include - -typedef int (*shmctl_test)(int, int, struct shmid_ds *); - -int dummyfcn (void) -{ - shmctl_test dummyvar; - dummyvar = shmctl; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/assertions.xml deleted file mode 100644 index 7daf0f5b0d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/assertions.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - The sys/shm.h header file exists - - - The header define the following symbolic constants: - - SHM_RDONLY - - SHM_RND - - - The header define the following symbolic value: - - SHMLBA - - - The header define the following type through typedef: - - shmatt_t - - - The shmatt_t type is an unsigned integer that must be able to store values - at least as large than unsigned short. - - - The header declares struct shmid_ds with the members below, at a minimum: - struct ipc_perm shm_perm - size_t shm_segsz - pid_t shm_lpid - pid_t shm_cpid - shmatt_t shm_nattach - time_t shm_atime - time_t shm_dtime - time_t shm_ctime - - - The pid_t, time_t, key_t, and size_t types shall be defined as described in - sys/types.h - - - This function is defined: - void *shmat(int, const void *, int) - - - This function is defined: - int shmctl(int, int, struct shmid_ds *) - - - This function is defined: - int shmdt(const void *) - - - This function is defined: - int shmget(key_t, size_t, int) - - - All of the symbols from sys/ipc.h are defined when the sys/shm.h header is - included - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/coverage.txt deleted file mode 100644 index a5292da68e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/sys/shm_h/coverage.txt +++ /dev/null @@ -1,20 +0,0 @@ - -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES -8 YES -9 YES -10 YES -11 YES -12 YES - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/1-1.c deleted file mode 100644 index cb02994974..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/1-1.c +++ /dev/null @@ -1,12 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test the existence of the time.h file and that it can be - included. - */ - -#include diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/10-1.c deleted file mode 100644 index bee2d9f6f3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/10-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the function: - clock_t clock(void); - is declared. - */ - -#include - -typedef clock_t (*clock_test)(void); - -int dummyfcn (void) -{ - clock_test dummyvar; - dummyvar = clock; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/11-1.c deleted file mode 100644 index 2ff21eebdb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/11-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:CPT - Test that the function: - int clock_getcpuclockid(pid_t, clockid_t *); - is declared. - */ - -#include - -typedef int (*clock_getcpuclockid_test)(pid_t, clockid_t *); - -int dummyfcn (void) -{ - clock_getcpuclockid_test dummyvar; - dummyvar = clock_getcpuclockid; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/12-1.c deleted file mode 100644 index 69cf050bcf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/12-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that the function: - int clock_getres(clockid_t, struct timespec *); - is declared. - */ - -#include - -typedef int (*clock_getres_test)(clockid_t, struct timespec *); - -int dummyfcn (void) -{ - clock_getres_test dummyvar; - dummyvar = clock_getres; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/13-1.c deleted file mode 100644 index c1f0f499b8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/13-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that the function: - int clock_gettime(clockid_t, struct timespec *); - is declared. - */ - -#include - -typedef int (*clock_gettime_test)(clockid_t, struct timespec *); - -int dummyfcn (void) -{ - clock_gettime_test dummyvar; - dummyvar = clock_gettime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/14-1.c deleted file mode 100644 index 44644e28fd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/14-1.c +++ /dev/null @@ -1,25 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:CS - Test that the function: - int clock_nanosleep(clockid_t, int, const struct timespec *, - struct timespec *); - is declared. - */ - -#include - -typedef int (*clock_nanosleep_test)(clockid_t, int, const struct timespec *, - struct timespec *); - -int dummyfcn (void) -{ - clock_nanosleep_test dummyvar; - dummyvar = clock_nanosleep; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/15-1.c deleted file mode 100644 index ed0f17bcf3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/15-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that the function: - int clock_settime(clockid_t, const struct timespec *); - is declared. - */ - -#include - -typedef int (*clock_settime_test)(clockid_t, const struct timespec *); - -int dummyfcn (void) -{ - clock_settime_test dummyvar; - dummyvar = clock_settime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/16-1.c deleted file mode 100644 index 6cb7918589..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/16-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the function: - char *ctime(const time_t *); - is declared. - */ - -#include - -typedef char *(*ctime_test)(const time_t *); - -int dummyfcn (void) -{ - ctime_test dummyvar; - dummyvar = ctime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/17-1.c deleted file mode 100644 index b50a2431ef..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/17-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TSF - Test that the function: - char *ctime_r(const time_t *, char *); - is declared. - */ - -#include - -typedef char *(*ctime_r_test)(const time_t *, char *); - -int dummyfcn (void) -{ - ctime_r_test dummyvar; - dummyvar = ctime_r; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/18-1.c deleted file mode 100644 index 96d37de7d7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/18-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the function: - double difftime(time_t, time_t); - is declared. - */ - -#include - -typedef double (*difftime_test)(time_t, time_t); - -int dummyfcn (void) -{ - difftime_test dummyvar; - dummyvar = difftime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/19-1.c deleted file mode 100644 index 60e9e96ed8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/19-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:XSI - Test that the function: - struct tm *getdate(const char *); - is declared. - */ - -#include - -typedef struct tm *(*getdate_test)(const char *); - -int dummyfcn (void) -{ - getdate_test dummyvar; - dummyvar = getdate; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/2-1.c deleted file mode 100644 index 898c97ab2a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/2-1.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that tm structure is declared. - */ -#include - -struct tm this_type_should_exist, t; - -int dummyfcn(void) -{ - int week, year, dst; - - t.tm_sec = 0; - t.tm_min = 10; - t.tm_hour = 17; - t.tm_mday = 1; - t.tm_mon = 11; - t.tm_year = 102; - week = t.tm_wday; - year = t.tm_yday; - dst = t.tm_isdst; - - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/20-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/20-1.c deleted file mode 100644 index 715f1694ca..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/20-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the function: - struct tm *gmtime(const time_t *); - is declared. - */ - -#include - -typedef struct tm *(*gmtime_test)(const time_t *); - -int dummyfcn (void) -{ - gmtime_test dummyvar; - dummyvar = gmtime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/21-1.c deleted file mode 100644 index 79de56f471..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/21-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TSF - Test that the function: - struct tm *gmtime_r(const time_t *, struct tm *); - is declared. - */ - -#include - -typedef struct tm *(*gmtime_r_test)(const time_t *, struct tm *); - -int dummyfcn (void) -{ - gmtime_r_test dummyvar; - dummyvar = gmtime_r; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/22-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/22-1.c deleted file mode 100644 index bdc05e6881..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/22-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the function: - struct tm *localtime(const time_t *); - is declared. - */ - -#include - -typedef struct tm *(*localtime_test)(const time_t *); - -int dummyfcn (void) -{ - localtime_test dummyvar; - dummyvar = localtime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/23-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/23-1.c deleted file mode 100644 index 61c3862671..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/23-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TSF - Test that the function: - struct tm *localtime_r(const time_t *, struct tm *); - is declared. - */ - -#include - -typedef struct tm *(*localtime_r_test)(const time_t *, struct tm *); - -int dummyfcn (void) -{ - localtime_r_test dummyvar; - dummyvar = localtime_r; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/24-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/24-1.c deleted file mode 100644 index 7d41abd761..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/24-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the function: - time_t mktime(struct tm *); - is declared. - */ - -#include - -typedef time_t (*mktime_test)(struct tm *); - -int dummyfcn (void) -{ - mktime_test dummyvar; - dummyvar = mktime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/25-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/25-1.c deleted file mode 100644 index 40aaea9053..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/25-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that the function: - int nanosleep(const struct timespec *, struct timespec *); - is declared. - */ - -#include - -typedef int (*nanosleep_test)(const struct timespec *, struct timespec *); - -int dummyfcn (void) -{ - nanosleep_test dummyvar; - dummyvar = nanosleep; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/26-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/26-1.c deleted file mode 100644 index 9b8e9b39e6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/26-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the function: - size_t strftime(char *, size_t, const char *, const struct tm *); - is declared. - */ - -#include - -typedef size_t (*strftime_test)(char *, size_t, const char *, const struct tm *); - -int dummyfcn (void) -{ - strftime_test dummyvar; - dummyvar = strftime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/27-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/27-1.c deleted file mode 100644 index 7c95a874c3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/27-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:XSI - Test that the function: - char *strptime(const char *, const char *, struct tm *); - is declared. - */ - -#include - -typedef char *(*strptime_test)(const char *, const char *, struct tm *); - -int dummyfcn (void) -{ - strptime_test dummyvar; - dummyvar = strptime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/28-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/28-1.c deleted file mode 100644 index 5286692c86..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/28-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the function: - time_t time(time_t *); - is declared. - */ - -#include - -typedef time_t (*time_test)(time_t *); - -int dummyfcn (void) -{ - time_test dummyvar; - dummyvar = time; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/29-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/29-1.c deleted file mode 100644 index 07b38839dd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/29-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that the function: - int timer_create(clockid_t, struct sigevent *, timer_t *); - is declared. - */ - -#include - -typedef int (*timer_create_test)(clockid_t, struct sigevent *, timer_t *); - -int dummyfcn (void) -{ - timer_create_test dummyvar; - dummyvar = timer_create; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-1.c deleted file mode 100644 index 8837ec0d12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-1.c +++ /dev/null @@ -1,15 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that NULL is defined - */ - -#include - -#ifndef NULL -#error NULL not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-2.c deleted file mode 100644 index 1f326b0f54..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-2.c +++ /dev/null @@ -1,15 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that CLOCKS_PER_SEC is defined - */ - -#include - -#ifndef CLOCKS_PER_SEC -#error CLOCKS_PER_SEC not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-3.c deleted file mode 100644 index afb939b7f7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-3.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - @pt:CPT - Test that CLOCK_PROCESS_CPUTIME_ID is defined - */ - -#include - -#ifndef CLOCK_PROCESS_CPUTIME_ID -#error CLOCK_PROCESS_CPUTIME_ID not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-4.c deleted file mode 100644 index 89ac711210..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/3-4.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - @pt:TCT - Test that CLOCK_THREAD_CPUTIME_ID is defined - */ - -#include - -#ifndef CLOCK_THREAD_CPUTIME_ID -#error CLOCK_THREAD_CPUTIME_ID not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/30-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/30-1.c deleted file mode 100644 index e6c7eaed1e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/30-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that the function: - int timer_delete(timer_t); - is declared. - */ - -#include - -typedef int (*timer_delete_test)(timer_t); - -int dummyfcn (void) -{ - timer_delete_test dummyvar; - dummyvar = timer_delete; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/31-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/31-1.c deleted file mode 100644 index 379ae4fcb8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/31-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that the function: - int timer_gettime(timer_t, struct itimerspec *); - is declared. - */ - -#include - -typedef int (*timer_gettime_test)(timer_t, struct itimerspec *); - -int dummyfcn (void) -{ - timer_gettime_test dummyvar; - dummyvar = timer_gettime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/32-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/32-1.c deleted file mode 100644 index 38faa03c57..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/32-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that the function: - int timer_getoverrun(timer_t); - is declared. - */ - -#include - -typedef int (*timer_getoverrun_test)(timer_t); - -int dummyfcn (void) -{ - timer_getoverrun_test dummyvar; - dummyvar = timer_getoverrun; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/33-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/33-1.c deleted file mode 100644 index c2e92e9dbe..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/33-1.c +++ /dev/null @@ -1,25 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that the function: - int timer_settime(timer_t, int, const struct itimerspec *, - struct itimerspec *); - is declared. - */ - -#include - -typedef int (*timer_settime_test)(timer_t, int, const struct itimerspec *, - struct itimerspec *); - -int dummyfcn (void) -{ - timer_settime_test dummyvar; - dummyvar = timer_settime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/34-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/34-1.c deleted file mode 100644 index 9e21524afd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/34-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the function: - void tzset(void); - is declared. - */ - -#include - -typedef void (*tzset_test)(void); - -int dummyfcn (void) -{ - tzset_test dummyvar; - dummyvar = tzset; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/35-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/35-1.c deleted file mode 100644 index 6213346aec..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/35-1.c +++ /dev/null @@ -1,20 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:XSI - Test that daylight is declared. - */ - -#include - -int dummyfcn (void) -{ - int dummy; - - dummy = daylight; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/35-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/35-2.c deleted file mode 100644 index a1781ccf8f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/35-2.c +++ /dev/null @@ -1,19 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that timezone is declared. - */ - -#include - -int dummyfcn (void) -{ - long dummy; - - dummy = timezone; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/35-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/35-3.c deleted file mode 100644 index 04b9b9c90e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/35-3.c +++ /dev/null @@ -1,21 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:CX - Test that tzname is declared. - */ - -#include -#include -/* Include for printf */ -#include - -int dummyfcn (void) -{ - printf("%s\n",tzname[0]); - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/4-1.c deleted file mode 100644 index 524c0aab0a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/4-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that timespec structure is declared. - */ -#include - -struct timespec this_type_should_exist, t; - -int dummyfcn(void) -{ - time_t sec; - long nsec; - - sec = t.tv_sec; - nsec = t.tv_nsec; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/5-1.c deleted file mode 100644 index df6cac3445..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/5-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that itimerspec structure is declared. - */ -#include - -struct itimerspec this_type_should_exist, t; - -int dummyfcn(void) -{ - struct timespec interval; - struct timespec value; - - interval = t.it_interval; - value = t.it_value; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/6-1.c deleted file mode 100644 index 8050eef265..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/6-1.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that CLOCK_REALTIME is defined - */ - -#include - -#ifndef CLOCK_REALTIME -#error CLOCK_REALTIME not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/6-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/6-2.c deleted file mode 100644 index ae8f2a4ac4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/6-2.c +++ /dev/null @@ -1,16 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - Test that TIMER_ABSTIME is defined - */ - -#include - -#ifndef TIMER_ABSTIME -#error TIMER_ABSTIME not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/6-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/6-3.c deleted file mode 100644 index f0a6c4f9b5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/6-3.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TMR - @pt:MON - Test that CLOCK_MONOTONIC is defined - */ - -#include - -#ifndef CLOCK_MONOTONIC -#error CLOCK_MONOTONIC not defined -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-1.c deleted file mode 100644 index a9404f79b3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-1.c +++ /dev/null @@ -1,13 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that clock_t is defined. - */ - -#include - -clock_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-2.c deleted file mode 100644 index a78c71b516..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-2.c +++ /dev/null @@ -1,13 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that size_t is defined. - */ - -#include - -size_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-3.c deleted file mode 100644 index 436708bc6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-3.c +++ /dev/null @@ -1,13 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that time_t is defined. - */ - -#include - -time_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-4.c deleted file mode 100644 index 75d73e959b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-4.c +++ /dev/null @@ -1,13 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that clockid_t is defined. - */ - -#include - -clockid_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-5.c deleted file mode 100644 index 731f037327..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/7-5.c +++ /dev/null @@ -1,13 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that timer_t is defined. - */ - -#include - -timer_t dummy; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/8-1.c deleted file mode 100644 index becab8347b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/8-1.c +++ /dev/null @@ -1,22 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the function: - char *asctime(const struct tm *); - is declared. - */ - -#include - -typedef char *(*asctime_test)(const struct tm *); - -int dummyfcn (void) -{ - asctime_test dummyvar; - dummyvar = asctime; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/9-1.c deleted file mode 100644 index 082e437807..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/9-1.c +++ /dev/null @@ -1,23 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - @pt:TSF - Test that the function: - char *asctime_r(const struct tm *, char *); - is declared. - */ - -#include - -typedef char *(*asctime_r_test)(const struct tm *, char *); - -int dummyfcn (void) -{ - asctime_r_test dummyvar; - dummyvar = asctime_r; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/assertions.xml deleted file mode 100644 index 058bed15c9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/assertions.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - The time.h file exists. - - - The time.h header declares struct tm with the members below, at a - minimum: - tm_sec - tm_min - tm_hour - tm_mday - tm_mon - tm_year - tm_wday - tm_yday - tm_isdst - - - The time.h header defines the symbolic names below: - NULL - CLOCKS_PER_SEC - CLOCK_PROCESS_CPUTIME_ID (TMR,CPT) - CLOCK_THREAD_CPUTIME_ID (TMR,TCT) - - - The time.h header declares struct timespec with the members below, at - a minimum: - time_t tv_sec - long tv_nsec - - - The time.h header declares struct itimerspec with the members below, at - a minimum: - struct timespec it_interval - struct timespec it_value - - - The manifest constants below are defined: - CLOCK_REALTIME - TIMER_ABSTIME - CLOCK_MONOTONIC (@pt:MON) - - - sys/types.h shall define clock_t, size_t, time_t, clockid_t (@pt:TMR), - and timer_t (@pt:TMR). - - - The function below is defined: - char *asctime(const struct tm *); - - - The function below is defined: - char *asctime_r(const struct tm *restrict, char *restrict); - - - The function below is defined: - clock_t clock(void); - - - The function below is defined: - int clock_getcpuclockid(pid_t, clockid_t *); - - - The function below is defined: - int clock_getres(clockid_t, struct timespec *); - - - The function below is defined: - int clock_gettime(clockid_t, struct timespec *); - - - The function below is defined: - int clock_nanosleep(clockid_t, int, const struct timespec *, - struct timespec *); - - - The function below is defined: - int clock_settime(clockid_t, const struct timespec *); - - - The function below is defined: - char *ctime(const time_t *); - - - The function below is defined: - char *ctime_r(const time_t *, char *); - - - The function below is defined: - double difftime(time_t, time_t); - - - The function below is defined: - struct tm *getdate(const char *); - - - The function below is defined: - struct tm *gmtime(const time_t *); - - - The function below is defined: - struct tm *gmtime_r(const time_t *restrict, struct tm *restrict); - - - The function below is defined: - struct tm *localtime(const time_t *); - - - The function below is defined: - struct tm *localtime_r(const time_t *restrict, struct tm *restrict); - - - The function below is defined: - time_t mktime(struct tm *); - - - The function below is defined: - int nanosleep(const struct timespec *, struct timespec *); - - - The function below is defined: - size_t strftime(char *restrict, size_t, const char *restrict, - const struct tm *restrict); - - - The function below is defined: - char *strptime(const char *restrict, const char *restrict, - struct tm *restrict); - - - The function below is defined: - time_t time(time_t *); - - - The function below is defined: - int timer_create(clockid_t, struct sigevent *restrict, - timer_t *restrict); - - - The function below is defined: - int timer_delete(timer_t); - - - The function below is defined: - int timer_gettime(timer_t, struct itimerspec *); - - - The function below is defined: - int timer_getoverrun(timer_t); - - - The function below is defined: - int timer_settime(timer_t, int, const struct itimerspec *restrict, - struct itimerspec *restrict); - - - The function below is defined: - void tzset(void); - - - The variables below are declared: - extern int daylight; (@pt:XSI) - extern long timezone; - extern char *tzname[]; (@pt:CX) - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/coverage.txt deleted file mode 100644 index dfdc8af5dd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/time_h/coverage.txt +++ /dev/null @@ -1,41 +0,0 @@ -This document defines the coverage for -conformance/definitions/time_h -testing - - -Assertion # Covered? -1 YES -2 YES -3 YES -4 YES - Assigns uninitialized values, but works. -5 YES - Assigns uninitialized values, but works. -6 YES - 6.3 fails on current test impl. b/c no MON implemented -7 YES - 7.1 fails on my impl -- BUG? -8 YES -9 YES -10 YES -11 YES - Fails on current test impl b/c no CPT implemented -12 YES -13 YES -14 YES - Fails on current test impl b/c no CS implemented -15 YES -16 YES -17 YES -18 YES -19 YES - Fails on current test impl b/c no XSI implemented -20 YES -21 YES -22 YES -23 YES -24 YES -25 YES -26 YES -27 YES - Fails on current test impl b/c no XSI implemented -28 YES -29 YES -30 YES -31 YES -32 YES -33 YES -34 YES -35 YES - Not 100% sure that I declared the vars correctly in 35-3 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/unistd_h/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/unistd_h/1-1.c deleted file mode 100644 index d32f2ad039..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/unistd_h/1-1.c +++ /dev/null @@ -1,21 +0,0 @@ - /* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that the function below is defined: - * int fsync(int fildes); - */ - -#include - -typedef int (*fsync_test)(int fildes); - -int dummyfcn (void) -{ - fsync_test dummyvar; - dummyvar = fsync; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/unistd_h/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/unistd_h/2-1.c deleted file mode 100644 index 6844c0fb0f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/unistd_h/2-1.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Based on original code by Julie N Fleischer. - * - * Test that the function below is defined: - * int ftruncate(int fildes, off_t length); - */ - -#include -#include - -typedef int (*ftruncate_test)(int fildes, off_t length); - -int dummyfcn (void) -{ - ftruncate_test dummyvar; - dummyvar = ftruncate; - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/unistd_h/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/unistd_h/assertions.xml deleted file mode 100644 index 7bad14ce3e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/definitions/unistd_h/assertions.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - The function below is defined: - int fsync(int fildes); - - - The function below is defined: - int ftruncate(int fildes, off_t length); - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/1-1.c deleted file mode 100644 index 1796d108d4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/1-1.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The aiocbp argument points to the AIO control block to be canceled. - * - * method: - * - * - create a valid aiocb with a call to aio_write() - * - call aio_cancel() with this aiocb and check return value is not -1 - * -> aio_cancel() works with a valid (finished or not) aiocb - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/1-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 1024 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_1_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - if (aio_cancel(fd, &aiocb) == -1) - { - printf(TNAME " Error at aio_cancel(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/10-1.c deleted file mode 100644 index 765a5b7c2d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/10-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* assertion: - * - * aio_cancel() shall fail if: - * [EBADF] The fildes argument is not a valid descriptor. - * - * method: - * - * use -1 as fildes and check return value is -1 and errno is EBADF - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/10-1.c" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - if (aio_cancel(-1, NULL) != -1) - { - printf(TNAME " bad aio_cancel return value()\n"); - return PTS_FAIL; - } - - if (errno != EBADF) - { - printf(TNAME " errno is not EBADF %s\n", strerror(errno)); - return PTS_FAIL; - } - - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/2-1.c deleted file mode 100644 index ba0b19f81d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/2-1.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * if aiobcp is NULL, all outstanding cancelable AIO against fildes - * shall be canceled. - * - * method: - * - * open a file and queue a write to it with aio_write() - * execute aio_cancel() on this file - * check aio_cancel() is not -1 - * -> aio_cancel() works on fildes used with an aio command - * - * we have no way to assert we generate "cancelable" AIO and thus to check - * if it has been really canceled - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/2-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 1024 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_2_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - if (aio_cancel(fd, NULL) == -1) - { - printf(TNAME " Error at aio_cancel(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/2-2.c deleted file mode 100644 index 7af51b6f5e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/2-2.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * if aiobcp is NULL, all outstanding cancelable AIO against fildes - * shall be canceled. - * - * method: - * - * open a file - * execute aio_cancel() on this file - * check aio_cancel() is not -1 - * -> aio_cancel() works on standard fildes - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/2-2.c" - -int main() -{ - char tmpfname[256]; - int fd; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_2_2_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - if (aio_cancel(fd, NULL) == -1) - { - printf(TNAME " Error at aio_cancel(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/3-1.c deleted file mode 100644 index 3f7f4e128a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/3-1.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * Asynchronous notification shall occur for AIO that are successfully - * cancelled. - * - * method: - * - * we queue a lot of aio_write() with a valid sigevent to a file descriptor - * next we try to cancel all operations on this file descriptor - * we guess some have been finished, other are in progress, - * other are waiting - * we guess we can cancel all operations waiting - * then we analyze aio_error() in the event handler - * if aio_error() is ECANCELED, the test is passed - * otherwise, we don't know (perhaps we haven't cancel any operation ?) - * if number of sig event is not equal to number of aio_write() - * the test fails (in fact it hangs). - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/3-1.c" - -#define BUF_NB 128 -#define BUF_SIZE 1024 - -static volatile int countdown = BUF_NB; -static volatile int canceled = 0; - -void sigusr1_handler(int signum, siginfo_t *info, void *context) -{ - struct aiocb *a = info->si_value.sival_ptr; - - if (aio_error(a) == ECANCELED) - canceled++; - - aio_return(a); /* free entry */ - - free((void*)a->aio_buf); - free(a); - - countdown--; -} - -int main() -{ - char tmpfname[256]; - int fd; - struct aiocb *aiocb; - struct sigaction action; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_3_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - /* install signal handler */ - - action.sa_sigaction = sigusr1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - if (sigaction(SIGRTMIN+1, &action, NULL)) - { - printf(TNAME " Error at sigaction(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - /* create AIO req */ - - for (i = 0; i < BUF_NB; i++) - { - aiocb = malloc(sizeof(struct aiocb)); - if (aiocb == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - aiocb->aio_fildes = fd; - aiocb->aio_buf = malloc(BUF_SIZE); - if (aiocb->aio_buf == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - aiocb->aio_nbytes = BUF_SIZE; - aiocb->aio_offset = 0; - - aiocb->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocb->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocb->aio_sigevent.sigev_value.sival_ptr = aiocb; - - if (aio_write(aiocb) == -1) - { - printf(TNAME " loop %d: Error at aio_write(): %s\n", - i, strerror(errno)); - return PTS_FAIL; - } - } - - /* try to cancel all - * we hope to have enough time to cancel at least one - */ - - if (aio_cancel(fd, NULL) == -1) - { - printf(TNAME " Error at aio_cancel(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - close(fd); - - while(countdown); - - if (!canceled) - return PTS_UNRESOLVED; - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/4-1.c deleted file mode 100644 index a3a3c6cbe9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/4-1.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * Error status should be set to [ECANCELED] and return shall be -1 for - * successfully canceled AIO. - * - * method: - * - * we queue a lot of aio_write() operation to a file descriptor - * then we try to cancel all aio operation of this file descriptor - * we check with aio_error() state of each operation - * if aio_error() is ECANCELED and aio_return() is -1 - * test is passed - * if aio_error() is ECANCELED and aio_return() is NOT -1 - * test fails - * otherwise - * test is unresolved - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/4-1.c" - -#define BUF_NB 128 -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - int fd; - struct aiocb *aiocb[BUF_NB]; - int i; - int in_progress; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_4_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - /* create AIO req */ - - for (i = 0; i < BUF_NB; i++) - { - aiocb[i] = malloc(sizeof(struct aiocb)); - if (aiocb[i] == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - aiocb[i]->aio_fildes = fd; - aiocb[i]->aio_buf = malloc(BUF_SIZE); - if (aiocb[i]->aio_buf == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - aiocb[i]->aio_nbytes = BUF_SIZE; - aiocb[i]->aio_offset = 0; - aiocb[i]->aio_sigevent.sigev_notify = SIGEV_NONE; - - if (aio_write(aiocb[i]) == -1) - { - printf(TNAME " loop %d: Error at aio_write(): %s\n", - i, strerror(errno)); - return PTS_FAIL; - } - } - - /* try to cancel all - * we hope to have enough time to cancel at least one - */ - - if (aio_cancel(fd, NULL) == -1) - { - printf(TNAME " Error at aio_cancel(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - close(fd); - - do { - in_progress = 0; - for (i = 0; i < BUF_NB; i++) - { - int ret; - - ret = (aio_error(aiocb[i])); - - if (ret == -1) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - else if (ret == EINPROGRESS) - in_progress = 1; - else if (ret == ECANCELED) - { - if (aio_return(aiocb[i]) == -1) - { - printf ("Test PASSED\n"); - return PTS_PASS; - } - - printf(TNAME " aio_return is not -1\n"); - return PTS_FAIL; - } - } - } while (in_progress); - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/5-1.c deleted file mode 100644 index 65531cfeea..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/5-1.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * iocbp not successfully canceled shall not be modified - * - * method: - * - * queue a some aio_write() to a file descriptor - * cancel all operations for this file descriptor - * for all operations not canceled at end of operations - * verify that values in aiocb is the good ones - * if all operations are canceled, result is unresolved - * if some operation not canceled are modified, test fails - * if all operations not canceled (at least one) are good - * result is pass - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/5-1.c" - -#define BUF_NB 128 -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - int fd; - struct aiocb *aiocb[BUF_NB]; - char *buf[BUF_NB]; - int i; - int in_progress; - static int check_one; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_5_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - /* create AIO req */ - - for (i = 0; i < BUF_NB; i++) - { - aiocb[i] = malloc(sizeof(struct aiocb)); - if (aiocb[i] == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - buf[i] = malloc(BUF_SIZE); - if (buf[i] == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - aiocb[i]->aio_fildes = fd; - aiocb[i]->aio_buf = buf[i]; - aiocb[i]->aio_nbytes = BUF_SIZE; - aiocb[i]->aio_offset = 0; - aiocb[i]->aio_sigevent.sigev_notify = SIGEV_NONE; - - if (aio_write(aiocb[i]) == -1) - { - printf(TNAME " loop %d: Error at aio_write(): %s\n", - i, strerror(errno)); - return PTS_FAIL; - } - } - - /* try to cancel all - * we hope to have enough time to cancel at least one - */ - - if (aio_cancel(fd, NULL) == -1) - { - printf(TNAME " Error at aio_cancel(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - close(fd); - - check_one = 0; - do { - in_progress = 0; - for (i = 0; i < BUF_NB; i++) - { - int ret; - - ret = (aio_error(aiocb[i])); - - if (ret == -1) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - else if ((ret == EINPROGRESS) || (ret == 0)) - { - if (ret == EINPROGRESS) - in_progress = 1; - - check_one = 1; - - /* check iocb is not modified */ - - if ( (aiocb[i]->aio_fildes != fd) || - (aiocb[i]->aio_buf != buf[i]) || - (aiocb[i]->aio_nbytes != BUF_SIZE) || - (aiocb[i]->aio_offset != 0) || - (aiocb[i]->aio_sigevent.sigev_notify - != SIGEV_NONE) ) - { - printf(TNAME " aiocbp modified\n"); - return PTS_FAIL; - } - } - } - } while (in_progress); - - if (!check_one) - return PTS_UNRESOLVED; - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/6-1.c deleted file mode 100644 index cc0b5e23b0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/6-1.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_cancel() shall return AIO_CANCELED if the requested operations - * were canceled. - * - * method: - * - * queue a lot of aio_write() to a given fildes. - * try to cancel the last one submited - * if aio_error() is ECANCELED and aio_cancel() is AIO_CANCELED - * test is passed - * if aio_error() is ECANCELED and aio_cancel() is NOT AIO_CANCELED - * test is failed - * if there is no aio_error() with ECANCELED and - * aio_cancel() is AIO_CANCELED - * test is failed - * otherwise test is unresolved - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/6-1.c" - -#define BUF_NB 128 -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - int fd; - struct aiocb *aiocb[BUF_NB]; - int i; - int in_progress; - int gret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_6_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - /* create AIO req */ - - for (i = 0; i < BUF_NB; i++) - { - aiocb[i] = malloc(sizeof(struct aiocb)); - if (aiocb[i] == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - aiocb[i]->aio_fildes = fd; - aiocb[i]->aio_buf = malloc(BUF_SIZE); - if (aiocb[i]->aio_buf == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - aiocb[i]->aio_nbytes = BUF_SIZE; - aiocb[i]->aio_offset = 0; - aiocb[i]->aio_sigevent.sigev_notify = SIGEV_NONE; - - if (aio_write(aiocb[i]) == -1) - { - printf(TNAME " loop %d: Error at aio_write(): %s\n", - i, strerror(errno)); - return PTS_FAIL; - } - } - - /* try to cancel the last one queued */ - - gret = aio_cancel(fd, aiocb[i-1]); - - if (gret == -1) - { - printf(TNAME " Error at aio_cancel(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - close(fd); - - do { - in_progress = 0; - for (i = 0; i < BUF_NB; i++) - { - int ret; - - ret = (aio_error(aiocb[i])); - - if (ret == -1) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - else if (ret == EINPROGRESS) - in_progress = 1; - else if (ret == ECANCELED) - { - if (gret == AIO_CANCELED) - { - printf ("Test PASSED\n"); - return PTS_PASS; - } - - printf(TNAME " aio_cancel() is not AIO_CANCELED\n"); - return PTS_FAIL; - } - } - } while (in_progress); - - if (gret == AIO_CANCELED) - { - printf(TNAME " aio_cancel() is AIO_CANCELED without ECANCELED\n"); - return PTS_FAIL; - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/7-1.c deleted file mode 100644 index 8db24ab211..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/7-1.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_cancel() shall return AIO_NOTCANCELED if at least one of the - * requested operations cannot be canceled because it is in progress. - * - * method: - * - * queue a lot of aio_write() to a given file descriptor - * then cancel all operation belonging to this file descriptor - * check result of each operation: - * - if aio_error() is EINPROGRESS and aio_cancel() is not AIO_NOTCANCELED - * result is failed - * - if aio_error() is succes (0) and aio_cancel() is AIO_NOTCANCELED - * result is susccess - * - otherwise result is unresolved - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/7-1.c" - -#define BUF_NB 128 -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - int fd; - struct aiocb *aiocb[BUF_NB]; - int i; - int in_progress; - int gret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_7_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - /* create AIO req */ - - for (i = 0; i < BUF_NB; i++) - { - aiocb[i] = malloc(sizeof(struct aiocb)); - if (aiocb[i] == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - aiocb[i]->aio_fildes = fd; - aiocb[i]->aio_buf = malloc(BUF_SIZE); - if (aiocb[i]->aio_buf == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - aiocb[i]->aio_nbytes = BUF_SIZE; - aiocb[i]->aio_offset = 0; - aiocb[i]->aio_sigevent.sigev_notify = SIGEV_NONE; - - if (aio_write(aiocb[i]) == -1) - { - printf(TNAME " loop %d: Error at aio_write(): %s\n", - i, strerror(errno)); - return PTS_FAIL; - } - } - - /* try to cancel all - * we hope to have enough time to cancel at least one - */ - - gret = aio_cancel(fd, NULL); - if (gret == -1) - { - printf(TNAME " Error at aio_cancel(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - close(fd); - - do { - in_progress = 0; - for (i = 0; i < BUF_NB; i++) - { - int ret; - - ret = (aio_error(aiocb[i])); - - if (ret == -1) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - else if (ret == EINPROGRESS) - { - /* at this point, all operations should be: - * canceled - * or in progress - * with aio_cancel() == AIO_NOTCANCELED - */ - - if (gret != AIO_NOTCANCELED) - { - printf(TNAME " Error at aio_error(): %s\n", strerror(errno)); - return PTS_FAIL; - } - - in_progress = 1; - } - else if (ret == 0) - { - /* we seek one not canceled and check why. - * (perhaps) it has not been canceled - * because it was in progress - * during the cancel operation - */ - - if (gret == AIO_NOTCANCELED) - { - printf ("Test PASSED\n"); - return PTS_PASS; - } - } - } - } while (in_progress); - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/8-1.c deleted file mode 100644 index ff3ecc8a4f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/8-1.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_cancel() shall return AIO_ALLDONE if all operation have already - * completed - * - * method: - * - * execute one aio_write(), wait it is finished - * execute aio_cancel - * if result is AIO_ALLDONE, test is passed - * otherwise it is failed - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/8-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 1024 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_1_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - while (aio_error(&aiocb) == EINPROGRESS); - - if (aio_cancel(fd, &aiocb) != AIO_ALLDONE) - { - printf(TNAME " Error at aio_cancel(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/9-1.c deleted file mode 100644 index cffa56077e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/9-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * io_cancel() shall return -1 and set errno in all other case. - * - * method: - * - * call aio_cancel() with invalid parameter and check result is -1 - * and errno is not 0 - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_cancel/9-1.c" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - if (aio_cancel(-1, NULL) != -1) - { - printf(TNAME " bad aio_cancel return value()\n"); - return PTS_FAIL; - } - - if (errno == 0) - { - printf(TNAME " bad errno value()\n"); - return PTS_FAIL; - } - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/assertions.xml deleted file mode 100644 index 2be36f6b49..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/assertions.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - The aiocbp argument points to the AIO control block to be canceled. - - - if aiobcp is NULL, all outstanding cancelable AIO against fildes - shall be canceled. - - - Asynchronous notification shall occur for AIO that are successfully - cancelled. - - - Error status should be set to [ECANCELED] and return shall be -1 for - successfully canceled AIO. - - - aiocbp not successfully canceled shall not be modified - - - aio_cancel() shall return AIO_CANCELED if the requested operations - were canceled. - - - aio_cancel() shall return AIO_NOTCANCELED if at least one of the - requested operations cannot be canceled because it is in progress. - - - aio_cancel() shall return AIO_ALLDONE if all operation have already - completed - - - aio_cancel() shall return -1 and set errno in all other case. - - - aio_cancel() shall fail if: - [EBADF] The fildes argument is not a valid descriptor. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/coverage.txt deleted file mode 100644 index 9626d332c0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_cancel/coverage.txt +++ /dev/null @@ -1,21 +0,0 @@ -this file defines the coverage for the aio_cancel() function testing. - -Assertion Covered? -1 YES -2 YES -3 YES * -4 YES * -5 YES + -6 YES * -7 YES * -8 YES -9 YES -10 YES - -* can be unresolved, because: - - - cancelable operations are implementation specific - - we have no way to be sure we try to cancel an operation that is not - already done or is in progress. - -+ can be unresolved, because we must have at least one not canceled. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/1-1.c deleted file mode 100644 index 1a6789370d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/1-1.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The aio_error() function shall return the error status (errno) - * associated with tha aiobcp argument. - * - * method: - * - * execute aio_write() - * and check result with aio_error() - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_error/1-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_1_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - while(aio_error(&aiocb) == EINPROGRESS); - - if (aio_error(&aiocb) != 0) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/2-1.c deleted file mode 100644 index 4940091b7c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/2-1.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * It the operations has not yet completed, [EINPROGRESS] shall be - * returned. - * - * method: - * - * queue a lot of aio_write() to a given fildes. - * then check if at least on is EINPROGRESS - * if yes, result is pass otherwise unresolved - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_error/2-1.c" - -#define BUF_NB 128 -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - int fd; - struct aiocb *aiocb[BUF_NB]; - int i; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_2_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - - unlink(tmpfname); - - /* create AIO req */ - - for (i = 0; i < BUF_NB; i++) - { - aiocb[i] = malloc(sizeof(struct aiocb)); - if (aiocb[i] == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - aiocb[i]->aio_fildes = fd; - aiocb[i]->aio_buf = malloc(BUF_SIZE); - if (aiocb[i]->aio_buf == NULL) - { - printf(TNAME " Error at malloc(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; - } - aiocb[i]->aio_nbytes = BUF_SIZE; - aiocb[i]->aio_offset = 0; - aiocb[i]->aio_sigevent.sigev_notify = SIGEV_NONE; - - if (aio_write(aiocb[i]) == -1) - { - printf(TNAME " loop %d: Error at aio_write(): %s\n", - i, strerror(errno)); - return PTS_FAIL; - } - } - - ret = PTS_UNRESOLVED; - for (i = 0; i < BUF_NB; i++) - { - if (aio_error(aiocb[i]) == EINPROGRESS) - { - ret = PTS_PASS; - break; - } - } - - return ret; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/3-1.c deleted file mode 100644 index 9c6024a386..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/3-1.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_error() shall fail if: - * [EINVAL] The aiocbp argument does not refer to an asynchronous - * operation whose return status has not yet been retrieved. - * - * method: - * - * call aio_error() with an invalid aiocbp - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_error/3-1.c" - -int main() -{ - struct aiocb bad; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - return PTS_UNSUPPORTED; -#endif - - memset (&bad, 0, sizeof (struct aiocb)); - - ret = aio_error(&bad); - if (ret != -1) - { - printf(TNAME " bad aio_error return value; %d\n", ret); - return PTS_FAIL; - } - - if (errno != EINVAL) - { - printf(TNAME " errno is not EINVAL %s\n", strerror(errno)); - return PTS_FAIL; - } - - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/assertions.xml deleted file mode 100644 index 012b63b48b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/assertions.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - The aio_error() function shall return the error status (errno) - associated with tha aiobcp argument. - - - It the operations has not yet completed, [EINPROGRESS] shall be - returned. - - - aio_error() shall fail if: - [EINVAL] The aiocbp argument does not refer to an asynchronous - operation whose return status has not yet been retrieved. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/coverage.txt deleted file mode 100644 index 948e232fa5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_error/coverage.txt +++ /dev/null @@ -1,6 +0,0 @@ -this file defines the coverage for the aio_error() function testing. - -Assertion Covered? -1 YES -2 YES -3 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/1-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/1-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/10-1.c deleted file mode 100644 index a0b10cdc6b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/10-1.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_fsync() shall asynchronously force I/O operations associated - * with aio_fildes. - * - * method: - * - * UNTESTED - * - * We are not able to check if I/O operations have been forced. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/11-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/11-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/12-1.c deleted file mode 100644 index b0de45accd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/12-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/12-1.c" - -int main() -{ - struct aiocb aiocb; -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = -1; - - if (aio_fsync(O_SYNC, &aiocb) != -1) - { - printf(TNAME " aio_fsync() accepts bad filedes\n"); - exit(PTS_FAIL); - } - - if (errno != EBADF) - { - printf(TNAME " errno is not EBADF (%d)\n", errno); - exit(PTS_FAIL); - } - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/13-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/13-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/14-1.c deleted file mode 100644 index 6eb2eb32e2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/14-1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/14-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_14_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - - if (aio_fsync(-1, &aiocb_fsync) != -1) - { - printf(TNAME " aio_fsync() accepts bad op\n"); - exit(PTS_FAIL); - } - - if (errno != EINVAL) - { - printf(TNAME " errno is not EINVAL (%d)\n", errno); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/2-1.c deleted file mode 100644 index 32e6dce8b8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/2-1.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/2-1.c" - -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_2_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - - if (aio_fsync(O_DSYNC, &aiocb_fsync) != 0) - { - printf(TNAME " Error at aio_fsync(): %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - - /* we didn't check if the operation is really performed */ - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/3-1.c deleted file mode 100644 index d746423304..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/3-1.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/3-1.c" - -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_3_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - - if (aio_fsync(O_SYNC, &aiocb_fsync) != 0) - { - printf(TNAME " Error at aio_fsync(): %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - - /* we didn't check if the operation is really performed */ - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/4-1.c deleted file mode 100644 index a2f1683933..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/4-1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/4-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_4_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - - if (aio_fsync(O_SYNC, &aiocb_fsync) != 0) - { - printf(TNAME " Error at aio_fsync()\n"); - exit(PTS_FAIL); - } - - if (aio_error(&aiocb_fsync) < 0) - { - printf(TNAME " Error at aio_error() : %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/4-2.c deleted file mode 100644 index 3ae9a89898..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/4-2.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/4-2.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_4_2_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - - if (aio_fsync(O_SYNC, &aiocb_fsync) != 0) - { - printf(TNAME " Error at aio_fsync()\n"); - exit(PTS_FAIL); - } - - errno = 0; - aio_return(&aiocb_fsync); - if (errno != 0) - { - printf(TNAME " Error at aio_return() : %s\n", strerror(errno)); - exit(PTS_FAIL); - } - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/5-1.c deleted file mode 100644 index 41b2fd0485..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/5-1.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/5-1.c" - -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_5_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - - if (aio_fsync(O_SYNC, &aiocb_fsync) != 0) - { - printf(TNAME " Error at aio_fsync(): %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - ret = PTS_UNTESTED; - if (aio_error(&aiocb_fsync) == EINPROGRESS) - ret = PTS_PASS; - - /* allow to check if aio_error() move from EINPROGRESS to - * something else - * otherwise test hangs - */ - - while (aio_error(&aiocb_fsync) == EINPROGRESS); - - close(fd); - - /* we didn't check if the operation is really performed */ - - return ret; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/6-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/6-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/7-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/7-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-1.c deleted file mode 100644 index 8eef14ca12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-1.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/8-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_8_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - aiocb_fsync.aio_nbytes = -1; - - if (aio_fsync(O_SYNC, &aiocb_fsync) != 0) - { - printf(TNAME " Error at aio_fsync(): %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-2.c deleted file mode 100644 index 33ae064333..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-2.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/8-2.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_8_2_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - aiocb_fsync.aio_buf = NULL; - - if (aio_fsync(O_SYNC, &aiocb_fsync) != 0) - { - printf(TNAME " Error at aio_fsync(): %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-3.c deleted file mode 100644 index 86fbceb0bf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-3.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/8-3.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_8_3_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - aiocb_fsync.aio_reqprio = -1; - - if (aio_fsync(O_SYNC, &aiocb_fsync) != 0) - { - printf(TNAME " Error at aio_fsync(): %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-4.c deleted file mode 100644 index 1472ef7609..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/8-4.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/8-4.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_8_4_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - aiocb_fsync.aio_offset = -1; - - if (aio_fsync(O_SYNC, &aiocb_fsync) != 0) - { - printf(TNAME " Error at aio_fsync(): %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/9-1.c deleted file mode 100644 index 7a3491b48e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/9-1.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_fsync/9-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb_write; - struct aiocb aiocb_fsync; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_9_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb_write, 0, sizeof(aiocb_write)); - aiocb_write.aio_fildes = fd; - aiocb_write.aio_buf = buf; - aiocb_write.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb_write) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb_fsync, 0, sizeof(aiocb_fsync)); - aiocb_fsync.aio_fildes = fd; - - if (aio_fsync(O_SYNC, &aiocb_fsync) != 0) - { - printf(TNAME " Error at aio_fsync(): %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/assertions.xml deleted file mode 100644 index 89484b222c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/assertions.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - aio_fsync() shall asynchronously force I/O operations associated - with aio_fildes. - - - if op is O_DSYNC, all queued I/O operations shall be completed as if - by a call to fdatasync(). - - - if op is O_SYNC, all queued I/O operations shall be completed as if - by a call to fsync(). - - - aio_error() and aio_return() may be used in order to determine - the error status and return status of aio_fsync opertation. - - - When the request is queued, error status is [EINPROGRESS]. - - - If the operation does not complete successfully, the error status - shall be set to indicate the error. - - - The aio_sigevent member determines the asynchronous notificiation - to occur. - - - Except aio_fildes and aio_sigevent, all other members of the structure - are ignored. - - - aio_fsync() shall return the value 0 if the operation is successfully - queued. - - - aio_fsync() shall return the value -1 and set errno to indicate error - if the operation is not successfully queued. - - - aio_fsync() shall fail if: - [EAGAIN] Operation was not queued due to temporary resource limitations. - - - aio_fsync() shall fail if: - [EBADF] aio_fildes is not a valid file descriptor for writing. - - - aio_fsync() shall fail if: - [EINVAL] This implementation does not support synchronized I/O for - this file. - - - aio_fsync() shall fail if: - [EINVAL] op is not set to O_DSYNC or O_SYNC. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/coverage.txt deleted file mode 100644 index 943edb07bb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_fsync/coverage.txt +++ /dev/null @@ -1,17 +0,0 @@ -this file defines the coverage for the aio_fsync() function testing. - -Assertion Covered? -1 NO -2 NO -3 NO -4 YES -5 NO -6 NO -7 NO -8 YES -9 YES -10 NO -11 NO -12 YES -13 NO -14 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/1-1.c deleted file mode 100644 index 79e71af72e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/1-1.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_read() shall read aio_nbytes from the files aio_fildes into the - * buffer aio_buf. - * - * method: - * - * - write 1024 bytes into a file - * - read 256 bytes using aio_read - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/1-1.c" - -int main() -{ - char tmpfname[256]; -#define WBUF_SIZE 1024 - char buf[WBUF_SIZE]; -#define RBUF_SIZE 256 - char check[RBUF_SIZE]; - int fd; - int i; - int err; - int ret; - - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_1_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/10-1.c" - -int main() -{ -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = -1; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_read(&aiocb) != -1) - { - printf(TNAME " bad aio_read return value()\n"); - exit(PTS_FAIL); - } - - if (errno != EBADF) - { - printf(TNAME " errno is not EBADF %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/11-1.c deleted file mode 100644 index 018460edd1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/11-1.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_read() shall fail with [EINVAL] or the error status of the operation - * shall be [EINVAL] if aio_offset would be invalid, or aio_reqprio is not a valid - * value, or aio_nbytes is an invalid value. - * - * Testing invalid offset - * - * method: - * - * - Create an aiocb with an invalid aio_offset - * - call aio_read with this aiocb - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/11-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_11_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - if (write(fd, buf, BUF_SIZE) != BUF_SIZE) - { - printf(TNAME " Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_offset = -1; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_read(&aiocb) != -1) - { - while (aio_error (&aiocb) == EINPROGRESS); - - int err = aio_error (&aiocb); - int ret = aio_return (&aiocb); - - if (ret != -1) { - printf(TNAME " bad aio_read return value\n"); - close (fd); - exit(PTS_FAIL); - } else if (err != EINVAL) { - printf(TNAME " error code is not EINVAL %s\n", strerror(errno)); - close (fd); - exit(PTS_FAIL); - } - } else { - - if (errno != EINVAL) - { - printf(TNAME " errno is not EINVAL %s\n", strerror(errno)); - close(fd); - exit(PTS_FAIL); - } - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/11-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/11-2.c deleted file mode 100644 index 5e9f56f87f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/11-2.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_read() shall fail with [EINVAL] or the error status of the operation - * shall be [EINVAL] if aio_offset would be invalid, or aio_reqprio is not a valid - * value, or aio_nbytes is an invalid value. - * - * Testing invalid reqprio - * - * method: - * - * - Create an aiocb with an invalid aio_reqprio - * - call aio_read with this aiocb - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/11-2.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_11_2%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_reqprio = -1; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_read(&aiocb) != -1) - { - printf(TNAME " bad aio_read return value()\n"); - exit(PTS_FAIL); - } - - if (errno != EINVAL) - { - printf(TNAME " errno is not EINVAL %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/12-1.c deleted file mode 100644 index 9a3ee2dfed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/12-1.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The error status of a succesfully queued operation shall be: - * [EBADF] if the aio_fildes argument is not a valid file descriptor open for - * reading. - * - * method: - * - * UNTESTED - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/12-1.c" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/13-1.c deleted file mode 100644 index 32e50f96e0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/13-1.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The error status of a succesfully queued operation shall be: - * [ECANCELED] if The requested I/O was canceled before the I/O completed. - * - * method: - * - * UNTESTED - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/13-1.c" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/14-1.c deleted file mode 100644 index a6aad0c20e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/14-1.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The error status of a succesfully queued operation shall be: - * [EINVAL] if aio_offset woud be invalid, or aio_reqprio is not a valid - * value, or aio_nbytes is an invalid value. - * - * method: - * - * UNTESTED - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/14-1.c" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/15-1.c deleted file mode 100644 index 5c02788127..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/15-1.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_read() shall fail with: - * [EOVERFLOW] if aio_nbytes is greater than 0, aio_offset is before EOF - * and is at or beyond the offset maximum associated with aio_fildes. - * - * method: - * - * UNTESTED - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 1024 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - struct rlimit limit; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/2-1.c deleted file mode 100644 index f707334883..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/2-1.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * If prioritized I/O is supported asynchronous operation shall be - * submitted at priority equal to a base schedulling priority minus - * aio_reqprio. - * - * method: - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/2-1.c" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - -#ifndef _POSIX_PRIORITIZED_IO - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/3-1.c deleted file mode 100644 index 4fb0e64bb8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/3-1.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aiocbp may be be used as an argument to aio_error() and aio_return(). - * - * method: - * - * - write data to a file - * - read file using aio_read - * - check error and return codes using previous aiocb - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/3-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_3_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - if (write(fd, buf, BUF_SIZE) != BUF_SIZE) - { - printf(TNAME " Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_read(&aiocb) == -1) - { - printf(TNAME " Error at aio_read(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - /* Wait for request completion */ - while (aio_error(&aiocb) == EINPROGRESS); - - /* error status shall be 0 and return status shall be BUF_SIZE */ - - while (aio_error(&aiocb) == EINPROGRESS); - - if (aio_error(&aiocb) != 0) - { - printf(TNAME " Error at aio_error()\n"); - exit(PTS_FAIL); - } - - if (aio_return(&aiocb) != BUF_SIZE) - { - printf(TNAME " Error at aio_return()\n"); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/3-2.c deleted file mode 100644 index c2f89d84b5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/3-2.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aiocbp may be be used as an argument to aio_error() and aio_return(). - * - * method: (short read) - * - * - write data to a file - * - read file using aio_read - * - check error and return codes using previous aiocb - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/3-2.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 1024 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_3_2_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - if (write(fd, buf, BUF_SIZE/2) != BUF_SIZE/2) - { - printf(TNAME " Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - /* try to read BUF_SIZE bytes whereas the file is BUF_SIZE/2 long */ - - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_read(&aiocb) == -1) - { - printf(TNAME " Error at aio_read(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - /* Wait for request completion */ - while (aio_error(&aiocb) == EINPROGRESS); - - /* error status shall be 0 and return status shall be BUF_SIZE/2 */ - - while (aio_error(&aiocb) == EINPROGRESS); - - if (aio_error(&aiocb) != 0) - { - printf(TNAME " Error at aio_error()\n"); - exit(PTS_FAIL); - } - - if (aio_return(&aiocb) != BUF_SIZE/2) - { - printf(TNAME " Error at aio_return()\n"); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/4-1.c deleted file mode 100644 index c1d15176c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/4-1.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The file is read at offset given by aio_offset. - * - * method: - * - * - write data to a file - * - read file using aio_read at a given offset - * - check data is consistent - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/4-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 512 - unsigned char buf[BUF_SIZE*2]; - unsigned char check[BUF_SIZE]; - int fd; - struct aiocb aiocb; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_4_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset (&buf[0], 1, BUF_SIZE); - memset (&buf[BUF_SIZE], 2, BUF_SIZE); - - if (write(fd, buf, BUF_SIZE*2) != BUF_SIZE*2) - { - printf(TNAME " Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - memset(check, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = check; - aiocb.aio_nbytes = BUF_SIZE; - aiocb.aio_offset = BUF_SIZE; - - if (aio_read(&aiocb) == -1) - { - printf(TNAME " Error at aio_read(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - int err; - int ret; - - /* Wait until end of transaction */ - while ((err = aio_error (&aiocb)) == EINPROGRESS); - - err = aio_error(&aiocb); - ret = aio_return(&aiocb); - - if (err != 0) - { - printf(TNAME " Error at aio_error() : %s\n", strerror (err)); - close(fd); - exit(PTS_FAIL); - } - - if (ret != BUF_SIZE) - { - printf(TNAME " Error at aio_return()\n"); - close(fd); - exit(PTS_FAIL); - } - - /* check it */ - - for (i = 0; i < BUF_SIZE; i++) - { - if (check[i] != 2) - { - printf(TNAME " read values are corrupted\n"); - close(fd); - exit(PTS_FAIL); - } - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/5-1.c deleted file mode 100644 index 378b971bab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/5-1.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_lio_opcode shall be ignored. - * - * method: - * - * - write data to a file - * - fill in an aiocb with an LIO_WRITE aio_lio_opcode - * - call aio_read with this aiocb - * - check data is effectively read (ignoring aio_lio_opcode) - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/5-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - unsigned char buf[BUF_SIZE]; - unsigned char check[BUF_SIZE]; - int fd; - struct aiocb aiocb; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_5_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - for (i = 0; i < BUF_SIZE; i++) - buf[i] = i; - - if (write(fd, buf, BUF_SIZE) != BUF_SIZE) - { - printf(TNAME " Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - memset(check, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = check; - aiocb.aio_nbytes = BUF_SIZE; - aiocb.aio_lio_opcode = LIO_WRITE; - - if (aio_read(&aiocb) == -1) - { - printf(TNAME " Error at aio_read(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - int err; - int ret; - - /* Wait until end of transaction */ - while ((err = aio_error (&aiocb)) == EINPROGRESS); - - err = aio_error(&aiocb); - ret = aio_return(&aiocb); - - if (err != 0) - { - printf(TNAME " Error at aio_error() : %s\n", strerror (err)); - close(fd); - exit(PTS_FAIL); - } - - if (ret != BUF_SIZE) - { - printf(TNAME " Error at aio_return()\n"); - close(fd); - exit(PTS_FAIL); - } - - /* check it */ - - for (i = 0; i < BUF_SIZE; i++) - { - if (buf[i] != check[i]) - { - printf(TNAME " read values are corrupted\n"); - exit(PTS_FAIL); - } - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/6-1.c deleted file mode 100644 index 75e2d8aa16..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/6-1.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * For regular files, no data transfer shall occur past the offset - * maximum established in the open file description associated with - * aio_fildes. - * - * method: - * - * UNTESTED - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/7-1.c deleted file mode 100644 index 5874063af8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/7-1.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The aio_read() function shall return the value zero if operation is - * successfuly queued. - * - * method: - * - * - write data to a file - * - read file using aio_read - * - check aio_read return value - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/7-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - unsigned char check[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_7_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(check, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = check; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_read(&aiocb) == -1) - { - printf(TNAME " Error at aio_read(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/8-1.c deleted file mode 100644 index fc872fad07..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/8-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The aio_read() function shall return the value -1 and set errno to - * indicate error if the operation is not succesfully queued. - * - * method: - * - * - fill in an aiocb with a NULL aio_buf - * - call aio_read - * - check aio_read return value - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/8-1.c" - -int main() -{ - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - /* submit a request with a NULL buffer */ - aiocb.aio_fildes = 0; - aiocb.aio_buf = NULL; - aiocb.aio_nbytes = 0; - aiocb.aio_offset = 0; - - if (aio_read(&aiocb) != -1) - { - printf(TNAME " aio_read() should fail!\n"); - exit(PTS_FAIL); - } - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/9-1.c deleted file mode 100644 index 201dddbeff..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/9-1.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_read() shall fail with [EAGAIN] if: - * The requested AIO operation was not queued to the system - * due to system resource limitations. - * - * method: - * - * - open file - * - queue NUM_AIOCBS 512-byte aio_write - * - wait until one returns EAGAIN - * - * NUM_AIOCBS might need to be adjusted for the system - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_read/9-1.c" - -#define NUM_AIOCBS 1024 - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 512 - char buf[BUF_SIZE]; - int fd; - int i; - struct aiocb aiocbs[NUM_AIOCBS]; - int last_req; - int err; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_4_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - if (write(fd, buf, BUF_SIZE) != BUF_SIZE) - { - printf(TNAME " Error at write(): %s\n", - strerror(errno)); - close(fd); - exit(PTS_UNRESOLVED); - } - - for (i=0; i - - aio_read() shall read aio_nbytes from the files aio_fildes into the - buffer aio_buf. - - - If prioritized I/O is supported asynchronous operation shall be - submitted at priority equal to a base schedulling priority minus - aio_reqprio. - - - aiocbp may be be used as an argument to aio_error() and aio_return(). - - - The file is read at offset given by aio_offset. - - - aio_lio_opcode shall be ignored. - - - For regular files, no data transfer shall occur past the offset - maximum established in the open file description associated with - aio_fildes. - - - The aio_read() function shall return the value zero if operation is - successfuly queued. - - - The aio_read() function shall return the value -1 and set errno to - indicate error if the operation is not succesfully queued. - - - aio_read() shall fail with [EAGAIN] if: - The requested AIO operation was not queued to the system - due to system resource limitations. - - - aio_read() shall fail with [EBADF] or the error status of the operation - shall be [EBADF] if aio_fildes argument is not a valid file descriptor open for - reading. - - - aio_read() shall fail with [EINVAL] or the error status of the operation - shall be [EINVAL] if aio_offset would be invalid, or aio_reqprio is not a valid - value, or aio_nbytes is an invalid value. - - - The error status of a succesfully queued operation shall be: - [EBADF] if the aio_fildes argument is not a valid file descriptor open for - reading. - - - The error status of a succesfully queued operation shall be: - [ECANCELED] if The requested I/O was canceled before the I/O completed. - - - The error status of a succesfully queued operation shall be: - [EINVAL] if aio_offset would be invalid, or aio_reqprio is not a valid - value, or aio_nbytes is an invalid value. - - - aio_read() shall fail with: - [EOVERFLOW] if aio_nbytes is greater than 0, aio_offset is before EOF - and is at or beyond the offset maximum associated with aio_fildes. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/coverage.txt deleted file mode 100644 index f642af96f7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_read/coverage.txt +++ /dev/null @@ -1,18 +0,0 @@ -this file defines the coverage for the aio_read() function testing. - -Assertion Covered? -1 YES -2 NO -3 YES -4 YES -5 YES -6 YES -7 YES -8 YES -9 YES -10 YES -11 YES -12 NO -13 NO -14 NO -15 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/1-1.c deleted file mode 100644 index da1b87dde9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/1-1.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_return() shall return the status associated with aiocbp. - * - * method: - * - * - open a file - * - fill in an aiocb for writing - * - call aio_write using this aiocb - * - call aio_return to get the aiocb status (number of bytes written) - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_return/1-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - int retval; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_return_1_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - - do { - retval = aio_error( &aiocb); - if (retval == -1) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - } while (retval == EINPROGRESS); - - retval = aio_return(&aiocb); - if (retval != BUF_SIZE) - { - printf(TNAME " Error at aio_return(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/2-1.c deleted file mode 100644 index 5b7536ea08..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/2-1.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_return() may be called exactly once to retrieve the return status. - * - * method: - * - * - open a file - * - fill in an aiocb for writing - * - call aio_write using this aiocb - * - call aio_return to get the aiocb status (number of bytes written) - * - call aio_return again, return status should be -1 - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_return/2-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - int retval; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_return_2_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - - do { - retval = aio_error( &aiocb); - if (retval == -1) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - } while (retval == EINPROGRESS); - - retval = aio_return(&aiocb); - if (retval != BUF_SIZE) - { - printf(TNAME " Error at aio_return(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - retval = aio_return(&aiocb); - - if (retval != -1) - { - printf(TNAME " Second call to aio_return() should return -1 : %d\n", - retval); - exit(PTS_FAIL); - } - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/3-1.c deleted file mode 100644 index 71b8a4b0aa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/3-1.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * If the aiocbp is used to submit another asynchronous operation, - * then aio_return may be successfully used to retrieve the return status. - * - * method: - * - * - open a file - * - fill in an aiocb for writing - * - call aio_write using this aiocb - * - call aio_return to get the aiocb status (number of bytes written) - * - reuse the aiocb for writing - * - call aio_write using this aiocb - * - call aio_return to get the aiocb status (number of bytes written) - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_return/3-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 4096 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - int retval; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_return_3_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - do { - retval = aio_error( &aiocb); - if (retval == -1) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - } while (retval == EINPROGRESS); - - retval = aio_return(&aiocb); - if (retval != BUF_SIZE) - { - printf(TNAME " Error at aio_return(): %d, %s\n", retval, - strerror(errno)); - exit(PTS_FAIL); - } - - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE/2; - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - do { - retval = aio_error( &aiocb); - if (retval == -1) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - } while (retval == EINPROGRESS); - - close(fd); - retval = aio_return(&aiocb); - if (retval != BUF_SIZE / 2) - { - printf(TNAME " Error at aio_return(): %d, %s\n", retval, - strerror(errno)); - exit(PTS_FAIL); - } - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/3-2.c deleted file mode 100644 index e8f6a44f6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/3-2.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * If the aiocbp is used to submit another asynchronous operation, - * then aio_return may be successfully used to retrieve the return status. - * - * method: - * - * - open a file - * - fill in an aiocb for writing - * - call aio_write using this aiocb - * - call aio_return to get the aiocb status (number of bytes written) - * - call aio_return again, return status should be -1 - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_return/3-2.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 4096 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - int retval; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_return_3_2_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - do { - retval = aio_error( &aiocb); - if (retval == -1) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - } while (retval == EINPROGRESS); - - retval = aio_return(&aiocb); - if (retval != BUF_SIZE) - { - printf(TNAME " Error at aio_return(): %d, %s\n", retval, - strerror(errno)); - exit(PTS_FAIL); - } - - retval = aio_return(&aiocb); - if ( (retval != -1) && (errno != EINVAL) ) - { - printf(TNAME " aio_return() should fail\n"); - exit(PTS_FAIL); - } - close(fd); - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/4-1.c deleted file mode 100644 index 365521e5f1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/4-1.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_return() may fail with [EINVAL] - * If the aiocbp does not refer to an operation whose return status - * has not yet been retrieved. - * - * method: - * - * - Open a file - * - fill in an aiocb for writing - * - call aio_write usign this aiocb - * - fill in a new aiocb - * - call aio_return with this last aiocb - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_return/4-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - struct aiocb aiocb2; - int retval; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_return_2_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - - do { - retval = aio_error( &aiocb); - if (retval == -1) - { - printf(TNAME " Error at aio_error(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - } while (retval == EINPROGRESS); - - aiocb2.aio_fildes = fd; - aiocb2.aio_buf = buf; - aiocb2.aio_nbytes = BUF_SIZE; - - retval = aio_return(&aiocb2); - if (retval != -1) - { - printf(TNAME " aio_return() should fail\n"); - exit(PTS_FAIL); - } - - retval = aio_return(&aiocb); - if (retval != BUF_SIZE) - { - printf(TNAME " Error at aio_return(): %d, %s\n", retval, - strerror(errno)); - exit(PTS_FAIL); - } - - - close(fd); - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/assertions.xml deleted file mode 100644 index 62568f43e7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/assertions.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - aio_return() shall return the status associated with aiocbp. - - - aio_return() may be called exactly once to retrieve the return status. - - - If the aiocbp is used to submit another asynchronous operation, - then aio_return may be successfully used to retrieve the return status. - - - aio_return() may fail with EINVAL]: - if the aiocbp does not refer to an operation whose return status - has not yet been retrieved. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/coverage.txt deleted file mode 100644 index 3113f05d06..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_return/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -this file defines the coverage for the aio_return() function testing. - -Assertion Covered? -1 YES -2 YES -3 YES -4 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/1-1.c deleted file mode 100644 index 4ce3774181..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/1-1.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The aio_suspend() function shall suspend the calling thread until at - * least one of the asynchronous I/O operations referenced by the list - * argument has completed, until a signal interrupts the function, or, - * if timeout is not NULL, until the time interval specified by timeout - * has passed. - * - * method: Testing for a NULL timeout - * - * - write to a file - * - submit a list of read requests - * - check that the selected request has not completed - * - suspend on selected request - * - check that the selected request has completed - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_suspend/1-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024*1024 -#define WAIT_FOR_AIOCB 6 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - if (info->si_value.sival_int == WAIT_FOR_AIOCB) - received_selected = 1; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int -main () -{ - char tmpfname[256]; - int fd; - - struct aiocb **aiocbs; - struct aiocb *plist[2]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_1_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - if (write (fd, bufs, NUM_AIOCBS*BUF_SIZE) != (NUM_AIOCBS*BUF_SIZE)) { - printf(TNAME " Error at write(): %s\n", strerror(errno)); - free (bufs); - close (fd); - exit(PTS_UNRESOLVED); - } - - - - aiocbs = (struct aiocb**)malloc(sizeof(struct aiocb *) * NUM_AIOCBS); - - /* Queue up a bunch of aio reads */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb*)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = i * BUF_SIZE; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_READ; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Setup suspend list */ - plist[0] = NULL; - plist[1] = aiocbs[WAIT_FOR_AIOCB]; - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/3-1.c deleted file mode 100644 index 3cf35074f9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/3-1.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The list array may contain NULL pointers which are ignored. - * - * method: - * - * - submit a bunch of aio_write - * - prepare suspend list with NULL pointers - * - call aio_suspend with this list - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_suspend/2-1.c" - -#define NENT 8 -#define NAIOCB 3 - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 1024 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb[NAIOCB]; - const struct aiocb *list[NENT]; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_2_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - for (i = 0; i < NAIOCB; i++) - { - memset(&aiocb[i], 0, sizeof(struct aiocb)); - aiocb[i].aio_fildes = fd; - aiocb[i].aio_buf = buf; - aiocb[i].aio_offset = i * BUF_SIZE; - aiocb[i].aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb[i]) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - } - - list[0] = NULL; - list[2] = &aiocb[0]; - list[3] = NULL; - list[4] = NULL; - list[5] = &aiocb[1]; - list[6] = &aiocb[2]; - list[7] = NULL; - - if (aio_suspend(list, NENT, NULL) != 0) - { - printf(TNAME " Error at aio_suspend(): %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/4-1.c deleted file mode 100644 index 5681e30102..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/4-1.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * On a timeout exit, aio_suspend shall return with an error. - * - * method: Testing for a non NULL timeout - * - * - write to a file - * - submit a list of read requests - * - check that the selected request has not completed - * - suspend on selected request - * - check that the suspend timed out - * - check return code and errno - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_suspend/4-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024*1024 -#define WAIT_FOR_AIOCB 6 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - if (info->si_value.sival_int == WAIT_FOR_AIOCB) - received_selected = 1; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int -main () -{ - char tmpfname[256]; - int fd; - - struct aiocb **aiocbs; - struct aiocb *plist[2]; - char *bufs; - struct sigaction action; - struct sigevent event; - struct timespec ts = {0, 10000000}; /* 10 ms */ - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_4_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - if (write (fd, bufs, NUM_AIOCBS*BUF_SIZE) != (NUM_AIOCBS*BUF_SIZE)) { - printf(TNAME " Error at write(): %s\n", strerror(errno)); - free (bufs); - close (fd); - exit(PTS_UNRESOLVED); - } - - - - aiocbs = (struct aiocb**)malloc(sizeof(struct aiocb *) * NUM_AIOCBS); - - /* Queue up a bunch of aio reads */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb*)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = i * BUF_SIZE; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_READ; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Setup suspend list */ - plist[0] = NULL; - plist[1] = aiocbs[WAIT_FOR_AIOCB]; - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - -#if _POSIX_MONOTONIC_CLOCK == 0 - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/6-1.c deleted file mode 100644 index 1c6b8b1ea6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/6-1.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_supend() shall return zero after one or more AIO operations have - * completed. - * - * method: - * - * - write to a file - * - submit a list of read requests - * - suspend on a selected request - * - check return code - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_suspend/6-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024*1024 -#define WAIT_FOR_AIOCB 6 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - if (info->si_value.sival_int == WAIT_FOR_AIOCB) - received_selected = 1; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int -main () -{ - char tmpfname[256]; - int fd; - - struct aiocb **aiocbs; - struct aiocb *plist[2]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_6_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - if (write (fd, bufs, NUM_AIOCBS*BUF_SIZE) != (NUM_AIOCBS*BUF_SIZE)) { - printf(TNAME " Error at write(): %s\n", strerror(errno)); - free (bufs); - close (fd); - exit(PTS_UNRESOLVED); - } - - - - aiocbs = (struct aiocb**)malloc(sizeof(struct aiocb *) * NUM_AIOCBS); - - /* Queue up a bunch of aio reads */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb*)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = i * BUF_SIZE; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_READ; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Setup suspend list */ - plist[0] = NULL; - plist[1] = aiocbs[WAIT_FOR_AIOCB]; - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_suspend/7-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024*1024 -#define WAIT_FOR_AIOCB 6 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - if (info->si_value.sival_int == WAIT_FOR_AIOCB) - received_selected = 1; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int -main () -{ - char tmpfname[256]; - int fd; - - struct aiocb **aiocbs; - struct aiocb *plist[2]; - char *bufs; - struct sigaction action; - struct sigevent event; - struct timespec ts = {0, 10000000}; /* 10 ms */ - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_7_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - if (write (fd, bufs, NUM_AIOCBS*BUF_SIZE) != (NUM_AIOCBS*BUF_SIZE)) { - printf(TNAME " Error at write(): %s\n", strerror(errno)); - free (bufs); - close (fd); - exit(PTS_UNRESOLVED); - } - - - - aiocbs = (struct aiocb**)malloc(sizeof(struct aiocb *) * NUM_AIOCBS); - - /* Queue up a bunch of aio reads */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb*)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = i * BUF_SIZE; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_READ; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Setup suspend list */ - plist[0] = NULL; - plist[1] = aiocbs[WAIT_FOR_AIOCB]; - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_suspend/8-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024*1024 -#define WAIT_FOR_AIOCB 6 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - if (info->si_value.sival_int == WAIT_FOR_AIOCB) - received_selected = 1; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int -main () -{ - char tmpfname[256]; - int fd; - - struct aiocb **aiocbs; - struct aiocb *plist[2]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_8_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - if (write (fd, bufs, NUM_AIOCBS*BUF_SIZE) != (NUM_AIOCBS*BUF_SIZE)) { - printf(TNAME " Error at write(): %s\n", strerror(errno)); - free (bufs); - close (fd); - exit(PTS_UNRESOLVED); - } - - - - aiocbs = (struct aiocb**)malloc(sizeof(struct aiocb *) * NUM_AIOCBS); - - /* Queue up a bunch of aio reads */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb*)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = i * BUF_SIZE; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_READ; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Setup suspend list */ - plist[0] = NULL; - plist[1] = aiocbs[WAIT_FOR_AIOCB]; - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_suspend/9-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024*1024 -#define WAIT_FOR_AIOCB 6 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - if (info->si_value.sival_int == WAIT_FOR_AIOCB) - received_selected = 1; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int -main () -{ - char tmpfname[256]; - int fd; - - struct aiocb **aiocbs; - struct aiocb *plist[2]; - char *bufs; - struct sigaction action; - struct sigevent event; - struct timespec ts = {0, 10000000}; /* 10 ms */ - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_9_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - if (write (fd, bufs, NUM_AIOCBS*BUF_SIZE) != (NUM_AIOCBS*BUF_SIZE)) { - printf(TNAME " Error at write(): %s\n", strerror(errno)); - free (bufs); - close (fd); - exit(PTS_UNRESOLVED); - } - - - - aiocbs = (struct aiocb**)malloc(sizeof(struct aiocb *) * NUM_AIOCBS); - - /* Queue up a bunch of aio reads */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb*)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = i * BUF_SIZE; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_READ; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Setup suspend list */ - plist[0] = NULL; - plist[1] = aiocbs[WAIT_FOR_AIOCB]; - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i - - The aio_suspend() function shall suspend the calling thread until at - least one of the asynchronous I/O operations referenced by the list - argument has completed, until a signal interrupts the function, or, - if timeout is not NULL, until the time interval specified by timeout - has passed. - - - If any of the aiocb structures in the list correspond to a completed - AIO, the aio_suspend() shall return without suspending. - - - The list array may contain NULL pointers which are ignored. - - - On a timeout exit, aio_suspend shall return with an error. - - - If the monotonic clock option is supported, the clock that shall be - used to measure this time interval shall be CLOCK_MONOTONIC clock. - - - aio_supend() shall return zero after one or more AIO operations have - completed. - - - aio_suspend() shall return the value -1 and set errno to indicate error - if it returns before at least one AIO operation have completed. - - - The application may determine which AIO completed by scanning operations - using aio_error() and aio_return(). - - - aio_suspend() shall fail if: - [EAGAIN] No AIO indicated in the list completed before timeout - - - aio_suspend() shall fail if: - [EINTR] A signal interrupted aio_suspend(). - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/coverage.txt deleted file mode 100644 index 2715c5e02c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_suspend/coverage.txt +++ /dev/null @@ -1,13 +0,0 @@ -this file defines the coverage for the aio_suspend() function testing. - -Assertion Covered? -1 YES -2 NO -3 YES -4 YES -5 NO -6 YES -7 YES -8 YES -9 YES -10 NO diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/1-1.c deleted file mode 100644 index 98906eaf33..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/1-1.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The aio_write() function shall write aio_nbytes to the files associated - * with aio_fildes from the buffer pointer to by aio_buf. - * - * method: - * - * - open file - * - write 512 bytes using aio_write - * - read 513 bytes - * - check read data - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/1-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 512 - char buf[BUF_SIZE]; - char check[BUF_SIZE+1]; - int fd; - struct aiocb aiocb; - int err; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_1_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", strerror(errno)); - close(fd); - exit(PTS_FAIL); - } - - /* Wait until completion */ - while (aio_error (&aiocb) == EINPROGRESS); - - err = aio_error(&aiocb); - ret = aio_return(&aiocb); - - if (err != 0) - { - printf (TNAME " Error at aio_error() : %s\n", strerror (err)); - close (fd); - exit(PTS_FAIL); - } - - if (ret != BUF_SIZE) - { - printf(TNAME " Error at aio_return()\n"); - close(fd); - exit(PTS_FAIL); - } - - /* check the values written */ - - if (lseek(fd, 0, SEEK_SET) == -1) - { - printf(TNAME " Error at lseek(): %s\n", - strerror(errno)); - close(fd); - exit(PTS_FAIL); - } - - /* we try to read more than we wrote to be sure of the size written */ - - check[BUF_SIZE] = 1; - if (read(fd, check, BUF_SIZE + 1) != BUF_SIZE) - { - printf(TNAME " Error at read(): %s\n", - strerror(errno)); - close(fd); - exit(PTS_FAIL); - } - - if ( check[BUF_SIZE] != 1) - { - printf(TNAME " Buffer overflow\n"); - close(fd); - exit(PTS_FAIL); - } - - if (memcmp(buf, check, BUF_SIZE)) - { - printf(TNAME " Bad value in buffer\n"); - close(fd); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/1-2.c deleted file mode 100644 index f5b5070ab1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/1-2.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The aio_write() function shall write aio_nbytes to the files associated - * with aio_fildes from the buffer pointer to by aio_buf. - * - * method: - * - * - open file - * - write 2*1024 0x00 bytes using synchronous write - * - write 1024 0xaa bytes at offset 512 using aio_write - * - read 2*1024 bytes - * - check read data - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/1-2.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 1024 - char buf[BUF_SIZE]; - char check[BUF_SIZE * 2]; - int fd; - struct aiocb aiocb; - int err; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_1_2_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(buf, 0x00, BUF_SIZE); - - if (write(fd, buf, BUF_SIZE) != BUF_SIZE) - { - printf(TNAME " Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - if (write(fd, buf, BUF_SIZE) != BUF_SIZE) - { - printf(TNAME " Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - aiocb.aio_offset = BUF_SIZE / 2; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - /* Wait until end of transaction */ - while (aio_error (&aiocb) == EINPROGRESS); - - err = aio_error(&aiocb); - ret = aio_return(&aiocb); - - if (err != 0) - { - printf (TNAME " Error at aio_error() : %s\n", strerror (err)); - close (fd); - exit(PTS_FAIL); - } - - if (ret != BUF_SIZE) - { - printf(TNAME " Error at aio_return()\n"); - close(fd); - exit(PTS_FAIL); - } - - /* check the values written */ - - if (lseek(fd, 0, SEEK_SET) == -1) - { - printf(TNAME " Error at lseek(): %s\n", - strerror(errno)); - close(fd); - exit(PTS_FAIL); - } - - memset(check, 0x01, BUF_SIZE * 2); - if (read(fd, check, BUF_SIZE * 2) != BUF_SIZE * 2) - { - printf(TNAME " Error at read(): %s\n", - strerror(errno)); - close(fd); - exit(PTS_FAIL); - } - - if (check[BUF_SIZE / 2 - 1] != 0) - { - printf(TNAME " write at bad offset\n"); - close(fd); - exit(PTS_FAIL); - } - - if (check[BUF_SIZE / 2 + BUF_SIZE] != 0) - { - printf(TNAME " bad size written\n"); - close(fd); - exit(PTS_FAIL); - } - - if (memcmp(buf, check + BUF_SIZE / 2, BUF_SIZE)) - { - printf(TNAME " Bad value in buffer\n"); - close(fd); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/10-1.c deleted file mode 100644 index d83cd3cb81..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/10-1.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The error status of a succesfully queued operation shall be: - * [EBADF] if the aio_fildes argument is not a valid file descriptor open for - * writing. - * - * method: - * - * UNTESTED - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/11-1.c deleted file mode 100644 index d30197d47d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/11-1.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The error status of a succesfully queued operation shall be: - * [EINVAL] if aio_offset would be invalid, or aio_reqprio is not a valid - * value, or aio_nbytes is an invalid value. - * - * method: - * - * UNTESTED - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/12-1.c deleted file mode 100644 index 083df51488..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/12-1.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The error status of a succesfully queued operation shall be: - [ECANCELED] The requested I/O was canceled before the I/O completed. - * - * method: - * - * UNTESTED - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/13-1.c deleted file mode 100644 index 3e598288d3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/13-1.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_write() shall fail or the error status of the operation shall be [EFBIG]: - * if aio_nbytes is greater than 0 and aio_offset is at or beyond the - * offset maximum of aio_fildes. - * - * method: - * - * UNTESTED - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/2-1.c deleted file mode 100644 index 685a3cec21..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/2-1.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * If O_APPEND is set for the file descripton, write operations append to - * the file in the same order as the calls were made. - * - * method: - * - * - open file in append mode - * - call aio_write thrice with different buffers and sizes - * - read all file - * - check read data - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/2-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE0 512 - char buf0[BUF_SIZE0]; -#define BUF_SIZE1 1024 - char buf1[BUF_SIZE1]; -#define BUF_SIZE2 1536 - char buf2[BUF_SIZE2]; - char *bufs[3] = {buf0, buf1, buf2}; - ssize_t sizes[3] = {BUF_SIZE0, BUF_SIZE1, BUF_SIZE2}; -#define CHECK_SIZE (BUF_SIZE0+BUF_SIZE1+BUF_SIZE2) - char check[CHECK_SIZE]; - int fd; - struct aiocb aiocb[3]; - int i; - int err; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_2_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_APPEND | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - for (i=0; i<3; i++) { - memset(bufs[i], i, sizes[i]); - memset(&aiocb[i], 0, sizeof(struct aiocb)); - aiocb[i].aio_fildes = fd; - aiocb[i].aio_buf = bufs[i]; - aiocb[i].aio_nbytes = sizes[i]; - - if (aio_write(&aiocb[i]) == -1) { - printf(TNAME " Error at aio_write() %d: %s\n", - i, strerror(errno)); - close (fd); - exit(PTS_FAIL); - } - } - - /* Wait until completion */ - while (aio_error (&aiocb[2]) == EINPROGRESS); - - for (i=0; i<3; i++) { - err = aio_error(&aiocb[i]); - ret = aio_return(&aiocb[i]); - - if (err != 0) - { - printf (TNAME " Error at aio_error() %d: %s\n", i, strerror (err)); - close (fd); - exit(PTS_FAIL); - } - - if (ret != sizes[i]) - { - printf(TNAME " Error at aio_return() %d\n",i); - close(fd); - exit(PTS_FAIL); - } - } - - - /* check the values written */ - - if (lseek(fd, 0, SEEK_SET) == -1) - { - printf(TNAME " Error at lseek(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - if (read(fd, check, CHECK_SIZE) != CHECK_SIZE) - { - printf(TNAME " Error at read(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - if (memcmp(buf0, check, BUF_SIZE0)) - { - printf(TNAME " Bad value in buffer #0\n"); - exit(PTS_FAIL); - } - - if (memcmp(buf1, check + BUF_SIZE0, BUF_SIZE1)) - { - printf(TNAME " Bad value in buffer #1\n"); - exit(PTS_FAIL); - } - - if (memcmp(buf2, check + BUF_SIZE0 + BUF_SIZE1, BUF_SIZE2)) - { - printf(TNAME " Bad value in buffer #2\n"); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/3-1.c deleted file mode 100644 index 8f33131d94..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/3-1.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_lio_opcode shall be ignored. - * - * method: - * - * - open file - * - fill in an aiocb with an LIO_READ aio_lio_opcode - * - call aio_write with this aiocb - * - read all file - * - check read data - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/3-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 512 - char buf[BUF_SIZE]; - char check[BUF_SIZE]; - int fd; - struct aiocb aiocb; - int err; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_3_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - aiocb.aio_lio_opcode = LIO_READ; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - /* Wait until completion */ - while (aio_error (&aiocb) == EINPROGRESS); - - err = aio_error(&aiocb); - ret = aio_return(&aiocb); - - if (err != 0) - { - printf (TNAME " Error at aio_error() : %s\n", strerror (err)); - close (fd); - exit(PTS_FAIL); - } - - if (ret != BUF_SIZE) - { - printf(TNAME " Error at aio_return()\n"); - close(fd); - exit(PTS_FAIL); - } - - /* check the values written */ - - if (lseek(fd, 0, SEEK_SET) == -1) - { - printf(TNAME " Error at lseek(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - if (read(fd, check, BUF_SIZE) != BUF_SIZE) - { - printf(TNAME " Error at read(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - if (memcmp(buf, check, BUF_SIZE)) - { - printf(TNAME " Bad value in buffer\n"); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/4-1.c deleted file mode 100644 index 7de7a56022..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/4-1.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * For regular files, no data transfer shall occur past the offset - * maximum established in the open file description associated with - * aio_fildes. - * - * method: - * - * UNTESTED - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/5-1.c deleted file mode 100644 index 39773b1226..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/5-1.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The aio_write() function shall return the value zero if operation is - * successfuly queued. - * - * method: - * - * - open file - * - write 512 bytes using aio_write - * - check return code - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/5-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 512 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - int err; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_5_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) == -1) - { - printf(TNAME " Error at aio_write(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - /* Wait until completion */ - while (aio_error (&aiocb) == EINPROGRESS); - - err = aio_error(&aiocb); - ret = aio_return(&aiocb); - - if (err != 0) - { - printf (TNAME " Error at aio_error() : %s\n", strerror (err)); - close (fd); - exit(PTS_FAIL); - } - - if (ret != BUF_SIZE) - { - printf(TNAME " Error at aio_return()\n"); - close(fd); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/6-1.c deleted file mode 100644 index 65b5d47815..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/6-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * The aio_write() function shall return the value -1 and set errno to - indicate error if the operation is not succesfully queued. - * - * method: - * - * - fill in an aiocb with a NULL aio_buf - * - call aio_write - * - check aio_write return value - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/6-1.c" - -int main() -{ - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - /* submit a request with a NULL buffer */ - aiocb.aio_fildes = 0; - aiocb.aio_buf = NULL; - aiocb.aio_nbytes = 0; - aiocb.aio_offset = 0; - - if (aio_write(&aiocb) != -1) - { - printf(TNAME " aio_write should fail!\n"); - exit(PTS_FAIL); - } - - if (errno != EINVAL) - { - printf(TNAME " errno should be EINVAL!\n"); - exit(PTS_FAIL); - } - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/7-1.c deleted file mode 100644 index 8f13f30916..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/7-1.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_write() shall fail with [EAGAIN] if: - * The requested AIO operation was not queued to the system - * due to system resource limitations. - * - * method: - * - * - open file - * - queue NUM_AIOCBS 512-byte aio_write - * - wait until one returns EAGAIN - * - * NUM_AIOCBS might need to be adjusted for the system - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/7-1.c" - -#define NUM_AIOCBS 1024 - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 512 - char buf[BUF_SIZE]; - int fd; - int i; - struct aiocb aiocbs[NUM_AIOCBS]; - int last_req; - int err; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_4_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/8-1.c" - -int main() -{ -#define BUF_SIZE 512 - char buf[BUF_SIZE]; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = -1; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) != -1) - { - printf(TNAME " bad aio_write return value()\n"); - exit(PTS_FAIL); - } - - if (errno != EBADF) - { - printf(TNAME " errno is not EBADF %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/8-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/8-2.c deleted file mode 100644 index 65ad7a1ad0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/8-2.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_write() shall fail or the error status of the operation shall be [EBADF] if: - * aio_fildes argument is not a valid file descriptor open for writing. - * - * method: Test with an invalid file descriptor opened read-only - * - * - setup an aiocb with an read-only aio_fildes - * - call aio_write with this aiocb - * - check return code and errno - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/8-2.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 512 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_8_2_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDONLY | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(buf, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) != -1) - { - printf(TNAME " bad aio_write return value()\n"); - exit(PTS_FAIL); - } - - if (errno != EBADF) - { - printf(TNAME " errno is not EBADF %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/9-1.c deleted file mode 100644 index 19bfca7cee..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/9-1.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_write() shall fail or the error status of the operation shall be [EINVAL] if: - * aio_offset would be invalid, or aio_reqprio is not a valid value, or - * aio_nbytes is an invalid value. - * - * Testing invalid offset - * - * method: - * - * - setup an aiocb with an invalid aio_offset - * - call aio_write with this aiocb - * - check return code and errno - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/9-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 111 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_9_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_offset = -1; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) != -1) - { - while (aio_error (&aiocb) == EINPROGRESS); - - int err = aio_error (&aiocb); - int ret = aio_return (&aiocb); - - if (ret != -1) { - printf(TNAME " bad aio_write return value\n"); - close (fd); - exit(PTS_FAIL); - } else if (err != EINVAL) { - printf(TNAME " error code is not EINVAL %s\n", strerror(errno)); - close (fd); - exit(PTS_FAIL); - } - } else { - - if (errno != EINVAL) - { - printf(TNAME " errno is not EINVAL %s\n", strerror(errno)); - close(fd); - exit(PTS_FAIL); - } - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/9-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/9-2.c deleted file mode 100644 index 46c4e54795..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/9-2.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * aio_write() shall fail or the error status of the operation shall be [EINVAL] if: - * aio_offset would be invalid, or aio_reqprio is not a valid value, or - * aio_nbytes is an invalid value. - * - * Testing invalid reqprio - * - * method: - * - * - setup an aiocb with an invalid aio_reqprio - * - call aio_write with this aiocb - * - check return code and errno - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "aio_write/9-2.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 512 - char buf[BUF_SIZE]; - int fd; - struct aiocb aiocb; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_9_2_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_reqprio = -1; - aiocb.aio_nbytes = BUF_SIZE; - - if (aio_write(&aiocb) != -1) - { - while (aio_error (&aiocb) == EINPROGRESS); - - int err = aio_error (&aiocb); - int ret = aio_return (&aiocb); - - if (ret != -1) { - printf(TNAME " bad aio_write return value\n"); - close (fd); - exit(PTS_FAIL); - } else if (err != EINVAL) { - printf(TNAME " error code is not EINVAL %s\n", strerror(errno)); - close (fd); - exit(PTS_FAIL); - } - } else { - - if (errno != EINVAL) - { - printf(TNAME " errno is not EINVAL %s\n", strerror(errno)); - close(fd); - exit(PTS_FAIL); - } - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/assertions.xml deleted file mode 100644 index 86694021ff..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/assertions.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - The aio_write() function shall write aio_nbytes to the files associated - with aio_fildes from the buffer pointer to by aio_buf. - - - If O_APPEND is set for the file descripton, write operations append to - the file in the same order as the calls were made. - - - aio_lio_opcode shall be ignored. - - - For regular files, no data transfer shall occur past the offset - maximum established in the open file description associated with - aio_fildes. - - - The aio_write() function shall return the value zero if operation is - successfuly queued. - - - The aio_write() function shall return the value -1 and set errno to - indicate error if the operation is not succesfully queued. - - - aio_write() shall fail with [EAGAIN] if: - The requested AIO operation was not queued to the system due to system - resource limitations. - - - aio_write() shall fail or the error status of the operation shall be [EBADF] if: - aio_fildes argument is not a valid file descriptor open for writing. - - - aio_write() shall fail or the error status of the operation shall be [EINVAL] if: - aio_offset would be invalid, or aio_reqprio is not a valid value, or - aio_nbytes is an invalid value. - - - The error status of a succesfully queued operation shall be: - [EBADF] if the aio_fildes argument is not a valid file descriptor open for - writing. - - - The error status of a succesfully queued operation shall be: - [EINVAL] if aio_offset would be invalid, or aio_reqprio is not a valid - value, or aio_nbytes is an invalid value. - - - The error status of a succesfully queued operation shall be: - [ECANCELED] The requested I/O was canceled before the I/O completed. - - - aio_write() shall fail or the error status of the operation shall be [EFBIG]: - if aio_nbytes is greater than 0 and aio_offset is at or beyond the - offset maximum of aio_fildes. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/coverage.txt deleted file mode 100644 index 6f0a6d2f86..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/aio_write/coverage.txt +++ /dev/null @@ -1,16 +0,0 @@ -this file defines the coverage for the aio_write() function testing. - -Assertion Covered? -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES -8 YES -9 YES -10 NO -11 NO -12 NO -13 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/asctime/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/asctime/1-1.c deleted file mode 100644 index 59d3fc41ae..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/asctime/1-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - -The asctime() function shall convert the broken-down time in the structure pointed to by timeptr into a string in the form: Sun Sep 16 01:03:52 1973\n\0 - - - - */ - -#define WEEKDAY 0 -#define MONTH 8 -#define MONTHDAY 16 -#define HOUR 1 -#define MINUTE 3 -#define SECOND 52 -#define YEAR 73 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - struct tm time_ptr; - - char expected[26]; - char* real; - - char wday_name[7][3] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; - - char mon_name[12][3] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - - time_ptr.tm_wday = WEEKDAY; - time_ptr.tm_mon = MONTH; - time_ptr.tm_mday = MONTHDAY; - time_ptr.tm_hour = HOUR; - time_ptr.tm_min = MINUTE; - time_ptr.tm_sec = SECOND; - time_ptr.tm_year = YEAR; - - real = asctime(&time_ptr); - - sprintf(expected, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n", - wday_name[time_ptr.tm_wday], - mon_name[time_ptr.tm_mon], - time_ptr.tm_mday, time_ptr.tm_hour, - time_ptr.tm_min, time_ptr.tm_sec, - 1900 + time_ptr.tm_year); - - printf("real = %s\n", real); - printf("expected = %s\n", expected); - - if (strcmp(real, expected) != 0) { - perror("asctime did not return the correct value\n"); - printf("Got %s\n", real); - printf("Expected %s\n", expected); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/asctime/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/asctime/assertions.xml deleted file mode 100644 index 883f196bb7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/asctime/assertions.xml +++ /dev/null @@ -1,6 +0,0 @@ - - -The asctime() function shall convert the broken-down time in the structure pointed to by timeptr into a string in the form: Sun Sep 16 01:03:52 1973\n\0 - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/asctime/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/asctime/coverage.txt deleted file mode 100644 index 5780ffb09b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/asctime/coverage.txt +++ /dev/null @@ -1,4 +0,0 @@ -This file defines the coverage for the asctime() function testing. - -Assertion Status -1 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/1-1.c deleted file mode 100644 index 56eebf2a68..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/1-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that clock() returns a clock_t containing the processor time - * since a specific point in time. - * Dividing the return value by CLOCKS_PER_SEC gives time in seconds. - * - * 12/17/02 - Checking in correction made by - * jim.houston REMOVE-THIS AT attbi DOT com - * Test needed to do something as opposed to idle sleep to - * get the CPU time to increase. - */ -#include -#include -#include -#include "posixtest.h" - -#define LARGENUMBER 8000000 -int main(int argc, char *argv[]) -{ - clock_t c1, c2; - double sec1, sec2; - int i; - - c1 = clock(); - sec1 = c1/CLOCKS_PER_SEC; - - for (i = 0; i < LARGENUMBER; i++) - { - // keep busy so CPU time increases - clock(); - } - - c2 = clock(); - sec2 = c2/CLOCKS_PER_SEC; - - if (sec2 > sec1) { - printf("Times T1=%.2f, T2=%.2f\n", sec1, sec2); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - if (sec2 < sec1) { - /* - * probably wrapping happened; however, since - * we do not know the wrap value, results are - * undefined - */ - printf("TEST AGAIN: Times probably wrapped\n"); - return PTS_UNRESOLVED; - } else { - printf("Error with processor times T1=%.2f, T2=%.2f\n", - sec1, sec2); - return PTS_FAIL; - } - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/2-1.c deleted file mode 100644 index c843645210..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/2-1.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * @pt:XSI - * Test that CLOCKS_PER_SEC == 1,000,000 in - */ - -// Applied patch from Craig Rodrigues; no longer assumes CLOCKS_PER_SEC is long -// 12-18-02 Per suggestion by neal REMOVE-THIS AT cs DOT uml DOT edu started -// using intmax_h and INTMAX_C. Also added use of PRIdMAX per his suggestion. - -#include -#include -#include -#include -#include "posixtest.h" - -#define EXPECTEDVALUE INTMAX_C(1000000) - -int main(int argc, char *argv[]) -{ - intmax_t clocks_per_sec = (intmax_t)CLOCKS_PER_SEC; - - if (EXPECTEDVALUE == CLOCKS_PER_SEC) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("FAIL: %" PRIdMAX " != %" PRIdMAX "\n", - clocks_per_sec, EXPECTEDVALUE); - return PTS_FAIL; - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/4-1.sh deleted file mode 100755 index eb95a969ad..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/4-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test that clock() is best used to get a delta between two times in -# a program. -# -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/assertions.xml deleted file mode 100644 index 1447af7197..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/assertions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - clock() returns a clock_t containing the processor time since a specific - point in time (implementation defined). - This return value should be divided by CLOCKS_PER_SEC to get the time - in seconds. - - - CLOCKS_PER_SEC == 1,000,000 in time.h - - - clock() returns (clock_t) - 1 if the processor time used cannot be - represented or is somehow unavailable - - - clock() is best used to get a delta between two times in a program. - - - It is acceptable for clock() to wrap on some implementations. (No - specifics on when/where.) - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/coverage.txt deleted file mode 100644 index f3ef8616e5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock/coverage.txt +++ /dev/null @@ -1,19 +0,0 @@ -This document defines the coverage for the clock() function. - -Assertion Covered? -1 YES -2 YES -3 WON'T -4 YES -5 WON'T - -ERRORS -====== -1 is failing on test implementation. It appears clock() is always returning 0. - -WON'T TEST -========== -3 - Will not test the error values of clock() because it is unknown how to - cause these errors to happen. -5 - Cannot test that clock() can wrap because it is unknown which - implementations it will wrap in. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/1-1.c deleted file mode 100644 index d49fc2cb65..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/1-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * @pt:CPT - * General test that clock_getcpuclockid() returns CPU-time clock for a - * process. The process chosen is the current process. - * - * - * 12/17/02 - Checking in correction made by - * jim.houston REMOVE-THIS AT attbi DOT com - * Test needed to do something as opposed to idle sleep to - * get the CPU time to increase. - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include "posixtest.h" - -#define LARGENUMBER 900000 -void dosomething() -{ - int i; - for (i=0; i < LARGENUMBER; i++) { - clock(); - } -} - -int main(int argc, char *argv[]) -{ -#if _POSIX_CPUTIME == -1 - printf("_POSIX_CPUTIME unsupported\n"); - return PTS_UNSUPPORTED; -#else - clockid_t clockid; - struct timespec tp1 = {.tv_sec = 0, .tv_nsec = 0}; - - if (sysconf(_SC_CPUTIME) == -1) { - printf("_POSIX_CPUTIME unsupported\n"); - return PTS_UNSUPPORTED; - } - - dosomething(); - - if (clock_getcpuclockid(getpid(), &clockid) != 0) { - printf("clock_getcpuclockid() failed\n"); - return PTS_FAIL; - } - - /* Verify that it returned a valid clockid_t that can be used in other functions */ - if (clock_gettime(clockid, &tp1) != 0) { - printf("clock_getcpuclockid() returned an invalid clockid_t: %d\n", clockid); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -#endif -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/2-1.c deleted file mode 100644 index edeb3978fb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/2-1.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * If pid=0, then clock_getcpuclockid() will return the CPU-time clock of - * the calling process. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char *argv[]) -{ -#if _POSIX_CPUTIME == -1 - printf("_POSIX_CPUTIME unsupported\n"); - return PTS_UNSUPPORTED; -#else - unsigned long time_to_set; - clockid_t clockid_1, clockid_2; - struct timespec tp1, tp2; - - if (sysconf(_SC_CPUTIME) == -1) { - printf("_POSIX_CPUTIME unsupported\n"); - return PTS_UNSUPPORTED; - } - - if (clock_getcpuclockid(getpid(), &clockid_1) != 0) { - printf("clock_getcpuclockid(getpid(), ) failed\n"); - return PTS_FAIL; - } - - if (clock_getcpuclockid(0, &clockid_2) != 0) { - printf("clock_getcpuclockid(0, ) failed\n"); - return PTS_FAIL; - } - - /* Set clockid_1 as a random value from 1 sec to 10 sec */ - srand((unsigned long)time(NULL)); - time_to_set = rand() * 10.0 / RAND_MAX + 1; - tp1.tv_sec = time_to_set; - tp1.tv_nsec = 0; - if (clock_settime(clockid_1, &tp1) != 0) { - printf("clock_getcpuclockid() returned an invalid clockid_t: " - "%d\n", clockid_1); - return PTS_FAIL; - } - /* Get the time of clockid_2, should almost the same as clockid_1 */ - if (clock_gettime(clockid_2, &tp2) != 0) { - printf("clock_getcpuclockid() returned an invalid clockid_t: " - "%d\n", clockid_2); - return PTS_FAIL; - } - if (tp1.tv_sec == tp2.tv_sec) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("Test FAILED\n"); - return PTS_FAIL; - -#endif -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/assertions.xml deleted file mode 100644 index fb00dbef0f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/assertions.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - clock_getcpuclockid() takes a process ID, pid, as input and returns the - CPU-time clock, clock_id. - - - If pid=0, then clock_getcpuclockid() will return the CPU-time clock of - the calling process. - - - clock_getcpuclockid() returns 0 on success. - - - clock_getcpuclockid() returns -1 on failure. - - - clock_getcpuclockid() sets errno to EPERM if the calling process doesn't - have the permission to know the CPU-time clock for process ID, pid. When - this happens is implementation-defined. - - - clock_getcpuclockid() _may_ fail and set errno to ESRCH if no process - can be found corresponding to pid. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/coverage.txt deleted file mode 100644 index e314b49bc5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getcpuclockid/coverage.txt +++ /dev/null @@ -1,2 +0,0 @@ -1 YES -2 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/1-1.c deleted file mode 100644 index 5f09b13c35..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/1-1.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_getres() returns the resolution of clock_id in res. - * - * The clock chosen for this test is CLOCK_REALTIME. - */ -#include -#include -#include "posixtest.h" - -#define LARGENUM 100000 -int main(int argc, char *argv[]) -{ - struct timespec res; - - /* Initialize res to a number much larger than the resolution - * could possibly be - */ - res.tv_sec = LARGENUM; - res.tv_nsec = LARGENUM; - if (clock_getres(CLOCK_REALTIME, &res) == 0) { - if (res.tv_sec != LARGENUM) { //assume initialized -#ifdef DEBUG - printf("Resolution is %d sec %d nsec\n", - (int) res.tv_sec, - (int) res.tv_nsec); -#endif - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("clock_getres() success, but res not filled\n"); - } - } else { - printf("clock_getres() failed\n"); - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/2-1.sh deleted file mode 100755 index f1f22c15f5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/2-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test that clock_getres() supports a clock_id of CLOCK_REALTIME. -# -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/3-1.c deleted file mode 100644 index 10d2146a4a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/3-1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * pt:MON - * Test that clock_getres() supports a clock_id of CLOCK_MONOTONIC if - * pt:MON. - */ -#include -#include -#include "posixtest.h" - -#define LARGENUM 100000 - -int main(int argc, char *argv[]) -{ -#ifdef CLOCK_MONOTONIC - struct timespec res; - - /* Initialize res to a number much larger than the resolution - * could possibly be - */ - res.tv_sec = LARGENUM; - res.tv_nsec = LARGENUM; - if (clock_getres(CLOCK_MONOTONIC, &res) == 0) { - if (res.tv_sec != LARGENUM) { //assume initialized -#ifdef DEBUG - printf("Resolution is %d sec %d nsec\n", - (int) res.tv_sec, - (int) res.tv_nsec); -#endif - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("clock_getres() success, but res not filled\n"); - } - } else { - printf("clock_getres() failed\n"); - } - - printf("Test FAILED\n"); - return PTS_FAIL; -#else - printf("CLOCK_MONOTONIC unsupported\n"); - return PTS_UNSUPPORTED; -#endif - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/4-1.sh deleted file mode 100755 index cbbb2a15ad..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/4-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test that clock_getres() returns 0 on success. -# -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/5-1.c deleted file mode 100644 index de87a41de8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/5-1.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_getres() returns -1 on failure. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static clockid_t get_invalid_clock_id() -{ -#if _POSIX_CPUTIME == -1 - printf("clock_getcpuclockid() not supported\n"); - exit(PTS_UNTESTED); -#else - clockid_t clockID; - int error; - - if (sysconf(_SC_CPUTIME) == -1) { - printf("clock_getcpuclockid() not supported\n"); - exit(PTS_UNTESTED); - } - - int pid = fork(); - if (pid < 0) { - perror("fork() failed"); - exit(PTS_UNRESOLVED); - } - - if (pid == 0) { - // child -- just wait a second - sleep(1); - exit(0); - } - - // parent -- get the child's CPU clock ID - error = clock_getcpuclockid(pid, &clockID); - if (error != 0) { - printf("clock_getcpuclockid() failed: %s\n", strerror(error)); - exit(PTS_UNRESOLVED); - } - - // wait for the child - if (wait(NULL) != pid) { - perror("wait() failed"); - exit(PTS_UNRESOLVED); - } - - return clockID; -#endif -} - -int main(int argc, char *argv[]) -{ - struct timespec res; - clockid_t invalidClockID; - - invalidClockID = get_invalid_clock_id(); - - if (clock_getres(invalidClockID, &res) == -1) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("This code should not be executed\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/6-1.c deleted file mode 100644 index 8ba804a27f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/6-1.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_getres() sets errno=EINVAL if clock_id does not - * refer to a known clock. - */ -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static clockid_t get_invalid_clock_id() -{ -#if _POSIX_CPUTIME == -1 - printf("clock_getcpuclockid() not supported\n"); - exit(PTS_UNTESTED); -#else - clockid_t clockID; - int error; - - if (sysconf(_SC_CPUTIME) == -1) { - printf("clock_getcpuclockid() not supported\n"); - exit(PTS_UNTESTED); - } - - int pid = fork(); - if (pid < 0) { - perror("fork() failed"); - exit(PTS_UNRESOLVED); - } - - if (pid == 0) { - // child -- just wait a second - sleep(1); - exit(0); - } - - // parent -- get the child's CPU clock ID - error = clock_getcpuclockid(pid, &clockID); - if (error != 0) { - printf("clock_getcpuclockid() failed: %s\n", strerror(error)); - exit(PTS_UNRESOLVED); - } - - // wait for the child - if (wait(NULL) != pid) { - perror("wait() failed"); - exit(PTS_UNRESOLVED); - } - - return clockID; -#endif -} - -int main(int argc, char *argv[]) -{ - struct timespec res; - clockid_t invalidClockID; - - invalidClockID = get_invalid_clock_id(); - - if (clock_getres(invalidClockID, &res) == -1) { - if (EINVAL == errno) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("errno != EINVAL\n"); - return PTS_FAIL; - } - } else { - printf("clock_getres() did not return -1\n"); - return PTS_UNRESOLVED; - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/7-1.c deleted file mode 100644 index 866af9c9c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/7-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * author: adam li - * Test that clock_getres() returns the resolution of clock_id in res. - * - * The clock chosen for this test is CLOCK_PROCESS_CPUTIME_ID. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include "posixtest.h" - -#define LARGENUM 100000 -int main(int argc, char *argv[]) -{ -#if _POSIX_CPUTIME != -1 - struct timespec res; - - if (sysconf(_SC_CPUTIME) == -1) { - printf("_POSIX_CPUTIME not supported\n"); - return PTS_UNSUPPORTED; - } - - /* Initialize res to a number much larger than the resolution - * could possibly be - */ - res.tv_sec = LARGENUM; - res.tv_nsec = LARGENUM; - if (clock_getres(CLOCK_PROCESS_CPUTIME_ID, &res) == 0) { - if (res.tv_sec != LARGENUM) { //assume initialized -#ifdef DEBUG - printf("Resolution is %d sec %d nsec\n", - (int) res.tv_sec, - (int) res.tv_nsec); -#endif - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("clock_getres() success, but res not filled\n"); - } - } else { - printf("clock_getres() failed\n"); - } - - printf("Test FAILED\n"); - return PTS_FAIL; -#else - printf("_POSIX_CPUTIME not supported\n"); - return PTS_UNSUPPORTED; -#endif -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/8-1.c deleted file mode 100644 index a06b0c3dd8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/8-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * author: adam li - * Test that clock_getres() returns the resolution of clock_id in res. - * - * The clock chosen for this test is CLOCK_THREAD_CPUTIME_ID. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include "posixtest.h" - -#define LARGENUM 100000 -int main(int argc, char *argv[]) -{ -#if _POSIX_THREAD_CPUTIME != -1 - struct timespec res; - - if (sysconf(_SC_THREAD_CPUTIME) == -1) { - printf("_POSIX_THREAD_CPUTIME not supported\n"); - return PTS_UNSUPPORTED; - } - - /* Initialize res to a number much larger than the resolution - * could possibly be - */ - res.tv_sec = LARGENUM; - res.tv_nsec = LARGENUM; - if (clock_getres(CLOCK_THREAD_CPUTIME_ID, &res) == 0) { - if (res.tv_sec != LARGENUM) { //assume initialized -#ifdef DEBUG - printf("Resolution is %d sec %d nsec\n", - (int) res.tv_sec, - (int) res.tv_nsec); -#endif - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("clock_getres() success, but res not filled\n"); - } - } else { - printf("clock_getres() failed\n"); - } - - printf("Test FAILED\n"); - return PTS_FAIL; -#else - printf("_POSIX_THREAD_CPUTIME not supported\n"); - return PTS_UNSUPPORTED; -#endif -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/assertions.xml deleted file mode 100644 index e6e5dcde34..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/assertions.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - clock_getres() returns the resolution of clock clock_id in res if res != NULL - - - clock_getres() supports a clock_id of CLOCK_REALTIME - - - clock_getres() supports a clock_id of CLOCK_MONOTONIC (if pt:MON) - - - clock_getres() returns 0 on success - - - clock_getres returns -1 on failure - - - clock_getres() sets errno=EINVAL if clock_id does not refer to a known - clock - - -CPT If _POSIX_CPUTIME is defined, implementations shall support -clock ID values obtained by invoking clock_getcpuclockid( ), -which represent the CPU-time clock of a given process. -Implementations shall also support the special clockid_t value -CLOCK_PROCESS_CPUTIME_ID, which represents the CPU-time clock of -the calling process when invoking one of the clock_*( ) or timer_*( ) -functions. For these clock IDs, the values returned by -clock_gettime( ) and specified by clock_settime( ) represent -the amount of execution time of the process associated with the clock. - - -If _POSIX_THREAD_CPUTIME is defined, implementations shall support -clock ID values obtained by invoking pthread_getcpuclockid( ), -which represent the CPU-time clock of a given -thread. Implementations shall also support the special clockid_t value -CLOCK_THREAD_CPUTIME_ID, which represents the CPU-time clock of the -calling thread when invoking one of the clock_*( ) or timer_*( ) -functions. For these clock IDs, the values -returned by clock_gettime( ) and specified by clock_settime( ) -shall represent the amount of -execution time of the thread associated with the clock. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/coverage.txt deleted file mode 100644 index 95542c6e81..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_getres/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for testing the clock_getres() function. - -Assertion Covered? -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES -8 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/1-1.c deleted file mode 100644 index b27477074c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/1-1.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - General test that clock_gettime() returns a non-empty tp for a given - clock_id (the clock_id chosen for this test is CLOCK_REALTIME). - */ -#include -#include -#include "posixtest.h" - -int main(int argc, char *argv[]) -{ - struct timespec tp; - - //Initialize tp - tp.tv_sec = 0; - tp.tv_nsec = 0; - if (clock_gettime(CLOCK_REALTIME, &tp) == 0) { - if (0 != tp.tv_sec) { //assume this means time was sent - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("clock_gettime() success, but tp not filled\n"); - return PTS_FAIL; - } - } else { - printf("clock_gettime() failed\n"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/1-2.c deleted file mode 100644 index 831ed0ab78..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/1-2.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - General test that clock_gettime() returns a valid tp for a given - clock_id (the clock_id chosen for this test is CLOCK_REALTIME). - Validity is compared with gettimeofday(). See rationale.txt for - more info. - If the clocks are within ACCEPTABLEDELTA of each other, the test is - a pass. - */ -#include -#include -#include -#include -#include "posixtest.h" - -#define ACCEPTABLEDELTA 1 - -int main(int argc, char *argv[]) -{ - struct timespec tpundertest; - struct timeval tvstandard; - int delta; - - if (clock_gettime(CLOCK_REALTIME, &tpundertest) == 0) { - if (gettimeofday(&tvstandard, NULL) == 0) { - delta = (int) tvstandard.tv_sec - - (int) tpundertest.tv_sec; - if ( abs(delta) <= ACCEPTABLEDELTA) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("FAIL: expected %d, received %d\n", - (int) tvstandard.tv_sec, - (int) tpundertest.tv_sec); - return PTS_FAIL; - } - } else { - perror("Error calling gettimeofday()\n"); - return PTS_UNRESOLVED; - } - } else { - printf("clock_gettime() failed\n"); - return PTS_UNRESOLVED; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/2-1.c deleted file mode 100644 index 4b276756d4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/2-1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * Test that parameter CLOCK_REALTIME returns seconds since the - * Epoch. (This test is similar to other tests written, but rewritten - * here for completeness.) - * Validity is compared with gettimeofday(). See rationale.txt for - * more info. - * If the clocks are within a few seconds of each other, the test is - * a pass. - */ -#include -#include -#include -#include -#include "posixtest.h" - -#define ACCEPTABLEDELTA 1 - -int main(int argc, char *argv[]) -{ - struct timespec tpundertest; - struct timeval tvstandard; - int delta; - - if (clock_gettime(CLOCK_REALTIME, &tpundertest) == 0) { - if (gettimeofday(&tvstandard, NULL) == 0) { - delta = (int) tvstandard.tv_sec - - (int) tpundertest.tv_sec; - if ( abs(delta) <= ACCEPTABLEDELTA) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("FAIL: expected %d, received %d\n", - (int) tvstandard.tv_sec, - (int) tpundertest.tv_sec); - return PTS_FAIL; - } - } else { - perror("Error calling gettimeofday()\n"); - return PTS_UNRESOLVED; - } - } else { - printf("clock_gettime() failed\n"); - return PTS_UNRESOLVED; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/3-1.c deleted file mode 100644 index d8b12719de..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/3-1.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that parameter CLOCK_MONOTONIC returns seconds since the - an unspecified point that cannot change. - Validity is checked by ensuring that the time returned is always - increasing. - */ -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char *argv[]) -{ -#ifdef CLOCK_MONOTONIC - - /* Test that MONOTONIC CLOCK functionality really exists */ - if(sysconf(_SC_MONOTONIC_CLOCK) == -1) - { - printf("CLOCK_MONOTONIC unsupported\n"); - return PTS_UNSUPPORTED; - } - - struct timespec ts1, ts2, ts3, ts4; - - if (clock_gettime(CLOCK_MONOTONIC, &ts1) != 0) { - printf("clock_gettime() failed\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_MONOTONIC, &ts2) != 0) { - printf("clock_gettime() failed\n"); - return PTS_UNRESOLVED; - } - - sleep(1); - - if (clock_gettime(CLOCK_MONOTONIC, &ts3) != 0) { - printf("clock_gettime() failed\n"); - return PTS_UNRESOLVED; - } - - sleep(3); - if (clock_gettime(CLOCK_MONOTONIC, &ts4) != 0) { - printf("clock_gettime() failed\n"); - return PTS_UNRESOLVED; - } - - if ( (ts1.tv_sec <= ts2.tv_sec) && - (ts2.tv_sec <= ts3.tv_sec) && - (ts3.tv_sec <= ts4.tv_sec) ) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Test FAILED - ts1=%ld,ts2=%ld,ts3=%ld,ts4=%ld\n", - ts1.tv_sec, ts2.tv_sec, ts3.tv_sec, - ts4.tv_sec); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -#else - printf("CLOCK_MONOTONIC unsupported\n"); - return PTS_UNSUPPORTED; -#endif - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/4-1.c deleted file mode 100644 index d954a34fff..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/4-1.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that parameter CLOCK_PROCESS_CPUTIME_ID returns the CPU time of - the calling process. - Validity is checked by ensuring that the time returned is always - increasing. - This is only supported if _POSIX_CPUTIME is defined. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define LARGENUMBER 900000 -void dosomething() -{ - int i; - for (i=0; i < LARGENUMBER; i++) { - clock(); - } -} - -int main(int argc, char *argv[]) -{ -#if _POSIX_CPUTIME == -1 - printf("_POSIX_CPUTIME unsupported\n"); - return PTS_UNSUPPORTED; -#else -#ifdef CLOCK_PROCESS_CPUTIME_ID - struct timespec ts1, ts2, ts3, ts4; - - if (sysconf(_SC_CPUTIME) == -1) { - printf("_POSIX_CPUTIME unsupported\n"); - return PTS_UNSUPPORTED; - } - - if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts1) != 0) { - printf("clock_gettime() failed: errno %d\n", errno); - return PTS_UNRESOLVED; - } - - dosomething(); - - if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts2) != 0) { - printf("clock_gettime() failed: errno %d\n", errno); - return PTS_UNRESOLVED; - } - - dosomething(); - - if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts3) != 0) { - printf("clock_gettime() failed: errno %d\n", errno); - return PTS_UNRESOLVED; - } - - dosomething(); - - if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts4) != 0) { - printf("clock_gettime() failed: errno %d\n", errno); - return PTS_UNRESOLVED; - } - - if ( (ts1.tv_sec <= ts2.tv_sec) && - (ts2.tv_sec <= ts3.tv_sec) && - (ts3.tv_sec <= ts4.tv_sec) ) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Test FAILED - ts1=%ld,ts2=%ld,ts3=%ld,ts4=%ld\n", - ts1.tv_sec, ts2.tv_sec, ts3.tv_sec, - ts4.tv_sec); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -#else - printf("CLOCK_PROCESS_CPUTIME_ID unsupported\n"); - return PTS_UNSUPPORTED; -#endif -#endif - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/6-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/6-1.sh deleted file mode 100755 index c20e2b6b7e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/6-1.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test that clock_gettime() returns 0 on success. -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/7-1.c deleted file mode 100644 index c1769abd17..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/7-1.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that clock_gettime() returns -1 on failure. - */ -#include -#include -#include "posixtest.h" - -#define INVALIDCLOCK 9999 -int main(int argc, char *argv[]) -{ - struct timespec tp; - - if (clock_gettime(INVALIDCLOCK, &tp) == -1) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/8-1.c deleted file mode 100644 index b6ca0e286d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/8-1.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that clock_gettime() sets errno to EINVAL if clock_id does not - specify a known clock. - */ -#include -#include -#include -#include "posixtest.h" - -#define INVALIDCLOCK 9999 -int main(int argc, char *argv[]) -{ - struct timespec tp; - - if (clock_gettime(INVALIDCLOCK, &tp) == -1) { - if (EINVAL == errno) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("errno not set to EINVAL\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } else { - printf("clock_gettime() did not return failure\n"); - return PTS_UNRESOLVED; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/assertions.xml deleted file mode 100644 index 86091a8020..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/assertions.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - clock_gettime() returns the current value of timespec tp for the - clock parameter clock_id - - - If the clock parameter clock_id is CLOCK_REALTIME, the value returned by - clock_gettime() is the seconds (or nanoseconds) since the Epoch. - - - If the clock parameter clock_id is CLOCK_MONOTONIC, the value returned by - clock_gettime() is the seconds (or nanoseconds) since an unspecified - point, which cannot change after system startup, in the past. - - - If the clock parameter clock_id is CLOCK_PROCESS_CPUTIME_ID, the value - returned by clock_gettime() is the amount of execution time of the - process associated with the clock. - - - If the clock parameter clock_id is CLOCK_THREAD_CPUTIME_ID, the value - returned by clock_gettime() is the amount of execution time of the - thread associated with the clock. - - - clock_gettime() returns 0 on success. - - - clock_gettime() returns -1 on failure. - - - clock_gettime() sets errno to EINVAL if the clock_id argument does not - specify a known clock - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/coverage.txt deleted file mode 100644 index f77f36927f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/coverage.txt +++ /dev/null @@ -1,15 +0,0 @@ -This file lists the coverage for all assertions: - -Assertion Complete? -1 YES -2 YES -3 YES* -4 NO - process clocks not part of implementation under test -5 NO - process clocks not part of implementation under test -6 YES -7 YES -8 NO - impossible to reliably guess invalid clock IDs - -*Note: To run against current implementation, I have to add in a line: -#include "/usr/src/linux/Documentation/high-res-timers/lib/posix_time.h" -for the definition of CLOCK_MONOTONIC to be included. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/rationale.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/rationale.txt deleted file mode 100644 index 4a4c80608a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_gettime/rationale.txt +++ /dev/null @@ -1,25 +0,0 @@ -For these tests, the date returned by clock_gettime() will be compared -with that returned by the gettimeofday() function. - -Assumptions: -- Machines running these test cases also have access to the gettimeofday - function. -- Ideally, the gettimeofday() function has different internals than - clock_gettime(). [Hopefully, clock_gettime() doesn't just _call_ - gettimeofday(), for instance.] - However, even if not, it's still a valid test to make sure clock_gettime() - doesn't have an error somewhere else. -==> See -http://sourceforge.net/mailarchive/forum.php?thread_id=591583&forum_id=2469 -It turns out these two functions _should_ return the same value but do -have different internals, so this is a good test case. - - ------ -Another note: At one point, I considered using ntpd to do date checking. -That idea ended up getting thrown out, but one thing I want to document is -that, if I did chose that idea, the tester would need to install RPMs: - ntp - libcap -for it to run. - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-1.c deleted file mode 100644 index 73597c080c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_nanosleep() causes the current thread to be suspended - * until the time interval in rqtp passes if TIMER_ABSTIME is not set - * in flags. - */ -#include -#include -#include "posixtest.h" - -#define SLEEPNSEC 3000000 - -int main(int argc, char *argv[]) -{ - struct timespec tssleep, tsbefore, tsafter; - int slepts=0,sleptns=0; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - tssleep.tv_sec=0; - tssleep.tv_nsec=SLEEPNSEC; - if (clock_nanosleep(CLOCK_REALTIME, 0, &tssleep, NULL) != 0) { - printf("clock_nanosleep() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - /* - * Generic alg for calculating slept time. - */ - slepts=tsafter.tv_sec-tsbefore.tv_sec; - sleptns=tsafter.tv_nsec-tsbefore.tv_nsec; - if (sleptns < 0) { - sleptns = sleptns+1000000000; - slepts = slepts-1; - } - - if ((slepts > 0) || (sleptns > SLEEPNSEC)) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("clock_nanosleep() did not sleep long enough\n"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-2.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-2.sh deleted file mode 100755 index 0b05f222db..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-2.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. -# -# Test that clock_nanosleep() causes the current thread to stop -# executing for the time interval in rqtp unless TIMER_ABSTIME is set -# in the flags. -# -# This is tested implicitly via assertion 2. - -echo "Tested implicitly via assertion 2. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-3.c deleted file mode 100644 index 395a3ac6fd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-3.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_nanosleep() causes the current thread to be suspended - * until a signal whose action is to invoke a signal handling function - * is received. - * - * Note: This test case has some limitations: - * - clock_nanosleep() could not be executed at all, and the test would - * pass [Hopefully, the sleep() in the parent ensures clock_nanosleep() - * will be executed.] - * - There is no way of knowing for sure that it was the signal that - * stopped clock_nanosleep(). - */ -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 30 - -void handler(int signo) -{ - printf("In handler\n"); -} - - -int main(int argc, char *argv[]) -{ - struct timespec tssleep, tsbefore, tsafter; - int pid; - struct sigaction act; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) != 0) { - perror("sigemptyset() did not return success\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGABRT, &act, 0) != 0) { - perror("sigaction() did not return success\n"); - return PTS_UNRESOLVED; - } - tssleep.tv_sec=SLEEPSEC; - tssleep.tv_nsec=0; - clock_nanosleep(CLOCK_REALTIME, 0, &tssleep, NULL); - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - if (clock_gettime(CLOCK_REALTIME, &tsafter) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - /* - * pass if we slept for less than the (large) sleep time - * allotted - */ - if ( (tsafter.tv_sec-tsbefore.tv_sec) < SLEEPSEC) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Slept for too long: %d >= %d\n", - (int)tsafter.tv_sec-(int)tsbefore.tv_sec, - SLEEPSEC); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-4.c deleted file mode 100644 index a5dfb17afd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-4.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_nanosleep() causes the current thread to be suspended - * until a signal whose action is to terminate the process is received. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 30 - -int main(int argc, char *argv[]) -{ - struct timespec tssleep, tsbefore, tsafter; - int pid; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - tssleep.tv_sec=SLEEPSEC; - tssleep.tv_nsec=0; - clock_nanosleep(CLOCK_REALTIME, 0, &tssleep, NULL); - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - if (clock_gettime(CLOCK_REALTIME, &tsafter) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - /* - * pass if we slept for less than the (large) sleep time - * allotted - */ - if ( (tsafter.tv_sec-tsbefore.tv_sec) < SLEEPSEC) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Slept for too long: %d >= %d\n", - (int)tsafter.tv_sec-(int)tsbefore.tv_sec, - SLEEPSEC); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-5.c deleted file mode 100644 index 4a1cb06546..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/1-5.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_nanosleep() does not stop if a signal is received - * that has no signal handler. clock_nanosleep() should still respond - * to the signal, but should resume after a SIGCONT signal is received. - * - * SIGSTOP will be used to stop the sleep. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 5 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -int main(int argc, char *argv[]) -{ - int pid, slepts; - struct timespec tsbefore, tsafter; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - - if ((pid = fork()) == 0) { - /* child here */ - struct timespec tssleep; - - tssleep.tv_sec=SLEEPSEC; - tssleep.tv_nsec=0; - if (clock_nanosleep(CLOCK_REALTIME, 0, &tssleep, NULL) == 0) { - printf("clock_nanosleep() returned success\n"); - return CHILDPASS; - } else { - printf("clock_nanosleep() did not return success\n"); - return CHILDFAIL; - } - return CHILDFAIL; - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGSTOP) != 0) { - printf("Could not raise SIGSTOP\n"); - return PTS_UNRESOLVED; - } - - if (kill(pid, SIGCONT) != 0) { - printf("Could not raise SIGCONT\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(i) || !WEXITSTATUS(i)) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - slepts=tsafter.tv_sec-tsbefore.tv_sec; - -#ifdef DEBUG - printf("Start %d sec; End %d sec\n", (int) tsbefore.tv_sec, - (int) tsafter.tv_sec); -#endif - if (slepts >= SLEEPSEC) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("clock_nanosleep() did not sleep long enough\n"); - return PTS_FAIL; - } - - } //end fork - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/10-1.c deleted file mode 100644 index d3fad85048..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/10-1.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_nanosleep() sets errno=EINTR if it was interruped - * by a signal. Test for relative sleep. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 30 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -void handler(int signo) -{ - printf("In handler\n"); -} - -int main(int argc, char *argv[]) -{ - struct timespec tssleep; - int pid; - struct sigaction act; - - if ((pid = fork()) == 0) { - /* child here */ - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) != 0) { - perror("sigemptyset() did not return success\n"); - return CHILDFAIL; - } - if (sigaction(SIGABRT, &act, 0) != 0) { - perror("sigaction() did not return success\n"); - return CHILDFAIL; - } - tssleep.tv_sec=SLEEPSEC; - tssleep.tv_nsec=0; - if (clock_nanosleep(CLOCK_REALTIME, 0, &tssleep, NULL) == EINTR) { - return CHILDPASS; - } else { - printf("errno != EINTR\n"); - return CHILDFAIL; - } - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (WIFEXITED(i) && WEXITSTATUS(i)) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/11-1.c deleted file mode 100644 index da428f13d4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/11-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_nanosleep() sets errno to EINVAL if rqtp contained a - * nanosecond value < 0 or >= 1,000 million - */ -#include -#include -#include -#include -#include "posixtest.h" - -#define NUMINVALIDTESTS 9 - -static int invalid_tests[NUMINVALIDTESTS] = { - INT32_MIN, - INT32_MAX, - 2147483647, - -2147483647, - -1073743192, - 1073743192, - -1, - 1000000000, - 1000000001 -}; - -int main(int argc, char *argv[]) -{ - struct timespec tssleep; - int i; - int failure = 0; - - tssleep.tv_sec=0; - - for (i=0; i -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 4 - -#define BOGUSCLOCKID 99999 - -int main(int argc, char *argv[]) -{ - struct timespec tssleep; - - tssleep.tv_sec=SLEEPSEC; - tssleep.tv_nsec=0; - - if (clock_nanosleep(BOGUSCLOCKID, 0, &tssleep, NULL) == EINVAL) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("errno != EINVAL\n"); - return PTS_FAIL; - } - - printf("This code should not be executed\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/15-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/15-1.sh deleted file mode 100755 index 12b2ec5197..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/15-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. -# -# Test that clock_nanosleep() with CLOCK_REALTIME == nanosleep(). -# -# This is not necessarily something that can be tested; however, it could -# also be considered to be tested implicitly via the other clock_nanosleep() -# tests which use CLOCK_REALTIME. - -echo "Tested implicitly via other tests. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/2-1.c deleted file mode 100644 index 80e1aac992..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/2-1.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that if TIMER_ABSTIME is set in flags, then clock_nanosleep() - * sleeps for the absolute time specified in rqtp. - * - * - Get the current time. - * - Set clock_nanosleep() to sleep for current time + SLEEPSEC - * seconds. - * - Get the current time after sleeping and ensure it is within - * ACCEPTABLEDELTA of current time + SLEEPSEC - */ -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 3 -#define ACCEPTABLEDELTA 1 - -int main(int argc, char *argv[]) -{ - struct timespec tssleep, tsbefore, tsafter; - int sleepuntilsec, flags = 0; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - sleepuntilsec = tsbefore.tv_sec + SLEEPSEC; - tssleep.tv_sec = sleepuntilsec; - tssleep.tv_nsec = tsbefore.tv_nsec; - - flags |= TIMER_ABSTIME; - if (clock_nanosleep(CLOCK_REALTIME, flags, &tssleep, NULL) != 0) { - printf("clock_nanosleep() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - if (tsafter.tv_sec >= sleepuntilsec) { - if (tsafter.tv_sec <= (sleepuntilsec+ACCEPTABLEDELTA)) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("clock_nanosleep() slept too long\n"); - return PTS_FAIL; - } - } else { - printf("clock_nanosleep() did not sleep long enough\n"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/2-2.c deleted file mode 100644 index dff51d6c34..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/2-2.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_nanosleep() causes the current thread to be suspended - * until a signal whose action is to invoke a signal handling function - * is received for an absolute nanosleep (same as 1-3.c with - * TIMER_ABSTIME set). - * - * Note: This test case has some limitations: - * - clock_nanosleep() could not be executed at all, and the test would - * pass [Hopefully, the sleep() in the parent ensures clock_nanosleep() - * will be executed.] - * - There is no way of knowing for sure that it was the signal that - * stopped clock_nanosleep(). - */ -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 30 - -void handler(int signo) -{ - printf("In handler\n"); -} - - -int main(int argc, char *argv[]) -{ - struct timespec tssleep, tsbefore, tsafter; - int pid, sleepuntilsec; - struct sigaction act; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - sleepuntilsec = tsbefore.tv_sec + SLEEPSEC; - - if ((pid = fork()) == 0) { - /* child here */ - int flags = 0; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) != 0) { - perror("sigemptyset() did not return success\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGABRT, &act, 0) != 0) { - perror("sigaction() did not return success\n"); - return PTS_UNRESOLVED; - } - - tssleep.tv_sec=sleepuntilsec; - tssleep.tv_nsec=tsbefore.tv_nsec; - - flags |= TIMER_ABSTIME; - clock_nanosleep(CLOCK_REALTIME, flags, &tssleep, NULL); - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - if (clock_gettime(CLOCK_REALTIME, &tsafter) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - /* - * pass if we slept for less than the (large) sleep time - * allotted - */ - - if ( tsafter.tv_sec < sleepuntilsec) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Slept for too long: %d >= %d\n", - (int) tsafter.tv_sec, - sleepuntilsec); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/2-3.c deleted file mode 100644 index 719d15e074..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/2-3.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_nanosleep() causes the current thread to be suspended - * until a signal whose action is to terminate the process is received - * for an absolute clock. [Same as test 1-4.c except with TIMER_ABSTIME - * set.] - */ -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 30 - -int main(int argc, char *argv[]) -{ - struct timespec tssleep, tsbefore, tsafter; - int pid, sleepuntilsec; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - sleepuntilsec = tsbefore.tv_sec + SLEEPSEC; - - if ((pid = fork()) == 0) { - int flags = 0; - - /* child here */ - tssleep.tv_sec=sleepuntilsec; - tssleep.tv_nsec=tsbefore.tv_nsec; - - flags |= TIMER_ABSTIME; - clock_nanosleep(CLOCK_REALTIME, flags, &tssleep, NULL); - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - if (clock_gettime(CLOCK_REALTIME, &tsafter) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - /* - * pass if we slept for less than the (large) sleep time - * allotted - */ - if ( tsafter.tv_sec < sleepuntilsec) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Slept for too long: %d >= %d\n", - (int)tsafter.tv_sec, - sleepuntilsec); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/3-1.c deleted file mode 100644 index eda52bbeb3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/3-1.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that if TIMER_ABSTIME is set in flags, then if clock_nanosleep() - * parameter rqtp specifies a time in the past, clock_nanosleep() - * returns immediately and no suspension occurs. - * - * - Get the current time. - * - Set clock_nanosleep() to sleep until current time - SLEEPSEC - * seconds. - * - Get the current time after sleeping and ensure it is within - * ACCEPTABLEDELTA of current time (i.e., didn't sleep) - */ -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 3 -#define ACCEPTABLEDELTA 1 - -int main(int argc, char *argv[]) -{ - struct timespec tssleep, tsbefore, tsafter; - int sleepuntilsec, flags = 0; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - sleepuntilsec = tsbefore.tv_sec - SLEEPSEC; - tssleep.tv_sec = sleepuntilsec; - tssleep.tv_nsec = tsbefore.tv_nsec; - - flags |= TIMER_ABSTIME; - if (clock_nanosleep(CLOCK_REALTIME, flags, &tssleep, NULL) != 0) { - printf("clock_nanosleep() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - if (tsafter.tv_sec >= tsbefore.tv_sec) { - if (tsafter.tv_sec <= (tsbefore.tv_sec+ACCEPTABLEDELTA)) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("FAIL: clock_nanosleep() slept\n"); - return PTS_FAIL; - } - } else { - printf("FAIL: error in clock_gettime()\n"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/4-1.sh deleted file mode 100755 index 4efb3ecbf2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/4-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. -# -# Test that clock_nanosleep() always sleeps for at least the amount -# of time in rqtp. -# -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/5-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/5-1.sh deleted file mode 100755 index e9206690e0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/5-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. -# -# Test that clock_nanosleep() always sleeps until at least the time -# specified in rqtp for absolute sleeps. -# -# This is tested implicitly via assertion 2. - -echo "Tested implicitly via assertion 2. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/6-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/6-1.sh deleted file mode 100755 index 8a48cf024f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/6-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. -# -# Test that clock_nanosleep() does not affect the action/blockage of -# a signal. -# -# This is tested implicitly via assertions 1 and 2. - -echo "Tested implicitly via assertions 1 and 2. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/8-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/8-1.sh deleted file mode 100755 index e62c8214c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/8-1.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. -# -# Test that clock_nanosleep() returns 0 on success. -# -# This is tested implicitly via assertions 1 and 2. - -echo "Tested implicitly via assertions 1 and 2. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/9-1.c deleted file mode 100644 index 37d3af7cfc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/9-1.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that when clock_nanosleep() is interrupted by a signal, rmtp - * contains the amount of time remaining (test with relative sleep). - * - */ -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 30 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -#define OKDELTA 1 - -void handler(int signo) -{ - printf("In handler\n"); -} - - -int main(int argc, char *argv[]) -{ - struct timespec tssleep, tsbefore, tsafter, tsremain; - int pid; - struct sigaction act; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - int sleptplusremaining; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) != 0) { - perror("sigemptyset() did not return success\n"); - return CHILDFAIL; - } - if (sigaction(SIGABRT, &act, 0) != 0) { - perror("sigaction() did not return success\n"); - return CHILDFAIL; - } - tssleep.tv_sec=SLEEPSEC; - tssleep.tv_nsec=0; - if (clock_nanosleep(CLOCK_REALTIME, 0, - &tssleep, &tsremain) == EINTR) { - if (clock_gettime(CLOCK_REALTIME, &tsafter) != 0) { - perror("clock_gettime() failed\n"); - return CHILDFAIL; - } - sleptplusremaining = (tsafter.tv_sec-tsbefore.tv_sec) + - tsremain.tv_sec; - - if (abs(sleptplusremaining - SLEEPSEC) <= OKDELTA) { - printf("PASS - within %d difference\n", - abs(sleptplusremaining - SLEEPSEC)); - return CHILDPASS; - } else { - printf("FAIL - within %d difference\n", - abs(sleptplusremaining - SLEEPSEC)); - return CHILDFAIL; - } - - return CHILDFAIL; - } else { - printf("clock_nanosleep() did not return EINTR\n"); - return CHILDFAIL; - } - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (WIFEXITED(i) && WEXITSTATUS(i)) { - printf("Child exited normally\n"); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Child did not exit normally.\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/assertions.xml deleted file mode 100644 index a2fea3eeb0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/assertions.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - clock_nanosleep() causes the current thread to stop executing for - the time interval (clocked by clock_id) in rqtp unless: - - TIMER_ABSTIME is set in the flags argument - - a signal whose action is to invoke a signal catching function is - delivered to the current thread - - the process is terminated - - - If TIMER_ABSTIME is set in flags, then clock_nanosleep() uses - absolute time for the suspension of execution. That is, it stops for: - - the absolute time specified by rqtp - or until - - a signal whose action is to invoke a signal catching function is - delivered to the current thread - - the process is terminated - - - If TIMER_ABSTIME is set in flags, then if, when clock_nanosleep() is - called, rqtp time value less than or equal to specified clock\'s time value, - clock_nanosleep() returns immediately and the calling process is *not* - suspended. - - - For TIMER_ABSTIME _not_ set: - Suspension time is always greater than or equal to the rqtp time interval. - [May be greater b/c of rounding or scheduling, just never less than.] - Unless clock_nanosleep() is interrupted by a signal. - - - For TIMER_ABSTIME set: - Syspension time is always at least until the corresponding clock - reaches time rqtp. - Unless clock_nanosleep() is interrupted by a signal. - - - clock_nanosleep() does not affect the action/blockage of a signal. - - - clock_nanosleep() fails if clock_id is for the CPU-time clock of - the calling thread - - - clock_nanosleep() returns 0 on success (i.e., the full time requested - by rqtp has elapsed) - - - For relative clock_nanosleep(), if clock_nanosleep() is - interrupted by a signal and rmtp is not-NULL, rmtp contains the - amount of time remaining. [If rmtp is NULL, no time is returned.] - -- Absolute timers have no effect on rmtp. - - - clock_nanosleep sets errno=EINTR if it was interrupted by a signal - - - clock_nanosleep sets errno=EINVAL if rqpt below 0 or above (or equal to) - 1,000 million - - - clock_nanosleep sets errno=EINVAL if TIMER_ABSTIME was specified - and rqpt is outside the range for clock_id - - - clock_nanosleep sets errno=EINVAL if clock_id does not refer to a known - clock or refers to the CPU-time clock of the calling thread - - - clock_nanosleep sets errno=ENOTSUP if clock_id refers to a clock - that clock_nanosleep does not support (ex. if CPU-time clock is not - supported) - - - clock_nanosleep() with CLOCK_REALTIME == nanosleep() - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/coverage.txt deleted file mode 100644 index ecb7d00f85..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_nanosleep/coverage.txt +++ /dev/null @@ -1,31 +0,0 @@ -This document specifies the coverage for function clock_nanosleep(). - -Assertion Covered? -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 SKIP -8 YES -9 YES -10 YES -11 YES -12 WON'T -13 SKIP -14 SKIP -15 YES - - -**Eventually will want to look at the Rational section in XSH6 because -it gives motivation for some good functional and stress tests. - -SKIP ----- -7-1 Skipping for now as skipping CPU-Time tests -13-2 Skipping checking for EINVAL on CPU-Time clock b/c skipping CPU-Time -tests -14-1 Skipping for now as skipping CPU-Time tests -12-1 Won't do for now as unsure how to find (or if it is available) the - range for CLOCK_REALTIME. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/1-1.c deleted file mode 100644 index a97a1d8812..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/1-1.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_settime() sets clock_id to tp. - * - * The clock_id chosen for this test is CLOCK_REALTIME. - * The date chosen is Nov 12, 2002 ~11:13am (date when test was first - * written). - */ - -#include -#include -#include -#include -#include "posixtest.h" -#include "helpers.h" - -#ifndef PR_NSEC_PER_SEC -#define PR_NSEC_PER_SEC 1000000000UL -#endif - -#define TESTTIME 1037128358 -#define ACCEPTABLEDELTA 1 - -int main(int argc, char *argv[]) -{ - struct timespec tpset, tpget, tpreset, tpres; - int delta,nsdelta; - - /* Check that we're root...can't call clock_settime with CLOCK_REALTIME otherwise */ - if(getuid() != 0) - { - printf("Run this test as ROOT, not as a Regular User\n"); - return PTS_UNTESTED; - } - if (clock_getres(CLOCK_REALTIME, &tpres) != 0){ - printf("Time resolution is not provided\n"); - tpres.tv_sec = 0; - tpres.tv_nsec = 10000000; - } - - getBeforeTime(&tpreset); - - tpset.tv_sec = TESTTIME; - tpset.tv_nsec = 0; - if (clock_settime(CLOCK_REALTIME, &tpset) == 0) { - if (clock_gettime(CLOCK_REALTIME, &tpget) == -1) { - printf("Error in clock_gettime()\n"); - setBackTime(tpreset); - return PTS_UNRESOLVED; - } - delta = tpget.tv_sec-tpset.tv_sec; - nsdelta = PR_NSEC_PER_SEC - tpget.tv_nsec; - if ( (delta <= ACCEPTABLEDELTA) && (delta >= 0) ) { - printf("Test PASSED\n"); - setBackTime(tpreset); - return PTS_PASS; - } else if( (nsdelta <= tpres.tv_nsec) && (delta == -1 )) { - printf("Test PASSED\n"); - setBackTime(tpreset); - return PTS_PASS; - } else { - printf("clock does not appear to be set\n"); - setBackTime(tpreset); - return PTS_FAIL; - } - } else { - printf("clock_settime() failed\n"); - setBackTime(tpreset); - return PTS_UNRESOLVED; - } - - printf("This code should not be executed.\n"); - setBackTime(tpreset); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/15-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/15-1.sh deleted file mode 100755 index 326dc401a5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/15-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test that clock_settime() returns 0 on success. -# -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/16-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/16-1.sh deleted file mode 100755 index 392b9a8c0f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/16-1.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# -# Test that clock_settime() returns -1 on failure. -# -# This is tested implicitly via assertions 17-21. - -echo "Tested implicitly via assertions 17-21. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/17-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/17-2.c deleted file mode 100644 index a22f50163a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/17-2.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Error condition API test for the clock_id parameter of the - * clock_settime() function. - * - * The date chosen is Nov 12, 2002 ~11:13am (date when test was first - * written). - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TESTTIME 1037128358 - -static clockid_t get_invalid_clock_id() -{ -#if _POSIX_CPUTIME == -1 - printf("clock_getcpuclockid() not supported\n"); - exit(PTS_UNTESTED); -#else - clockid_t clockID; - int error; - - if (sysconf(_SC_CPUTIME) == -1) { - printf("clock_getcpuclockid() not supported\n"); - exit(PTS_UNTESTED); - } - - int pid = fork(); - if (pid < 0) { - perror("fork() failed"); - exit(PTS_UNRESOLVED); - } - - if (pid == 0) { - // child -- just wait a second - sleep(1); - exit(0); - } - - // parent -- get the child's CPU clock ID - error = clock_getcpuclockid(pid, &clockID); - if (error != 0) { - printf("clock_getcpuclockid() failed: %s\n", strerror(error)); - exit(PTS_UNRESOLVED); - } - - // wait for the child - if (wait(NULL) != pid) { - perror("wait() failed"); - exit(PTS_UNRESOLVED); - } - - return clockID; -#endif -} - -int main(int argc, char *argv[]) -{ - struct timespec tpset; - clockid_t invalidClockID; - - invalidClockID = get_invalid_clock_id(); - - tpset.tv_sec = TESTTIME; - tpset.tv_nsec = 0; - - if (clock_settime(invalidClockID, &tpset) == -1) { - if (EINVAL != errno) { - printf("errno != EINVAL\n"); - return PTS_FAIL; - } - } else { - printf("clock_settime() did not return -1\n"); - return PTS_FAIL; - } - - printf("All tests PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/18-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/18-1.sh deleted file mode 100755 index 32e7c1dd6e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/18-1.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. -# -# Test that clock_settime() sets errno=EINVAL if tp is outside the -# valid range for clock_id. -# -# This is tested implicitly via assertion 19 to the best of tester's -# knowledge. Cannot find additional parameters for CLOCK_REALTIME -# in the POSIX specification - -echo "Tested implicitly via assertion 19. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/19-1.c deleted file mode 100644 index f67b4d5260..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/19-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that clock_settime() sets errno=EINVAL if tp has a nsec value < 0 or - * >= 1000 million. - * - * Test calling clock_settime() with the following tp.tv_nsec values: - * MIN INT = INT32_MIN - * MAX INT = INT32_MAX - * MIN INT - 1 = 2147483647 (this is what gcc will set to) - * MAX INT + 1 = -2147483647 (this is what gcc will set to) - * unassigned value = -1073743192 (ex. of what gcc will set to) - * unassigned value = 1073743192 (ex. of what gcc will set to) - * -1 - * 1000000000 - * 1000000001 - * - * The clock_id CLOCK_REALTIME is used. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" -#include "helpers.h" - -#define NUMINVALIDTESTS 9 - -static int invalid_tests[NUMINVALIDTESTS] = { - INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192, - 1073743192, -1, 1000000000, 1000000001 -}; - -int main(int argc, char *argv[]) -{ - struct timespec tsset, tscurrent, tsreset; - int i; - int failure = 0; - - /* Check that we're root...can't call clock_settime with CLOCK_REALTIME otherwise */ - if(getuid() != 0) - { - printf("Run this test as ROOT, not as a Regular User\n"); - return PTS_UNTESTED; - } - - if (clock_gettime(CLOCK_REALTIME, &tscurrent) != 0) { - printf("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - getBeforeTime(&tsreset); - for (i = 0; i < NUMINVALIDTESTS; i++) { - tsset.tv_sec = tscurrent.tv_sec; - tsset.tv_nsec = invalid_tests[i]; - - printf("Test %d sec %d nsec\n", - (int) tsset.tv_sec, (int) tsset.tv_nsec); - if (clock_settime(CLOCK_REALTIME, &tsset) == -1) { - if (EINVAL != errno) { - printf("errno != EINVAL\n"); - failure = 1; - } - } else { - printf("clock_settime() did not return -1\n"); - failure = 1; - } - } - - setBackTime(tsreset); - if (failure) { - printf("At least one test FAILED -- see above\n"); - return PTS_FAIL; - } else { - printf("All tests PASSED\n"); - return PTS_PASS; - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/20-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/20-1.c deleted file mode 100644 index 278f4c3e4b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/20-1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that clock_settime() sets errno = EINVAL if clock_id is - * CLOCK_MONOTONIC. - * - * The date chosen is Nov 12, 2002 ~11:13am. - */ -#include -#include -#include -#include "posixtest.h" - -#define TESTTIME 1037128358 - -int main(int argc, char *argv[]) -{ -#ifdef CLOCK_MONOTONIC - struct timespec tpset; - - tpset.tv_sec = TESTTIME; - tpset.tv_nsec = 0; - if (clock_settime(CLOCK_MONOTONIC, &tpset) == -1) { - if (EINVAL == errno) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("errno != EINVAL\n"); - return PTS_FAIL; - } - } else { - printf("clock_settime() did not fail with CLOCK_MONOTONIC\n"); - return PTS_UNRESOLVED; - } - - return PTS_UNRESOLVED; -#else - printf("CLOCK_MONOTONIC not supported\n"); - return PTS_UNSUPPORTED; -#endif - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/3-1.sh deleted file mode 100755 index 584790d837..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/3-1.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. -# Test that clock_settime() supports CLOCK_REALTIME. -# -# This is tested implicitly assertion 1 since CLOCK_REALTIME is -# used as the clock - -echo "Test implicitly via assertion 1. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/4-1.c deleted file mode 100644 index b43c5bed54..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/4-1.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that if clock_settime() changes the value for CLOCK_REALTIME, - * then any absolute timers will use the new time for expiration. - * - * Steps: - * - get time T0 - * - create/enable a timer to expire at T1 = T0 + TIMEROFFSET - * - sleep SLEEPTIME seconds (SLEEPTIME should be < TIMEROFFSET, - * but > ACCEPTABLEDELTA) - * - set time back to T0 - * - wait for the timer to expire - * - get time T2 - * - ensure that: T2 >= T1 and (T2-T1) <= ACCEPTABLEDELTA - * - * signal SIGTOTEST is used. - * - * adam.li: I think should check that (abs(T2-T1) <= ACCEPTABLEDELTA) - * 2004-04-30 - */ -#include -#include -#include -#include -#include "posixtest.h" -#include "helpers.h" - -// SLEEPTIME < TIMEROFFSET -// SLEEPTIME > ACCEPTABLEDELTA -#define SLEEPTIME 3 -#define TIMEROFFSET 9 -#define ACCEPTABLEDELTA 1 - -#define SIGTOTEST SIGALRM - -int main(int argc, char *argv[]) -{ - struct sigevent ev; - struct timespec tpT0, tpT2, tpreset; - struct itimerspec its; - timer_t tid; - int delta; - int sig; - sigset_t set; - int flags = 0; - - /* Check that we're root...can't call clock_settime with CLOCK_REALTIME otherwise */ - if(getuid() != 0) - { - printf("Run this test as ROOT, not as a Regular User\n"); - return PTS_UNTESTED; - } - - /* - * set up sigevent for timer - * set up signal set for sigwait - */ - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGTOTEST; - - if (sigemptyset(&set) != 0) { - perror("sigemptyset() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (sigaddset(&set, SIGTOTEST) != 0) { - perror("sigaddset() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (sigprocmask(SIG_BLOCK, &set, NULL) == -1) { - perror("sigprocmask() failed\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tpT0) != 0) { - perror("clock_gettime() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - flags |= TIMER_ABSTIME; - its.it_interval.tv_sec = 0; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = tpT0.tv_sec + TIMEROFFSET; - its.it_value.tv_nsec = tpT0.tv_nsec; - if (timer_settime(tid, flags, &its, NULL) != 0) { - perror("timer_settime() did not return success\n"); - return PTS_UNRESOLVED; - } - - sleep(SLEEPTIME); - getBeforeTime(&tpreset); - if (clock_settime(CLOCK_REALTIME, &tpT0) != 0) { - perror("clock_settime() was not successful"); - return PTS_UNRESOLVED; - } - - if (sigwait(&set, &sig) == -1) { - perror("sigwait() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tpT2) != 0) { - printf("clock_gettime() was not successful\n"); - return PTS_UNRESOLVED; - } - - delta = tpT2.tv_sec - its.it_value.tv_sec; - - // add back time waited to reset value and reset time - tpreset.tv_sec += tpT2.tv_sec - tpT0.tv_sec; - setBackTime(tpreset); - - printf("delta: %d\n", delta); - if ( (delta <= ACCEPTABLEDELTA) && (delta >= 0) ) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("FAIL: Ended %d, not %d\n", - (int) tpT2.tv_sec, - (int) its.it_value.tv_sec); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/4-2.c deleted file mode 100644 index 55d2ab597a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/4-2.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that if clock_settime() changes the value for CLOCK_REALTIME, - * an absolute timer which would now have expired in the past - * will expire immediately (with no error). - * - * Steps: - * - get time T0 - * - create/enable a timer to expire at T1 = T0 + TIMEROFFSET - * - set time forward to T1 + CLOCKOFFSET - * - ensure that timer has expired with no error - * - * signal SIGTOTEST is used. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" -#include "helpers.h" - -#define TIMEROFFSET 9 -#define CLOCKOFFSET 4 - -#define SHORTTIME 1 - -#define SIGTOTEST SIGALRM - -struct timespec tpreset; - -void handler(int signo) -{ - printf("Caught signal\n"); - printf("Test PASSED\n"); - setBackTime(tpreset); - exit(PTS_PASS); -} - -int main(int argc, char *argv[]) -{ - struct sigevent ev; - struct sigaction act; - struct timespec tpT0, tpclock; - struct itimerspec its; - timer_t tid; - int flags = 0; - - /* - * set up sigevent for timer - * set up sigaction to catch signal - */ - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGTOTEST; - - act.sa_handler=handler; - act.sa_flags=0; - - if (sigemptyset(&act.sa_mask) != 0) { - perror("sigemptyset() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGTOTEST, &act, 0) != 0) { - perror("sigaction() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tpT0) != 0) { - perror("clock_gettime() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - flags |= TIMER_ABSTIME; - its.it_interval.tv_sec = 0; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = tpT0.tv_sec + TIMEROFFSET; - its.it_value.tv_nsec = tpT0.tv_nsec; - if (timer_settime(tid, flags, &its, NULL) != 0) { - perror("timer_settime() did not return success\n"); - return PTS_UNRESOLVED; - } - - tpclock.tv_sec = its.it_value.tv_sec + CLOCKOFFSET; - tpclock.tv_nsec = its.it_value.tv_nsec; - getBeforeTime(&tpreset); - if (clock_settime(CLOCK_REALTIME, &tpclock) != 0) { - printf("clock_settime() was not successful\n"); - return PTS_UNRESOLVED; - } - - sleep(SHORTTIME); - printf("timer should have expired _immediately_\n"); - tpreset.tv_sec += SHORTTIME; - setBackTime(tpreset); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/5-1.c deleted file mode 100644 index c837b8bb27..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/5-1.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that if clock_settime() changes the value for CLOCK_REALTIME, - * then any relative timers still expire when the time interval - * has elapsed. [Test where clock_settime() sets the clock _back_ in time.] - * - * Steps: - * - set a timer to expire in TIMERSEC - * - set the clock back CLOCKOFFSET seconds - * - nanosleep for TIMERSEC+SLEEPDELTA seconds -> timer should expire - * - determine if the time remaining in nanosleep ~= SLEEPDELTA - * - * signal SIGTOTEST is used. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" -#include "helpers.h" - -#define TIMERSEC 5 -#define CLOCKOFFSET 4 -#define SLEEPDELTA 3 -#define ACCEPTABLEDELTA 1 - -#define SHORTTIME 1 - -#define SIGTOTEST SIGALRM - -void handler(int signo) -{ - printf("Caught signal\n"); -} - -int main(int argc, char *argv[]) -{ - struct sigevent ev; - struct sigaction act; - struct timespec tsclock, ts, tsleft, tsreset; - struct itimerspec its; - timer_t tid; - sigset_t set; - - /* Check that we're root...can't call clock_settime with CLOCK_REALTIME otherwise */ - if(getuid() != 0) - { - printf("Run this test as ROOT, not as a Regular User\n"); - return PTS_UNTESTED; - } - - /* - * set up sigevent for timer - * set up signal set for sigwait - * set up sigaction to catch signal - */ - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGTOTEST; - - act.sa_handler=handler; - act.sa_flags=0; - - if ( (sigemptyset(&set) != 0) || - (sigemptyset(&act.sa_mask) != 0) ) { - perror("sigemptyset() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (sigaddset(&set, SIGTOTEST) != 0) { - perror("sigaddset() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGTOTEST, &act, 0) != 0) { - perror("sigaction() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - its.it_interval.tv_sec = 0; its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = TIMERSEC; its.it_value.tv_nsec = 0; - - if (timer_settime(tid, 0, &its, NULL) != 0) { - perror("timer_settime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tsclock) != 0) { - printf("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - tsclock.tv_sec -= CLOCKOFFSET; - getBeforeTime(&tsreset); - if (clock_settime(CLOCK_REALTIME, &tsclock) != 0) { - printf("clock_settime() was not successful\n"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=TIMERSEC+SLEEPDELTA; - ts.tv_nsec=0; - - if (nanosleep(&ts, &tsleft) != -1) { - printf("nanosleep() not interrupted\n"); - return PTS_FAIL; - } - - if ( abs(tsleft.tv_sec-SLEEPDELTA) <= ACCEPTABLEDELTA) { - printf("Test PASSED\n"); - tsreset.tv_sec += TIMERSEC; - setBackTime(tsreset); - return PTS_PASS; - } else { - printf("Timer did not last for correct amount of time\n"); - printf("timer: %d != correct %d\n", - (int) ts.tv_sec- (int) tsleft.tv_sec, - TIMERSEC); - return PTS_FAIL; - } - - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/5-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/5-2.c deleted file mode 100644 index c9fda3dc2c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/5-2.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that if clock_settime() changes the value for CLOCK_REALTIME, - * then any relative timers still expire when the time interval - * has elapsed. [Test where clock_settime() sets timer forward in time.] - * - * Steps: - * - set a timer to expire in TIMERSEC - * - set the clock forward CLOCKOFFSET seconds - * - nanosleep for TIMERSEC+SLEEPDELTA seconds -> timer should expire - * - determine if the time remaining in nanosleep ~= SLEEPDELTA - * - * signal SIGTOTEST is used. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" -#include "helpers.h" - -#define TIMERSEC 5 -#define CLOCKOFFSET 4 -#define SLEEPDELTA 3 -#define ACCEPTABLEDELTA 1 - -#define SHORTTIME 1 - -#define SIGTOTEST SIGALRM - -void handler(int signo) -{ - printf("Caught signal\n"); -} - -int main(int argc, char *argv[]) -{ - struct sigevent ev; - struct sigaction act; - struct timespec tsclock, ts, tsleft, tsreset; - struct itimerspec its; - timer_t tid; - sigset_t set; - - /* Check that we're root...can't call clock_settime with CLOCK_REALTIME otherwise */ - if(getuid() != 0) - { - printf("Run this test as ROOT, not as a Regular User\n"); - return PTS_UNTESTED; - } - - /* - * set up sigevent for timer - * set up signal set for sigwait - * set up sigaction to catch signal - */ - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGTOTEST; - - act.sa_handler=handler; - act.sa_flags=0; - - if ( (sigemptyset(&set) != 0) || - (sigemptyset(&act.sa_mask) != 0) ) { - perror("sigemptyset() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (sigaddset(&set, SIGTOTEST) != 0) { - perror("sigaddset() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGTOTEST, &act, 0) != 0) { - perror("sigaction() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - its.it_interval.tv_sec = 0; its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = TIMERSEC; its.it_value.tv_nsec = 0; - - if (timer_settime(tid, 0, &its, NULL) != 0) { - perror("timer_settime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tsclock) != 0) { - printf("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - tsclock.tv_sec += CLOCKOFFSET; - getBeforeTime(&tsreset); - if (clock_settime(CLOCK_REALTIME, &tsclock) != 0) { - printf("clock_settime() was not successful\n"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=TIMERSEC+SLEEPDELTA; - ts.tv_nsec=0; - - if (nanosleep(&ts, &tsleft) != -1) { - printf("nanosleep() not interrupted\n"); - return PTS_FAIL; - } - - if ( abs(tsleft.tv_sec-SLEEPDELTA) <= ACCEPTABLEDELTA) { - printf("Test PASSED\n"); - tsreset.tv_sec += TIMERSEC; - setBackTime(tsreset); - return PTS_PASS; - } else { - printf("Timer did not last for correct amount of time\n"); - printf("timer: %d != correct %d\n", - (int) ts.tv_sec- (int) tsleft.tv_sec, - TIMERSEC); - return PTS_FAIL; - } - - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/6-1.c deleted file mode 100644 index 4b73987cae..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/6-1.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that clock_settime() cannot set the monotonic clock CLOCK_MONOTONIC, - * and will fail if invoked with clock CLOCK_MONOTONIC. - * - * The date chosen is Nov 12, 2002 ~11:13am. - */ -#include -#include -#include "posixtest.h" - -#define TESTTIME 1037128358 - -int main(int argc, char *argv[]) -{ -#ifdef CLOCK_MONOTONIC - struct timespec tpset; - - tpset.tv_sec = TESTTIME; - tpset.tv_nsec = 0; - if (clock_settime(CLOCK_MONOTONIC, &tpset) == -1) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("clock_settime() did not fail with CLOCK_MONOTONIC\n"); - return PTS_FAIL; - } - - return PTS_UNRESOLVED; -#else - printf("CLOCK_MONOTONIC not supported\n"); - return PTS_UNSUPPORTED; -#endif - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/7-1.c deleted file mode 100644 index a595fd6eb5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/7-1.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that if clock_settime() changes the time for CLOCK_REALTIME, - * then any threads blocked on clock_nanosleep() for the CLOCK_REALTIME - * clock will use the new time for expiration. - * - * Steps: - * - get time T0 - * - in child: set clock_nanosleep() to sleep until time - * T1 = T0 + SLEEPOFFSET - * - in parent: sleep SMALLTIME (< SLEEPOFFSET) - * - in parent: set time back to T0 - * - in child: ensure time when clock_nanosleep() expires is within - * ACCEPTABLEDELTA of T1 - */ -#include -#include -#include -#include -#include -#include "posixtest.h" -#include "helpers.h" - -#define SLEEPOFFSET 5 -#define SMALLTIME 2 -#define ACCEPTABLEDELTA 1 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -int main(int argc, char *argv[]) -{ - struct timespec tsT0, tsT1; - int pid; - - /* Check that we're root...can't call clock_settime with CLOCK_REALTIME otherwise */ - if(getuid() != 0) - { - printf("Run this test as ROOT, not as a Regular User\n"); - return PTS_UNTESTED; - } - - if (clock_gettime(CLOCK_REALTIME, &tsT0) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - int flags = 0; - struct timespec tsT2; - - tsT1.tv_sec=tsT0.tv_sec + SLEEPOFFSET; - tsT1.tv_nsec=tsT0.tv_nsec; - - flags |= TIMER_ABSTIME; - if (clock_nanosleep(CLOCK_REALTIME, flags, &tsT1, NULL) != 0) { - printf("clock_nanosleep() did not return success\n"); - return CHILDFAIL; - } - - if (clock_gettime(CLOCK_REALTIME, &tsT2) != 0) { - perror("clock_gettime() did not return success\n"); - return CHILDFAIL; - } - - if (tsT2.tv_sec >= tsT1.tv_sec) { - if ( (tsT2.tv_sec-tsT1.tv_sec) <= ACCEPTABLEDELTA) { - return CHILDPASS; - } else { - printf("Ended too late. %d >> %d\n", - (int) tsT2.tv_sec, - (int) tsT1.tv_sec); - return CHILDFAIL; - } - } else { - printf("Did not sleep for long enough %d < %d\n", - (int) tsT2.tv_sec, (int) tsT1.tv_sec); - return CHILDFAIL; - } - - return CHILDFAIL; - } else { - /* parent here */ - int i; - struct timespec tsreset; - - sleep(SMALLTIME); - - if (clock_settime(CLOCK_REALTIME, &tsT0) != 0) { - printf("clock_settime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - getBeforeTime(&tsreset); // get current time - tsreset.tv_sec += SMALLTIME; - setBackTime(tsreset); - if (WIFEXITED(i) && WEXITSTATUS(i)) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/7-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/7-2.c deleted file mode 100644 index abe11e4cb8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/7-2.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that if clock_settime() changes the time for CLOCK_REALTIME, - * then any threads blocked on clock_nanosleep() for the CLOCK_REALTIME - * clock that would now have expired in the past will expire immediately. - * - * Steps: - * - get time T0 - * - in child: set clock_nanosleep() to sleep until time - * T1 = T0 + SLEEPOFFSET - * - in parent: set time forward to T2 = T1 + SMALLTIME - * - in child: ensure clock_nanosleep() expires within ACCEPTABLEDELTA of - * T2 - */ -#include -#include -#include -#include -#include -#include "posixtest.h" -#include "helpers.h" - -#define SLEEPOFFSET 5 -#define SMALLTIME 2 -#define ACCEPTABLEDELTA 1 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -int main(int argc, char *argv[]) -{ - struct timespec tsT0, tsT1, tsT2; - int pid; - - /* Check that we're root...can't call clock_settime with CLOCK_REALTIME otherwise */ - if(getuid() != 0) - { - printf("Run this test as ROOT, not as a Regular User\n"); - return PTS_UNTESTED; - } - - if (clock_gettime(CLOCK_REALTIME, &tsT0) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - tsT1.tv_sec=tsT0.tv_sec + SLEEPOFFSET; - tsT1.tv_nsec=tsT0.tv_nsec; - - tsT2.tv_sec = tsT1.tv_sec + SMALLTIME; - tsT2.tv_nsec = tsT1.tv_nsec; - - if ((pid = fork()) == 0) { - /* child here */ - int flags = 0; - struct timespec tsT3; - - flags |= TIMER_ABSTIME; - if (clock_nanosleep(CLOCK_REALTIME, flags, &tsT1, NULL) != 0) { - printf("clock_nanosleep() did not return success\n"); - return CHILDFAIL; - } - - if (clock_gettime(CLOCK_REALTIME, &tsT3) != 0) { - perror("clock_gettime() did not return success\n"); - return CHILDFAIL; - } - - if (tsT3.tv_sec >= tsT2.tv_sec) { - if ( (tsT3.tv_sec-tsT2.tv_sec) <= ACCEPTABLEDELTA) { - return CHILDPASS; - } else { - printf("Ended too late. %d >> %d\n", - (int) tsT3.tv_sec, - (int) tsT2.tv_sec); - return CHILDFAIL; - } - } else { - printf("Did not sleep for long enough %d < %d\n", - (int) tsT3.tv_sec, (int) tsT2.tv_sec); - return CHILDFAIL; - } - - return CHILDFAIL; - } else { - /* parent here */ - int i; - struct timespec tsreset; - - sleep(1); - - getBeforeTime(&tsreset); - if (clock_settime(CLOCK_REALTIME, &tsT2) != 0) { - printf("clock_settime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - setBackTime(tsreset); //should be ~= before time - - if (WIFEXITED(i) && WEXITSTATUS(i)) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/8-1.c deleted file mode 100644 index d70ee1a60a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/8-1.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that clock_settime() does not affect clock_nanosleep() - * relative timers expiration times. - * - * Steps: - * - get time T0 - * - in child: set clock_nanosleep() to sleep for SLEEPSEC seconds - * - in parent: sleep SMALLTIME (< SLEEPSEC) - * - in parent: set time back to T0 - * - in child: ensure time when clock_nanosleep() expires is within - * ACCEPTABLEDELTA of T0+(SLEEPSEC-SMALLTIME) - */ -#include -#include -#include -#include -#include -#include "posixtest.h" -#include "helpers.h" - -#define SLEEPSEC 5 -#define SMALLTIME 2 -#define ACCEPTABLEDELTA 1 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -int main(int argc, char *argv[]) -{ - struct timespec tsT0, tssleep; - int pid; - - /* Check that we're root...can't call clock_settime with CLOCK_REALTIME otherwise */ - if(getuid() != 0) - { - printf("Run this test as ROOT, not as a Regular User\n"); - return PTS_UNTESTED; - } - - if (clock_gettime(CLOCK_REALTIME, &tsT0) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - struct timespec tsend; - int expectedsec; - - tssleep.tv_sec = SLEEPSEC; - tssleep.tv_nsec = 0; - - if (clock_nanosleep(CLOCK_REALTIME, 0, &tssleep, NULL) != 0) { - printf("clock_nanosleep() did not return success\n"); - return CHILDFAIL; - } - - if (clock_gettime(CLOCK_REALTIME, &tsend) != 0) { - perror("clock_gettime() did not return success\n"); - return CHILDFAIL; - } - - expectedsec = tsT0.tv_sec + (SLEEPSEC-SMALLTIME); - - if (tsend.tv_sec >= expectedsec) { - if ( (tsend.tv_sec-expectedsec) <= ACCEPTABLEDELTA) { - return CHILDPASS; - } else { - printf("Ended too late. %d >> %d\n", - (int) tsend.tv_sec, - (int) expectedsec); - return CHILDFAIL; - } - } else { - printf("Did not sleep for long enough %d < %d\n", - (int) tsend.tv_sec, (int) expectedsec); - return CHILDFAIL; - } - - return CHILDFAIL; - } else { - /* parent here */ - int i; - struct timespec tsreset; - - sleep(SMALLTIME); - - if (clock_settime(CLOCK_REALTIME, &tsT0) != 0) { - printf("clock_settime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - getBeforeTime(&tsreset); // get current time - tsreset.tv_sec += SMALLTIME; - setBackTime(tsreset); - - if (WIFEXITED(i) && WEXITSTATUS(i)) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/assertions.xml deleted file mode 100644 index bd2a186a9a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/assertions.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - clock_settime() sets the clock clock_id to the value specified - by tp. - - - clock_settime() truncates time values that are between resolution multiples - to the smaller resolution multiple - - - clock_settime() supports CLOCK_REALTIME - - - If clock_settime() changes the time for CLOCK_REALTIME, then any absolute - timers will use the new time for expiration. If at this point, the timer - should have expired in the past, it will expire immediately (no error). - - - clock_settime() does not affect _relative_ timers (either timers or - nanosleep() calls). These expire when the relative time interval elapses, - regardless of what the clock says. - - - clock_settime() cannot set the monotonic clock CLOCK_MONOTONIC and will - fail if invoked with clock_id CLOCK_MONOTONIC - - - If clock_settime() changes the time for CLOCK_REALTIME, then any threads - blocked on clock_nanosleep() for the CLOCK_REALTIME clock - will use the new time for expiration. If at this point, the timer - should have expired in the past, it will expire immediately (no error). - - - clock_settime() does not affect clock_nanosleep() _relative_ timers. - These expire when the relative time interval elapses, - regardless of what the clock says. - - - If _POSIX_CPUTIME is defined, clock_settime() supports clock_ids obtained - via clock_getcpuclockid(). The value set is the amount of execution - time of the process associated with the clock. - - - If _POSIX_CPUTIME is defined, clock_settime() supports clock_id - CLOCK_PROCESS_CPUTIME_ID (= the CPU clock of the calling process). - The value set is the amount of execution time of the calling process. - - - If clock_settime() is used to change the value of a CPU-time clock, - sporadic server scheduling policy is unaffected. - - - If _POSIX_THREAD_CPUTIME is defined, clock_settime() supports clock_ids - obtained via pthread_getcpuclockid(). The value set is the amount of - execution time of the thread associated with the clock. - - - If _POSIX_THREAD_CPUTIME is defined, clock_settime() supports clock_id - CLOCK_THREAD_CPUTIME_ID (= the CPU clock of the calling thread). - The value set is the amount of execution time of the calling thread. - - - If clock_settime() is used to change the value of a CPU-time clock, - sporadic server scheduling policy is unaffected. - - - clock_settime() returns 0 on success - - - clock_settime() returns -1 on failure - - - clock_settime() sets errno=EINVAL if clock_id does not specify a known - clock - - - clock_settime() sets errno=EINVAL if tp is outside the valid range for - clock_id - - - clock_settime() sets errno=EINVAL if tp has a nsec value below 0 or - above (or equal to) 1000 million - - - clock_settime() sets errno=EINVAL if clock_id is CLOCK_MONOTONIC - - - clock_settime() sets errno=EPERM if the calling process does not have - privileges to set clockid (MAY, not SHOULD). - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/coverage.txt deleted file mode 100644 index 58440536a5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/coverage.txt +++ /dev/null @@ -1,36 +0,0 @@ -This document specifies the coverage of function clock_settime(). - -Assertion Covered? -1 YES -2 NO* -3 YES -4 YES - FAILing on this implementation -5 YES -6 YES -7 YES -8 YES -9 NO** Skipping CPU-time tests for now -10 NO** Skipping CPU-time tests for now -11 NO** Skipping CPU-time tests for now -12 NO** Skipping CPU-time tests for now -13 NO** Skipping CPU-time tests for now -14 NO** Skipping CPU-time tests for now -15 YES -16 YES -17 NO - impossible to guess an invalid clock ID -18 YES -19 YES - FAILing on this implementation (possibly serious) -20 YES -21 WON'T - Will not test as this is a _may_ not a _should_. - -*Decided not to test this assertion. It seems like a lot of work for little -payoff in terms of if the test passes. Would need to: Get the resolution; -Set the time to desired value + 1/2 resolution time. Get the time. Ensure -that time gotten isn't too much larger than desired value + resolution time. -Depending on execution time of the test, this could never really be -conclusive. - -The date chosen for all tests is November 12, 2002 at ~11:13am (The -date when these tests were first written.) - -This corresponds to number 1037128358 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/helpers.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/helpers.h deleted file mode 100644 index f78ee6e714..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/helpers.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Helper functions used to reset the time to close to the current - * time at the end of the test. - * - * Since these helper functions are made specifically to be included - * in certain tests, they make use of some libraries already included - * by those tests. - */ -int getBeforeTime(struct timespec *tpget) -{ - if (clock_gettime(CLOCK_REALTIME, tpget) != 0) { - perror("clock_gettime() did not return success\n"); - perror("clock may not be reset properly\n"); - return PTS_UNRESOLVED; - } - return PTS_PASS; -} - -int setBackTime(struct timespec tpset) -{ - if (clock_settime(CLOCK_REALTIME, &tpset) != 0) { - perror("clock_settime() did not return success\n"); - perror("clock may not be reset properly\n"); - return PTS_UNRESOLVED; - } - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/speculative/4-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/speculative/4-3.c deleted file mode 100644 index 2b42069bbc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/speculative/4-3.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that if clock_settime() changes the value for CLOCK_REALTIME, - * an absolute timer which would now have expired in the past - * will expire immediately (with no error). - * Test with a repeating absolute timer and set the clock forward past - * > 1 expirations of that timer. - * - * Steps: - * - get time T0 - * - create/enable a timer to expire at T1 = T0 + TIMEROFFSET and repeat - * at interval TIMERINTERVAL - * - set time forward to T1 + EXPECTEDOVERRUNS*TIMERINTERVAL - * - ensure that timer has expired with no error - * - ensure that the overrun count is EXPECTEDOVERRUNS - * * Note: The POSIX spec is unclear what exactly the overrun count - * should be in this case. It is only speculation that it == - * EXPECTEDOVERRUNS. Either way passes. - * Information based on discussions with: - * benjamin.thery REMOVE-THIS AT bull DOT net - * george REMOVE-THIS AT mvista DOT com - * - * signal SIGTOTEST is used. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" -#include "../helpers.h" - -#define TIMEROFFSET 3 -#define TIMERINTERVAL 5 -#define EXPECTEDOVERRUNS 3 - -#define SHORTTIME 1 - -#define SIGTOTEST SIGALRM - -int caught = 0; - -void handler(int signo) -{ - printf("Caught signal\n"); - caught++; -} - -int main(int argc, char *argv[]) -{ - struct sigevent ev; - struct sigaction act; - struct timespec tpT0, tpclock, tpreset; - struct itimerspec its; - timer_t tid; - int flags = 0, overruns; - - /* - * set up sigevent for timer - * set up sigaction to catch signal - */ - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGTOTEST; - - act.sa_handler=handler; - act.sa_flags=0; - - if (sigemptyset(&act.sa_mask) != 0) { - perror("sigemptyset() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGTOTEST, &act, 0) != 0) { - perror("sigaction() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tpT0) != 0) { - perror("clock_gettime() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - flags |= TIMER_ABSTIME; - its.it_interval.tv_sec = TIMERINTERVAL; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = tpT0.tv_sec + TIMEROFFSET; - its.it_value.tv_nsec = tpT0.tv_nsec; - if (timer_settime(tid, flags, &its, NULL) != 0) { - perror("timer_settime() did not return success\n"); - return PTS_UNRESOLVED; - } - - tpclock.tv_sec = its.it_value.tv_sec + EXPECTEDOVERRUNS*TIMERINTERVAL; - tpclock.tv_nsec = its.it_value.tv_nsec; - getBeforeTime(&tpreset); - if (clock_settime(CLOCK_REALTIME, &tpclock) != 0) { - printf("clock_settime() was not successful\n"); - return PTS_UNRESOLVED; - } - - sleep(SHORTTIME); - - overruns = timer_getoverrun(tid); - if (overruns == EXPECTEDOVERRUNS) { - printf("Overrun count == # of repeating timer expirys\n"); - } else { - printf("Overrun count =%d, not # of repeating timer expirys\n", - overruns); - } - - tpreset.tv_sec += SHORTTIME; - setBackTime(tpreset); - - if (caught == 1) { - printf("Caught the correct number of signals\n"); - } else { - printf("FAIL: Caught %d signals, not 1\n", caught); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/speculative/4-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/speculative/4-4.c deleted file mode 100644 index e2d118f6ee..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/clock_settime/speculative/4-4.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Note: This test is not based on the POSIX spec, but is a speculation - * about behavior for an assertion where the POSIX spec does not make a - * statement about the behavior in either case. - * - * Test that if clock_settime() changes the value for CLOCK_REALTIME, - * a repeating absolute timer uses this new value for expires. - * - * Document whether expirations which have already happened happen again or - * not. - * - * Steps: - * - get time T0 - * - create/enable a timer to expire at T1 = T0 + TIMERINTERVAL and repeat - * at interval TIMERINTERVAL - * - sleep for time TIMERINTERVAL+ADDITIONALEXPIRES*TIMERINTERAL (must do - * in a loop to catch all expires) - * - set time backward to T0 - * - sleep for time TIMERINTERVAL and ensure timer expires (2X) - * - * signal SIGTOTEST is used. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" -#include "../helpers.h" - -#define TIMERINTERVAL 5 -#define ADDITIONALEXPIRES 2 - -#define ADDITIONALDELTA 1 - -#define SIGTOTEST SIGALRM - -int caught = 0; - -void handler(int signo) -{ - printf("Caught signal\n"); - caught++; -} - -int main(int argc, char *argv[]) -{ - struct sigevent ev; - struct sigaction act; - struct timespec tpT0, tpclock, tsreset; - struct itimerspec its; - timer_t tid; - int i, flags = 0, nocaught = 0; - - /* - * set up sigevent for timer - * set up sigaction to catch signal - */ - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGTOTEST; - - act.sa_handler=handler; - act.sa_flags=0; - - if (sigemptyset(&act.sa_mask) != 0) { - perror("sigemptyset() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGTOTEST, &act, 0) != 0) { - perror("sigaction() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tpT0) != 0) { - perror("clock_gettime() was not successful\n"); - return PTS_UNRESOLVED; - } - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - flags |= TIMER_ABSTIME; - its.it_interval.tv_sec = TIMERINTERVAL; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = tpT0.tv_sec + TIMERINTERVAL; - its.it_value.tv_nsec = tpT0.tv_nsec; - if (timer_settime(tid, flags, &its, NULL) != 0) { - perror("timer_settime() did not return success\n"); - return PTS_UNRESOLVED; - } - - sleep(TIMERINTERVAL); - for (i = 0; i < ADDITIONALEXPIRES; i++) { - sleep(TIMERINTERVAL); - } - - tpclock.tv_sec = tpT0.tv_sec; - tpclock.tv_nsec = tpT0.tv_nsec; - getBeforeTime(&tsreset); - if (clock_settime(CLOCK_REALTIME, &tpclock) != 0) { - printf("clock_settime() was not successful\n"); - return PTS_UNRESOLVED; - } - - caught = 0; - - sleep(TIMERINTERVAL+ADDITIONALDELTA); - - if (caught == 1) { - printf("Caught the first signal\n"); - } else { - printf("FAIL: Didn't catch timer after TIMERINTERVAL.\n"); - nocaught = 1; - } - - sleep(TIMERINTERVAL+ADDITIONALDELTA); - - if (caught >= 2) { - printf("Caught another signal\n"); - } else { - printf("Caught %d < 2 signals\n", caught); - nocaught = 1; - } - - if (nocaught) { - printf("Implementation does not repeat signals on clock reset\n"); - } else { - printf("Implementation does repeat signals on clock reset\n"); - } - - // If we finish, pass - tsreset.tv_sec += 2*(TIMERINTERVAL+ADDITIONALDELTA); - setBackTime(tsreset); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/ctime/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/ctime/1-1.c deleted file mode 100644 index 1eaced4def..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/ctime/1-1.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * - * This test case checks if the return value of the ctime call is - * not NULL after converting the time value to a date and time string. - */ - - -#include -#include -#include "posixtest.h" - -int main() { - time_t current_time; - char * result; - - time(¤t_time); - result = ctime(¤t_time); - - if (result == NULL) { - puts ("Test FAILED: returned NULL"); - return PTS_FAIL; - } else { - printf("converted date and time is: %s\n", ctime(¤t_time)); - printf("Test PASSED\n"); - return PTS_PASS; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/ctime/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/ctime/assertions.xml deleted file mode 100644 index 286f74e772..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/ctime/assertions.xml +++ /dev/null @@ -1,6 +0,0 @@ - - -The ctime function return value is not NULL after converting the time -value to a date and time string. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/ctime/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/ctime/coverage.txt deleted file mode 100644 index fec04adaed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/ctime/coverage.txt +++ /dev/null @@ -1,4 +0,0 @@ -This file defines the coverage for the ctime() function testing. - -Assertion Status -1 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c deleted file mode 100644 index ab02c3f035..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test that the difftime function shall return the difference between - two calendar times. - */ - -#define WAIT_DURATION 1 - -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - time_t time1, time0; - - double time_diff; - time_diff = 0; - time0 = time(NULL); - sleep(WAIT_DURATION); - time1 = time(NULL); - time_diff = difftime(time1, time0); - - if (time_diff != WAIT_DURATION) { - perror("Test FAILED: difftime did not return the correct value\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/2-1.sh deleted file mode 100755 index 8fab940c84..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/2-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -#The difftime ( ) function shall return the difference expressed in seconds as a type double. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/assertions.xml deleted file mode 100644 index 45ee0085b2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/assertions.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - The difftime ( ) function shall compute the difference between two calendar times - (as returned by - time( )): time1. time0. - - - The difftime ( ) function shall return the difference expressed in seconds as a type double. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/coverage.txt deleted file mode 100644 index 85e9980045..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/coverage.txt +++ /dev/null @@ -1,5 +0,0 @@ -This file defines the coverage for the difftime() function testing. - -Assertion Status -1 YES -2 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/1-1.c deleted file mode 100644 index 2488fba535..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/1-1.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * fork() creates a new process. - - * The steps are: - * -> create a new process - * -> the parent and the child sleep 1 sec (check concurrent execution) - * -> the child posts a semaphore, the parents waits for thsi semaphore - * (check the child really executes) - * -> join and check that total execution time is < 2 sec. - - * The test fails if the duration is > 2 seconds or if semaphore is not posted. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SEM_NAME "/semfork1_1" - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main(int argc, char * argv[]) -{ - int ret, status; - pid_t child, ctl; - sem_t *sem; - struct timespec tsini, tsfin; - - /* Initialize output */ - output_init(); - - /* read current time */ - ret = clock_gettime(CLOCK_REALTIME, &tsini); - if (ret != 0) { UNRESOLVED(errno, "Unable to read CLOCK_REALTIME clock"); } - - /* Set temporary value in tsfin for semaphore timeout */ - tsfin.tv_sec = tsini.tv_sec + 3; - tsfin.tv_nsec = tsini.tv_nsec; - - /* Create the child */ - child = fork(); - if (child == (pid_t) -1) { UNRESOLVED(errno, "Failed to fork"); } - - /* Open the semaphore */ - sem = sem_open(SEM_NAME, O_CREAT, O_RDWR, 0); - if (sem == (sem_t *)SEM_FAILED) { UNRESOLVED(errno, "Failed to open the semaphore"); } - - /* sleep 1 second */ - sleep(1); - - /* child posts the semaphore and terminates */ - if (child == (pid_t) 0) - { - do { ret = sem_post(sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - ret = sem_close(sem); - if (ret != 0) { UNRESOLVED(errno, "Failed to close the semaphore"); } - - /* The child stops here */ - exit(0); - } - - /* Parent waits for the semaphore */ - do { ret = sem_timedwait(sem, &tsfin); } - while ((ret != 0) && (errno == EINTR)); - if (ret != 0) - { - if (errno == ETIMEDOUT) { FAILED("The new process does not execute"); } - UNRESOLVED(errno, "Failed to wait for the semaphore"); - } - - /* We don't need the semaphore anymore */ - ret = sem_unlink(SEM_NAME); - if (ret != 0) { UNRESOLVED(errno, "Unable to unlink the semaphore"); } - ret = sem_close(sem); - if (ret != 0) { UNRESOLVED(errno, "Failed to close the semaphore"); } - - /* Parent joins the child */ - ctl = waitpid(child, &status, 0); - if (ctl != child) { UNRESOLVED(errno, "Waitpid returned the wrong PID"); } - if ((!WIFEXITED(status)) || (WEXITSTATUS(status) != 0)) - { - UNRESOLVED(status, "Child exited abnormally"); - } - - /* Check the global duration */ - ret = clock_gettime(CLOCK_REALTIME, &tsfin); - if (ret != 0) { UNRESOLVED(errno, "Unable to read CLOCK_REALTIME clock"); } - - if (tsfin.tv_nsec < tsini.tv_nsec) - tsfin.tv_sec -= 1; - - status = tsfin.tv_sec - tsini.tv_sec; - if (status >= 2) - { - /* the operation was more than 2 secs long */ - FAILED("the processes did not execute concurrently"); - } - - /* Test passed */ - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/11-1.c deleted file mode 100644 index 1b0da3fd43..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/11-1.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The file locks are not inherited by the child process. - -* The steps are: -* -> lock stdout -* -> fork -* -> child creates a thread -* -> child thread trylock stdout -* -> join the child - -* The test fails if the child thread cannot lock the file -* -- this would mean the child process got stdout file lock ownership. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -/* Thread function */ -void * threaded( void * arg ) -{ - int ret; - ret = ftrylockfile( stdout ); - - if ( ret != 0 ) - { - FAILED( "The child process is owning the file lock." ); - } - -#if VERBOSE > 1 - - output( "The file lock was not inherited in the child process\n" ); - -#endif - - return NULL; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - pthread_t ch; - - /* Initialize output */ - output_init(); - - /* lock the stdout file */ - flockfile( stdout ); - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - - ret = pthread_create( &ch, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a thread" ); - } - - ret = pthread_join( ch, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent sleeps for a while to create contension in case the file lock is inherited */ - sleep( 1 ); - - funlockfile( stdout ); - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/12-1.c deleted file mode 100644 index 3d69095921..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/12-1.c +++ /dev/null @@ -1,287 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The child process is created with no pending signal - -* The steps are: -* -> block SIGUSR1 and SIGUSR2 -* -> send those signals and wait they are pending -* -> fork -* -> check the signals are blocked but not pending in the new process. - -* The test fails if the signals are pending or if -* they are not blocked (this counters assertion 2). - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - sigset_t mask, pending; - - /* Initialize output */ - output_init(); - - /* block SIGUSR1 and SIGUSR2 */ - ret = sigemptyset( &mask ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to initialize signal set" ); - } - - ret = sigaddset( &mask, SIGUSR1 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to add SIGUSR1 to signal set" ); - } - - ret = sigaddset( &mask, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to add SIGUSR2 to signal set" ); - } - - ret = sigprocmask( SIG_BLOCK, &mask, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Sigprocmask failed" ); - } - - /* Make the signals pending */ - ret = kill( getpid(), SIGUSR1 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "failed to kill with SIGUSR1" ); - } - - ret = kill( getpid(), SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "failed to kill with SIGUSR2" ); - } - - do - { - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "failed to examine pending signal set" ); - } - - ret = sigismember( &pending, SIGUSR1 ); - - if ( ret < 0 ) - { - UNRESOLVED( errno, "Unable to check signal USR1 presence" ); - } - - if ( ret == 1 ) - { - ret = sigismember( &pending, SIGUSR2 ); - - if ( ret < 0 ) - { - UNRESOLVED( errno, "Unable to check signal USR2 presence" ); - } - } - } - while ( ret != 1 ); - -#if VERBOSE > 0 - - output( "SIGUSR1 and SIGUSR2 are pending, we can fork\n" ); - -#endif - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - /* Examine the current blocked signal set. USR1 & USR2 shall be present */ - ret = sigprocmask( 0, NULL, &mask ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Sigprocmask failed in child" ); - } - - ret = sigismember( &mask, SIGUSR1 ); - - if ( ret < 0 ) - { - UNRESOLVED( errno, "Unable to check signal USR1 presence" ); - } - - if ( ret == 0 ) - { - FAILED( "The new process does not mask SIGUSR1 as its parent" ); - } - - ret = sigismember( &mask, SIGUSR2 ); - - if ( ret < 0 ) - { - UNRESOLVED( errno, "Unable to check signal USR2 presence" ); - } - - if ( ret == 0 ) - { - FAILED( "The new process does not mask SIGUSR2 as its parent" ); - } - -#if VERBOSE > 0 - output( "SIGUSR1 and SIGUSR2 are blocked in child\n" ); - -#endif - - /* Examine pending signals */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "failed to examine pending signal set in child" ); - } - - ret = sigismember( &pending, SIGUSR1 ); - - if ( ret < 0 ) - { - UNRESOLVED( errno, "Unable to check signal USR1 presence" ); - } - - if ( ret != 0 ) - { - FAILED( "The new process was created with SIGUSR1 pending" ); - } - - ret = sigismember( &pending, SIGUSR2 ); - - if ( ret < 0 ) - { - UNRESOLVED( errno, "Unable to check signal USR2 presence" ); - } - - if ( ret != 0 ) - { - FAILED( "The new process was created with SIGUSR2 pending" ); - } - -#if VERBOSE > 0 - output( "SIGUSR1 and SIGUSR2 are not pending in child\n" ); - -#endif - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/13-1.c deleted file mode 100644 index 44d0c94ca8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/13-1.c +++ /dev/null @@ -1,213 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* Interval timers are reset in the child process. - -* The steps are: -* -> create an interval timer in the parent process -* -> fork -* -> check the timer has been cleared in child. - -* The test fails if the timer is running in the child. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* The interval timers are an XSI feature */ -#ifndef WITHOUT_XOPEN -#define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - struct itimerval it; - - /* Initialize output */ - output_init(); - - /* Create the interval timer */ - it.it_interval.tv_sec = 15; - it.it_interval.tv_usec = 0; - it.it_value.tv_sec = 10; - it.it_value.tv_usec = 0; - - ret = setitimer( ITIMER_REAL, &it, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to set interval timer for ITIMER_REAL" ); - } - - ret = setitimer( ITIMER_VIRTUAL, &it, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to set interval timer for ITIMER_VIRTUAL" ); - } - - ret = setitimer( ITIMER_PROF, &it, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to set interval timer for ITIMER_PROF" ); - } - -#if VERBOSE > 0 - output( "All interval timers are set.\n" ); - -#endif - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - /* Check we get the correct information: timer is reset */ - ret = getitimer( ITIMER_REAL, &it ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read ITIMER_REAL in child" ); - } - - if ( it.it_value.tv_sec != 0 ) - { - FAILED( "Timer ITIMER_REAL was not reset in child" ); - } - - ret = getitimer( ITIMER_VIRTUAL, &it ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read ITIMER_VIRTUAL in child" ); - } - - if ( it.it_value.tv_sec != 0 ) - { - FAILED( "Timer ITIMER_VIRTUAL was not reset in child" ); - } - - ret = getitimer( ITIMER_PROF, &it ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read ITIMER_PROF in child" ); - } - - if ( it.it_value.tv_sec != 0 ) - { - FAILED( "Timer ITIMER_PROF was not reset in child" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main( int argc, char * argv[] ) -{ - output_init(); - UNTESTED( "This testcase requires XSI features" ); -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/14-1.c deleted file mode 100644 index fe7cbbf478..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/14-1.c +++ /dev/null @@ -1,235 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* Opened semaphores are inherited in the child process.. - -* The steps are: -* -> Open 2 named semaphores, then unlink one. -* -> fork -* -> The child tries and posts both semaphores, then terminates. -* -> The parent waits for the child, then check the semaphores were posted - -* The test fails if any semaphore has not been posted in the child. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - sem_t * sem_linked, *sem_unlinked; - - /* Initialize output */ - output_init(); - - sem_linked = sem_open( "/fork_14_1a", O_CREAT, O_RDWR, 0 ); - - if ( sem_linked == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to create the named semaphore" ); - } - - sem_unlinked = sem_open( "/fork_14_1b", O_CREAT, O_RDWR, 0 ); - - if ( sem_unlinked == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to create the named semaphore" ); - } - - ret = sem_unlink( "/fork_14_1b" ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink the semaphore" ); - } - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - do - { - ret = sem_post( sem_linked ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post semaphore A" ); - } - - do - { - ret = sem_post( sem_unlinked ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post semaphore B" ); - } - - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* Check both semaphores have been posted */ - do - { - ret = sem_trywait( sem_linked ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - if ( errno == EAGAIN ) - { - FAILED( "Child did not inherit the semaphore A" ); - } - else - { - UNRESOLVED( errno, "sem_trywait failed" ); - } - } - - do - { - ret = sem_trywait( sem_unlinked ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - if ( errno == EAGAIN ) - { - FAILED( "Child did not inherit the semaphore B" ); - } - else - { - UNRESOLVED( errno, "sem_trywait failed" ); - } - } - - ret = sem_unlink( "/fork_14_1a" ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink semaphore A" ); - } - - ret = sem_close( sem_linked ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close semaphore A" ); - } - - ret = sem_close( sem_unlinked ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close semaphore B" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/16-1.c deleted file mode 100644 index 3d0f668cac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/16-1.c +++ /dev/null @@ -1,223 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* Memory mappings created in the parent are retained in the child process. -* If the mapping is MAP_PRIVATE, any modification done after the fork() -* is visible only to the process doing the modification. - -* The steps are: -* -> create two shared memory segments. -* -> mmap both segment, one is MAP_SHARED and the other MAP_PRIVATE. -* -> Write some data into the segment. -* -> fork -* -> The child checks that the data is visible in the segments, then modifies it. -* -> child terminates -* -> The parent checks that the modifications are visible only in the MAP_SHARED segment. - -* The test fails if one of the check is not verified. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include -#include -#include -#include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - int fd_s, fd_ns; - void *buf_s, *buf_ns; - - /* Initialize output */ - output_init(); - - /* Create the shared memory segment */ - fd_s = shm_open( "/fork_16_1s", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR ); - - if ( fd_s == -1 ) - { - UNRESOLVED( errno, "Failed to open shared memory segment" ); - } - - fd_ns = shm_open( "/fork_16_1ns", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR ); - - if ( fd_ns == -1 ) - { - UNRESOLVED( errno, "Failed to open shared memory segment" ); - } - - /* Size the memory segment to 1 page size. */ - ret = ftruncate( fd_s, sysconf( _SC_PAGESIZE ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to size the shared memory segment" ); - } - - ret = ftruncate( fd_ns, sysconf( _SC_PAGESIZE ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to size the shared memory segment" ); - } - - /* Map these sengments in the process memory space */ - buf_s = mmap( NULL, sysconf( _SC_PAGESIZE ), PROT_READ | PROT_WRITE, MAP_SHARED, fd_s, 0 ); - - if ( buf_s == MAP_FAILED ) - { - UNRESOLVED( errno, "Failed to mmap the shared memory segment" ); - } - - buf_ns = mmap( NULL, sysconf( _SC_PAGESIZE ), PROT_READ | PROT_WRITE, MAP_PRIVATE, fd_ns, 0 ); - - if ( buf_ns == MAP_FAILED ) - { - UNRESOLVED( errno, "Failed to mmap the shared memory segment in MAP_PRIVATE mode" ); - } - - /* Write some data into the buffers */ - *( long * ) buf_ns = 123456L; - - *( long * ) buf_s = 654321L; - - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - /* Check the values are read -- so that the mappings were inherited */ - - if ( ( *( long * ) buf_ns != 123456L ) || ( *( long * ) buf_s != 654321L ) ) - { - output( "Read values: %ld, %ld\n", *( long * ) buf_ns, *( long * ) buf_s ); - FAILED( "The memory mappings were not inherited by the child process" ); - } - - /* Now modify the values */ - *( long * ) buf_ns = 100000L; - - *( long * ) buf_s = 200000L; - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* Check that only the MAP_SHARED segment modification is visible */ - if ( ( *( long * ) buf_ns != 123456L ) || ( *( long * ) buf_s != 200000L ) ) - { - output( "Read values: %ld, %ld\n", *( long * ) buf_ns, *( long * ) buf_s ); - FAILED( "The memory mappings were not inherited by the child process" ); - } - - /* Free resources (everything will be removed at destruction time) */ - ret = shm_unlink( "/fork_16_1ns" ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink the shared memory segment" ); - } - - ret = shm_unlink( "/fork_16_1s" ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink the shared memory segment" ); - } - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/17-1.c deleted file mode 100644 index 2e2988ebe9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/17-1.c +++ /dev/null @@ -1,175 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* For the SCHED_FIFO and SCHED_RR scheduling policies, -* the child process inherits the policy and priority -* settings of the parent process during a fork() function. - -* The steps are: -* -> Change the parent's scheduling policy and parameter -* -> fork -* -> check the child inherited the same policy. - -* The test fails if the child does not inherit the parent's values. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define POLICY SCHED_RR - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, param, status; - pid_t child, ctl; - - struct sched_param sp; - - /* Initialize output */ - output_init(); - - /* Change process policy and parameters */ - sp.sched_priority = param = sched_get_priority_max( POLICY ); - - if ( sp.sched_priority == -1 ) - { - UNRESOLVED( errno, "Failed to get max priority value" ); - } - - ret = sched_setscheduler( 0, POLICY, &sp ); - - if ( ret == -1 ) - { - UNRESOLVED( errno, "Failed to change process scheduling policy" ); - } - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - - /* Check the scheduling policy */ - ret = sched_getscheduler( 0 ); - - if ( ret == -1 ) - { - UNRESOLVED( errno, "Failed to read scheduling policy in child" ); - } - - if ( ret != POLICY ) - { - FAILED( "The scheduling policy was not inherited" ); - } - - ret = sched_getparam( 0, &sp ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read scheduling parameter in child" ); - } - - if ( sp.sched_priority != param ) - { - FAILED( "The scheduling parameter was not inherited" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/17-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/17-2.c deleted file mode 100644 index 253f011a47..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/17-2.c +++ /dev/null @@ -1,175 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* For the SCHED_FIFO and SCHED_RR scheduling policies, -* the child process inherits the policy and priority -* settings of the parent process during a fork() function. - -* The steps are: -* -> Change the parent's scheduling policy and parameter -* -> fork -* -> check the child inherited the same policy. - -* The test fails if the child does not inherit the parent's values. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define POLICY SCHED_FIFO - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, param, status; - pid_t child, ctl; - - struct sched_param sp; - - /* Initialize output */ - output_init(); - - /* Change process policy and parameters */ - sp.sched_priority = param = sched_get_priority_max( POLICY ); - - if ( sp.sched_priority == -1 ) - { - UNRESOLVED( errno, "Failed to get max priority value" ); - } - - ret = sched_setscheduler( 0, POLICY, &sp ); - - if ( ret == -1 ) - { - UNRESOLVED( errno, "Failed to change process scheduling policy" ); - } - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - - /* Check the scheduling policy */ - ret = sched_getscheduler( 0 ); - - if ( ret == -1 ) - { - UNRESOLVED( errno, "Failed to read scheduling policy in child" ); - } - - if ( ret != POLICY ) - { - FAILED( "The scheduling policy was not inherited" ); - } - - ret = sched_getparam( 0, &sp ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read scheduling parameter in child" ); - } - - if ( sp.sched_priority != param ) - { - FAILED( "The scheduling parameter was not inherited" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/18-1.c deleted file mode 100644 index a177d9b422..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/18-1.c +++ /dev/null @@ -1,198 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The per-process timers are not inherited. - -* The steps are: -* -> Create a per-process timer -* -> fork -* -> check if the timer exists in child. - -* The test fails if the timer expires in child (timer signal is delivered). - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* Global control value */ -int notified; - -/* Notification routine */ -void notification( union sigval sv ) -{ - if ( sv.sival_int != SIGUSR1 ) - { - output( "Got signal %d, expected %d\n", sv.sival_int, SIGUSR1 ); - UNRESOLVED( 1, "Unexpected notification" ); - } - - notified = ( int ) getpid(); -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - timer_t tmr; - - struct sigevent se; - - struct itimerspec it; - - /* Initialize output */ - output_init(); - - notified = 0; - - /* Create the timer */ - se.sigev_notify = SIGEV_THREAD; - se.sigev_signo = 0; - se.sigev_value.sival_int = SIGUSR1; - se.sigev_notify_function = ¬ification; - se.sigev_notify_attributes = NULL; /* default detached thread */ - - ret = timer_create( CLOCK_REALTIME, &se, &tmr ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to create a timer" ); - } - - /* Arm the timer */ - it.it_interval.tv_nsec = 0; - - it.it_interval.tv_sec = 0; - - it.it_value.tv_sec = 0; - - it.it_value.tv_nsec = 500000000; /* 0.5 sec */ - - ret = timer_settime( tmr, 0, &it, NULL ); - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - - sleep( 1 ); - - if ( notified != 0 ) - { - if ( notified == ( int ) getpid() ) - { - FAILED( "Per-Process Timer was inherited in child" ); - } - else - { - output( "Notification occured before the child forked" ); - } - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - if ( notified != ( int ) getpid() ) - { - output( "Notified value: %d\n", notified ); - UNRESOLVED( -1, "No notification occured -- per process timers do not work?" ); - } - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/19-1.c deleted file mode 100644 index 5eb794d202..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/19-1.c +++ /dev/null @@ -1,212 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The opened message queue descriptors are copied to the child process and -* refer to the same object. - -* The steps are: -* -> Open a message queue descriptor. -* -> Send a message to this descriptor. -* -> fork -* -> check if that the child's message count for this descriptor is 1. - -* The test fails if the child reports 0 message count -* or if it fails to read the descriptor. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - mqd_t mq; - char rcv[ 20 ]; - - struct mq_attr mqa; - - - /* Initialize output */ - output_init(); - - /* Create a message queue descriptor */ - mqa.mq_maxmsg = 2; - mqa.mq_msgsize = 20; - - mq = mq_open( "/fork_19_1_mq" - , O_RDWR | O_CREAT | O_NONBLOCK - , S_IRUSR | S_IWUSR - , &mqa ); - - if ( mq == ( mqd_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to create the message queue descriptor" ); - } - - /* Send 1 message to this message queue */ - ret = mq_send( mq, "I'm your father...", 19, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to send the message" ); - } - - /* Check the message has been queued */ - ret = mq_getattr( mq, &mqa ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to get message queue attributes" ); - } - - if ( mqa.mq_curmsgs != 1 ) - { - UNRESOLVED( -1, "The queue information does not show the new message" ); - } - - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - ret = mq_getattr( mq, &mqa ); - - if ( ret != 0 ) - { - FAILED( "Failed to get message queue attributes in child" ); - } - - if ( mqa.mq_curmsgs != 1 ) - { - FAILED( "The queue information does not show the message in child" ); - } - - /* Now, receive the message */ - ret = mq_receive( mq, rcv, 20, NULL ); - - if ( ret != 19 ) /* expected message size */ - { - UNRESOLVED( errno, "Failed to receive the message" ); - } - -#if VERBOSE > 0 - output( "Received message: %s\n", rcv ); - -#endif - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* Check the message has been unqueued */ - ret = mq_getattr( mq, &mqa ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to get message queue attributes the 2nd time" ); - } - - if ( mqa.mq_curmsgs != 0 ) - { - FAILED( "The message received in child was not dequeued." ); - } - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/2-1.c deleted file mode 100644 index b470185d3b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/2-1.c +++ /dev/null @@ -1,288 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The new process is a copy of the original one -- with few exceptions. - -* The steps are: -* -> set up some data in process memory space -* -> create a new process -* -> check in this new process that the memory space was copied. -* -* We check that: -* -> a structure object is copied. -* -> a malloc'ed memory block is copied and can be freed in child. -* -> the environment is copied -* -> signal handlers are copied - - -* The test fails if a difference is detected. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* We can use XSI features in case it is allowed */ -#ifndef WITHOUT_XOPEN -#define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -void handler( int sig ) -{ - /* this won't be used */ - output( "Sig %d received\n", sig ); - - return ; -} - - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - /* structure for structure test */ - - struct _thestruct - { - char one ; - short two; - int three; - void * four; - } - - mystruct = {1, 2, 3, ( void * ) 4}; - - /* pointer for malloc'ed memory */ - void * malloced; - - /* Structure for signal handler test */ - - struct sigaction sa_ori, sa_child; - - /* Initialize output */ - output_init(); - - /* Initialize the memory pointer */ - malloced = ( void * ) malloc( sysconf( _SC_PAGESIZE ) ); - - if ( malloced == NULL ) - { - UNRESOLVED( errno, "Unable to alloc memory" ); - } - - *( double * ) malloced = 2.3; - - /* Initialize an environment variable */ - ret = setenv( "OPTS_FORK_TC", "2-1.c", 1 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to set the environment variable" ); - } - - /* Initialize the signal handler */ - sa_ori.sa_handler = handler; - - ret = sigemptyset( &sa_ori.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "sigemptyset failed" ); - } - - ret = sigaddset( &sa_ori.sa_mask, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "sigaddset failed" ); - } - - sa_ori.sa_flags = SA_NOCLDSTOP; - ret = sigaction( SIGUSR1, &sa_ori, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to set the signal handler" ); - } - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - /* Check the struct was copied */ - - if ( ( mystruct.one != 1 ) || ( mystruct.two != 2 ) || ( mystruct.three != 3 ) || ( mystruct.four != ( void * ) 4 ) ) - { - FAILED( "The struct data was not copied to the child process" ); - } - - /* Check the malloc'ed memory is copied */ - if ( *( double * ) malloced != 2.3 ) - { - FAILED( "Malloc'd block not copied in child process" ); - } - - /* Free the memory -- this should suceed */ - free( malloced ); - - /* Check the env variable */ - if ( strncmp( "2-1.c", getenv( "OPTS_FORK_TC" ), 6 ) != 0 ) - { - FAILED( "The environment is not copied to the child" ); - } - - /* Check the signal handler stuff */ - ret = sigaction( SIGUSR1, NULL, &sa_child ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read sigaction information in child" ); - } - - if ( sa_child.sa_handler != handler ) - { - FAILED( "The child signal handler function is different from the parent's" ); - } - - ret = sigismember( &sa_child.sa_mask, SIGUSR2 ); - - if ( ret == 0 ) - { - FAILED( "The child signal handler mask is different from the parent's" ); - } - - if ( ret != 1 ) - { - UNRESOLVED( errno, "Unexpected return code from sigismember" ); - } - - if ( ( ( sa_child.sa_flags & SA_NOCLDSTOP ) != SA_NOCLDSTOP ) -#ifndef WITHOUT_XOPEN - || ( ( sa_child.sa_flags & SA_ONSTACK ) != 0 ) - || ( ( sa_child.sa_flags & SA_RESETHAND ) != 0 ) - || ( ( sa_child.sa_flags & SA_RESTART ) != 0 ) - || ( ( sa_child.sa_flags & SA_SIGINFO ) != 0 ) - || ( ( sa_child.sa_flags & SA_NOCLDWAIT ) != 0 ) - || ( ( sa_child.sa_flags & SA_NODEFER ) != 0 ) -#endif - ) - { - FAILED( "The sigaction flags are different in the child" ); - } - - /* The child stops here */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( !WIFEXITED( status ) ) - { - UNRESOLVED( status, "Child exited abnormally" ); - } - - if ( WEXITSTATUS( status ) == PTS_PASS ) - { - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); -#endif - - PASSED; - } - - if ( WEXITSTATUS( status ) == PTS_FAIL ) - { - - /* Test failed */ - FAILED( "Test failed in child\n" ); - } - - /* Otherwise we've an unexpected return code */ - UNRESOLVED( WEXITSTATUS( status ), "Child returned an unexpected error code" ); -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/21-1.c deleted file mode 100644 index ee932ed8f2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/21-1.c +++ /dev/null @@ -1,208 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The new process has only one thread. - -* The steps are: -* -> create a thread. -* -> fork -* -> Check that the thread is not running in the new process image. - -* The test fails if the thread is executing in the child process. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -sem_t * sem; - -/* Thread function */ -void * threaded( void * arg ) -{ - int ret = 0; - - do - { - ret = sem_wait( sem ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "failed to wait for the semaphore in child" ); - } - - if ( *( pid_t * ) arg != getpid() ) - { - FAILED( "The thread is executing in the child process" ); - } - - return NULL; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - pthread_t th; - - /* Initialize output */ - output_init(); - - ctl = getpid(); - - /* Initialize the semaphore */ - sem = sem_open( "/fork_21_1", O_CREAT, O_RDWR, 0 ); - - if ( sem == ( sem_t * ) SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to open the semaphore" ); - } - - sem_unlink( "/fork_21_1" ); - - - /* Create thread */ - ret = pthread_create( &th, NULL, threaded, &ctl ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create the thread" ); - } - - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* We post the semaphore twice */ - do - { - ret = sem_post( sem ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - /* sleep a little while to let the thread execute in case it exists */ - sleep( 1 ); - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* Destroy everything */ - ret = sem_close( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close the semaphore" ); - } - - ret = pthread_join( th, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread in parent" ); - } - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/22-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/22-1.c deleted file mode 100644 index eadb12fd5f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/22-1.c +++ /dev/null @@ -1,236 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The CPU-time clock of the new process/ new process's thread is initialized to 0. - -* The steps are: -* -> compute until the parent process CPU-time clock is greater than 1 sec. -* -> fork -* -> check the child process process CPU time and thread CPU time clocks. - -* The test fails if any of these clocks are > 1sec. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - long ctp, ctt; - clockid_t clp, clt; - - struct timespec tp; - - /* Initialize output */ - output_init(); - - ctp = sysconf( _SC_CPUTIME ); - ctt = sysconf( _SC_THREAD_CPUTIME ); - - if ( ( ctp == -1 ) && ( ctt == -1 ) ) - { - UNTESTED( "The testcase needs CPUTIME or THREAD_CPUTIME support" ); - } - -#if VERBOSE > 0 - output( "System abilities:\n" ); - - output( " _POSIX_CPUTIME : %ld\n", ctp ); - - output( " _POSIX_THREAD_CPUTIME : %ld\n", ctt ); - -#endif - if ( ctp > 0 ) - { - ret = clock_getcpuclockid( 0, &clp ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to get cpu-time clock id of the process" ); - } - - do - { - ret = clock_gettime( clp, &tp ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read CPU time clock" ); - } - } - while ( tp.tv_sec < 1 ); - } - - if ( ctt > 0 ) - { - ret = pthread_getcpuclockid( pthread_self(), &clt ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to get cpu-time clock id of the thread" ); - } - - do - { - ret = clock_gettime( clt, &tp ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read thread CPU time clock" ); - } - } - while ( tp.tv_sec < 1 ); - } - - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - if ( ctp > 0 ) - { - ret = clock_getcpuclockid( 0, &clp ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to get cpu-time clock id of the process" ); - } - - ret = clock_gettime( clp, &tp ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read CPU time clock" ); - } - - if ( tp.tv_sec > 0 ) - { - FAILED( "The process CPU-time clock was not reset in child\n" ); - } - } - - if ( ctt > 0 ) - { - ret = pthread_getcpuclockid( pthread_self(), &clt ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to get cpu-time clock id of the thread" ); - } - - ret = clock_gettime( clt, &tp ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read thread CPU time clock" ); - } - - if ( tp.tv_sec > 0 ) - { - FAILED( "The thread CPU-time clock was not reset in child\n" ); - } - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/3-1.c deleted file mode 100644 index 4925da43f5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/3-1.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The new process' ID does not match any existing process or group ID. - - * The steps are: - * -> create a child; then terminate this child. - * -> check that no other process or group has the same ID. - - * The test fails if another object shares the same ID. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main(int argc, char * argv[]) -{ - int ret, status; - pid_t child, ctl; - - /* Initialize output */ - output_init(); - - /* Create the child */ - child = fork(); - if (child == (pid_t) -1) { UNRESOLVED(errno, "Failed to fork"); } - - /* child */ - if (child == (pid_t) 0) - { - /* The child stops immediatly */ - exit(PTS_PASS); - } - - /* Parent joins the child */ - ctl = waitpid(child, &status, 0); - if (ctl != child) { UNRESOLVED(errno, "Waitpid returned the wrong PID"); } - if ((!WIFEXITED(status)) || (WEXITSTATUS(status) != PTS_PASS)) - { - UNRESOLVED(status, "Child exited abnormally"); - } - - ret = kill(child, 0); - if ((ret == 0) || (errno != ESRCH)) - { - output("Kill returned %d (%d: %s)\n", ret, errno, strerror(errno)); - FAILED("Another process with the same PID as the child exists"); - } - - ret = kill((pid_t) (0 - (int)child), 0); - if ((ret == 0) || (errno != ESRCH)) - { - output("Kill returned %d (%d: %s)\n", ret, errno, strerror(errno)); - FAILED("A process group with the same PID as the child exists"); - } - - - /* Test passed */ - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/4-1.c deleted file mode 100644 index e5b5e50b1f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/4-1.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The parent process ID of the child is the process ID of the parent (caller of fork()) - - * The steps are: - * -> create a child - * -> check its parent process ID is the PID of its parent. - - * The test fails if the IDs differ. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main(int argc, char * argv[]) -{ - int status; - pid_t child, ctl; - - /* Initialize output */ - output_init(); - - /* Get parent process ID */ - ctl = getpid(); - - /* Create the child */ - child = fork(); - if (child == (pid_t) -1) { UNRESOLVED(errno, "Failed to fork"); } - - /* child */ - if (child == (pid_t) 0) - { - /* Check the parent process ID */ - if (ctl != getppid()) - { - FAILED("The parent process ID is not the PID of the parent"); - } - - /* We're done */ - exit(PTS_PASS); - } - - /* Parent joins the child */ - ctl = waitpid(child, &status, 0); - if (ctl != child) { UNRESOLVED(errno, "Waitpid returned the wrong PID"); } - if ((!WIFEXITED(status)) || (WEXITSTATUS(status) != PTS_PASS)) - { - UNRESOLVED(status, "Child exited abnormally"); - } - - /* Test passed */ - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/6-1.c deleted file mode 100644 index 84a2484095..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/6-1.c +++ /dev/null @@ -1,199 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The opened directory streams are copied to the child process. -* Positionning information may be shared between both processes. - -* The steps are: -* -> Open the current directory, -* -> Count the directory entries, then rewind. -* -> create a child -* -> The child counts the directory entries. - -* The test fails if the directory is read in the parent and not in the child. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -int count( DIR * thedir ) -{ - int counter = 0; - - struct dirent *dp; - - rewinddir( thedir ); - - /* Count the directory entries */ - - do - { - dp = readdir( thedir ); - - if ( dp != NULL ) - counter++; - } - while ( dp != NULL ); - - return counter; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - int counted; - - /* the '.' directory pointers */ - DIR *dotdir; - - /* Initialize output */ - output_init(); - - /* Open the directory */ - dotdir = opendir( "." ); - - if ( dotdir == NULL ) - { - UNRESOLVED( errno, "opendir failed" ); - } - - /* Count entries */ - counted = count( dotdir ); - -#if VERBOSE > 0 - - output( "Found %d entries in current dir\n", counted ); - -#endif - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - /* Count in child process */ - counted = count( dotdir ); - -#if VERBOSE > 0 - - output( "Found %d entries in current dir from child\n", counted ); -#endif - - ret = closedir( dotdir ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close dir in child" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally -- dir stream not copied?" ); - } - - /* close the directory stream */ - ret = closedir( dotdir ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to closedir in parent" ); - } - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/7-1.c deleted file mode 100644 index 323e77b5e9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/7-1.c +++ /dev/null @@ -1,219 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The child process gets a copy of the parent message catalog descriptor. - - -* The steps are: -* -> Create a message catalog file from the "messcat_src.txt" file -* -> Open this catalog -* -> fork -* -> Check that the child can read from the message catalog. - -* The test fails if the message catalog is read in the parent and not in the child. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define PATH_OFFSET "conformance/interfaces/fork/" - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -void read_catalog( nl_catd cat, char * who ) -{ - char * msg = NULL; - int i, j; - errno = 0; - -#if VERBOSE > 0 - - output( "Reading the message catalog from %s...\n", who ); -#endif - - for ( i = 1; i <= 2; i++ ) - { - for ( j = 1; j <= 2; j++ ) - { - msg = catgets( cat, i, j, "not found" ); - - if ( errno != 0 ) - { - UNRESOLVED( errno, "catgets returned an error" ); - } - -#if VERBOSE > 1 - output( "set %i msg %i: %s\n", i, j, msg ); - -#endif - - } - } - -#if VERBOSE > 0 - output( "Message catalog read successfully in %s\n", who ); - -#endif -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - nl_catd messcat; - - /* Initialize output */ - output_init(); - - - /* Generate the message catalog file from the text sourcefile */ - - if ( system( NULL ) ) - { - ret = system( "gencat mess.cat " PATH_OFFSET "messcat_src.txt" ); - - if ( ret != 0 ) - { - output( "Unable to find messcat_src.txt in standard directory %s\n", PATH_OFFSET ); - output( "Trying local dir\n" ); - ret = system( "gencat mess.cat messcat_src.txt" ); - - if ( ret != 0 ) - { - output( "Could not find the source file for message catalog.\n" \ - "You may need to execute gencat yourself.\n" ); - } - } - } - - /* Try opening the message catalog file */ - messcat = catopen( "./mess.cat", 0 ); - - if ( messcat == ( nl_catd ) - 1 ) - { - UNRESOLVED( errno, "Could not open ./mess.cat. You may need to do a gencat before executing this testcase" ); - } - - /* Read the message catalog */ - read_catalog( messcat, "parent" ); - - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - read_catalog( messcat, "child" ); - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* We can now clean up the message catalog file */ - ret = catclose( messcat ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close the message catalog" ); - } - - /* Try removing the message catalog file */ - system( "rm -f mess.cat" ); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/8-1.c deleted file mode 100644 index c8821b8213..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/8-1.c +++ /dev/null @@ -1,236 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* tms_{,c}{u,s}time values are set to 0 in the child process. - - -* The steps are: -* -> Work for 1 second and save the tms information -* -> fork -* -> Check that the child has tms values less than the saved tms. -* -> join the child process -* -> check tms_c{u,s}time are not 0 anymore. - -* The test fails if one of the described checking fails. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int status; - pid_t child, ctl; - - clock_t st_time, cur_time; - - struct tms ini_tms, parent_tms, child_tms; - - /* Initialize output */ - output_init(); - - /* Initialize first times */ - st_time = times( &ini_tms ); - - if ( st_time == ( clock_t ) - 1 ) - { - UNRESOLVED( errno, "times failed" ); - } - - if ( ( ini_tms.tms_cutime != 0 ) || ( ini_tms.tms_cstime != 0 ) ) - { - FAILED( "The process is created with non-zero tms_cutime or tms_cstime" ); - } - -#if VERBOSE > 1 - output( "Starting loop...\n" ); - -#endif - - /* Busy loop for some times */ - do - { - cur_time = times( &parent_tms ); - - if ( cur_time == ( clock_t ) - 1 ) - { - UNRESOLVED( errno, "times failed" ); - } - } - while ( ( cur_time - st_time ) < sysconf( _SC_CLK_TCK ) ); - -#if VERBOSE > 1 - - output( "Busy loop terminated\n" ); - - output( " Real time: %ld, User Time %ld, System Time %ld, Ticks per sec %ld\n", - ( long ) ( cur_time - st_time ), - ( long ) ( parent_tms.tms_utime - ini_tms.tms_utime ), - ( long ) ( parent_tms.tms_stime - ini_tms.tms_stime ), - sysconf( _SC_CLK_TCK ) ); - -#endif - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - - cur_time = times( &child_tms ); - - if ( cur_time == ( clock_t ) - 1 ) - { - UNRESOLVED( errno, "times failed" ); - } - - if ( child_tms.tms_utime + child_tms.tms_stime >= sysconf( _SC_CLK_TCK ) ) - { - FAILED( "The tms struct was not reset during fork() operation" ); - } - - do - { - cur_time = times( &child_tms ); - - if ( cur_time == ( clock_t ) - 1 ) - { - UNRESOLVED( errno, "times failed" ); - } - } - while ( ( child_tms.tms_utime + child_tms.tms_stime ) <= 0 ); - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ) - ; - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ) - ; - } - - /* Check the children times were reported as expected */ - cur_time = times( &parent_tms ); - -#if VERBOSE > 1 - - output( "Child joined\n" ); - - output( " Real time: %ld,\n" - " User Time %ld, System Time %ld,\n" - " Child User Time %ld, Child System Time %ld\n", - ( long ) ( cur_time - st_time ), - ( long ) ( parent_tms.tms_utime - ini_tms.tms_utime ), - ( long ) ( parent_tms.tms_stime - ini_tms.tms_stime ), - ( long ) ( parent_tms.tms_cutime - ini_tms.tms_cutime ), - ( long ) ( parent_tms.tms_cstime - ini_tms.tms_cstime ) - ); - -#endif - - if ( cur_time == ( clock_t ) - 1 ) - { - UNRESOLVED( errno, "times failed" ); - } - - if ( ( parent_tms.tms_cutime == 0 ) && ( parent_tms.tms_cstime == 0 ) ) - { - FAILED( "The process is created with non-zero tms_cutime or tms_cstime" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/9-1.c deleted file mode 100644 index 477708bef2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/9-1.c +++ /dev/null @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The time left until an alarm clock is triggered is reset to zero, -* and the alarm, if any, is canceled - -* The steps are: -* -> Trig an alarm -* -> fork -* -> Check the alarm is not running in the child process. -* -> join the child - -* The test fails if the child has a pending alarm. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - /* Initialize output */ - output_init(); - - /* Set the alarm pending */ - alarm( 10 ); - - /* Check the alarm() behavior */ - ret = alarm( 10 ); - - if ( ret == 0 ) - { - FAILED( "the alarm() routine does not behave as expected" ); - } - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - - ret = alarm( 10 ); - - if ( ret != 0 ) - { - FAILED( "The child alarm pending was not reset." ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - alarm( 0 ); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/assertions.xml deleted file mode 100644 index 34fba955c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/assertions.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - fork() creates a new process. - - - The new process is a copy of the original process - -- unless specified otherwise below. - - - The new process' ID does not match any existing - process or group ID. - - - The parent process ID (ppid) of the child process - is the process ID (pid) of the parent process - (caller of fork()). - - - The opened file descriptors are copied to the child process - and refer to the same object. - - - The opened directory streams are copied to the child process. - Positioning information may be shared between both processes. - - - The child process gets a copy of the parent message catalog descriptor. - - - tms_utime, tms_stime, tms_cutime, and tms_cstime values - are set to 0 in the child process. - - - The time left until an alarm clock signal is reset to zero, - and the alarm, if any, is canceled. - - - semadj values are cleared. - - - The file locks are not inherited by the child process. - - - The child process is created with no pending signals. - - - Interval timers are reset in the child process. - - - The opened semaphores are inherited in the child process. - - - The child process does not inherit memory locks set by - the parent process with mlock or mlockall. - - - Memory mappings created in the parent are retained in the - child process. If the mapping is MAP_PRIVATE, any modification - done after the fork() is visible only to the process doing the - modification. - - - For the SCHED_RR and SCHED_FIFO scheduling policies, the child - process inherits the policy and priority settings of the parent - process during the fork() execution. - - - The per-process timers are not inherited. - - - The opened message queue descriptors are copied to the child - process and refer to the same object. - - - Asynchronous IO operations are not inherited by the child. - - - The new process has only one thread. - - - The CPU-time clocks of the new process/ new process' thread - are initialized to 0. - - - fork() returns 0 to the child and the child PID to the parent process when - succesful. - - - fork() returns -1, errno is set to EAGAIN, and no child process - is created if the system lacks a resource to create the new process - or CHILD_MAX process are already running. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/messcat_src.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/messcat_src.txt deleted file mode 100644 index e0067d9cc5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/messcat_src.txt +++ /dev/null @@ -1,26 +0,0 @@ -$ Copyright (c) 2004, Bull S.A.. All rights reserved. -$ Created by: Sebastien Decugis -$ -$ 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., 59 -$ Temple Place - Suite 330, Boston MA 02111-1307, USA. -$ -$ -$ This file is part of the 7-1.c test case for the fork() routine. - -$set 1 Message set for OPTS fork test case, English language -1 This is the first message -2 And this is the second - -$set 2 Message set for OPTS fork test case, French language -1 Voici le premier message -2 Et voilà le second - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/4-1.c deleted file mode 100644 index 87f51e9b3b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/4-1.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Upon successful completion, fsync( ) shall return 0. - * Otherwise, .1 shall be returned and errno set - * to indicate the error. If the fsync( ) function fails. - * - * 1. Create a regular file; - * 2. Write a few bytes to the file, call fsycn(), should return 0; - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "fsync/4-1.c" - -int main() -{ - char tmpfname[256]; - char* data; - int total_size = 1024; - int fd; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_fsync_4_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - /* Make sure the file is removed when it is closed */ - unlink(tmpfname); - data = (char *) malloc(total_size); - memset(data, 'a', total_size); - if (write(fd, data, total_size) != total_size) - { - printf(TNAME "Error at write(): %s\n", - strerror(errno)); - free(data); - exit(PTS_UNRESOLVED); - } - free(data); - - if (fsync(fd) == -1) - { - printf(TNAME "Error at fsync(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/5-1.c deleted file mode 100644 index 58e1c69af2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/5-1.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * The fsync( ) function shall fail if: - * [EBADF] The fildes argument is not a valid descriptor. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - int fd; - - /* -1 is an invalid fd */ - - fd = -1; - if (fsync(fd) == -1 && errno == EBADF) - { - printf("Got EBADF when fd=-1\n"); - printf("Test PASSED\n"); - exit(PTS_PASS); - } - else - { - printf("Test FAILED: Expect EBADF, get: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/7-1.c deleted file mode 100644 index 09dd5db4e2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/7-1.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The fsync( ) function shall fail if: - * [EINVAL] The fildes argument does not refer to a file - * on which this operation is possible. - * - * Test Step: - * 1. Create a pipe; - * 2. fsync on the pipe, should fail with EINVAL; - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "fsync/7-1.c" - -int main() -{ - int fd[2]; - - if (pipe(fd) == -1) - { - printf(TNAME " Test UNRESOLVED: Error at pipe: %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - if (fsync(fd[1]) == -1 && errno == EINVAL) - { - printf("Got EINVAL when fsync on pipe\n"); - printf("Test PASSED\n"); - close(fd[0]); - close(fd[1]); - exit(PTS_PASS); - } - else - { - printf(TNAME " Test Fail: Expect EINVAL, get: %s\n", - strerror(errno)); - close(fd[0]); - close(fd[1]); - exit(PTS_FAIL); - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/assertions.xml deleted file mode 100644 index 70a65d7390..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/assertions.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - The fsync( ) function shall request that all data for the open file descriptor named by - fildes is to be transferred to the storage device associated with the file described by - fildes in an implementation-defined manner. - - - - The fsync( ) function shall not return until the system has - completed that action or until an error is detected. - - - - SIO If _POSIX_SYNCHRONIZED_IO is defined, the fsync( ) function shall force all currently - queuee I/O operations associated with the file indicated by file descriptor fildes to the - synchronized I/O completion state. All I/O operations shall be completed as defined for - synchronized I/O file integrity completion. - - - - Upon successful completion, fsync( ) shall return 0. Otherwise, .1 shall be returned and - errno set to indicate the error. If the fsync( ) function fails, outstanding I/O operations - are not guaranteed to have been completed. - - - - The fsync( ) function shall fail if: - [EBADF] The fildes argument is not a valid descriptor. - - - - The fsync( ) function shall fail if: - [EINTR] The fsync( ) function was interrupted by a signal. - - - - The fsync( ) function shall fail if: - [EINVAL] The fildes argument does not refer to a file on which this operation is possible. - - - - The fsync( ) function shall fail if: - [EIO] An I/O error occurred while reading from or writing to the file system. - - - - In the event that any of the queued I/O operations fail, fsync( ) shall return the error - conditions defined for read( ) and write( ). - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/coverage.txt deleted file mode 100644 index 864b9f0371..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fsync/coverage.txt +++ /dev/null @@ -1,25 +0,0 @@ -This document defines the coverage for the fsync() function: - -Assertion Tested? -1 NO -2 NO -3 NO ** Synchronized I/O -4 YES -5 YES -6 NO -7 YES -8 NO: ** Not sure how to generate an I/O error -9 NO: ** Synchronized I/O - -NOTE: - -Assertion 1 is hard to test. Here cited the specification: - -It is reasonable to assert that the key aspects of fsync( ) are unreasonable to test in a test -suite. -That does not make the function any less valuable, just more difficult to test. A formal -conformance test should probably force a system crash (power shutdown) during the test for -this condition, but it needs to be done in such a way that automated testing does not require -this to be done except when a formal record of the results is being made. It would also not be -unreasonable to omit testing for fsync( ), allowing it to be treated as a -quality-of-implementation issue. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/1-1.c deleted file mode 100644 index 95b60a2438..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/1-1.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * getpid() always returns the process ID of the calling thread/process. - - * The steps are: - * - * -> create two threads and check they get the same getpid() return value. - * -> create two processes and check they get different getpid() return value. - * -> check that the child process getpid() return value matchs the fork() return - value in the parent process. - - * The test fails if any of the previous checks is not verified. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes - and the mkstemp() routine */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN - -pid_t * sharedpid; - -/* This will be executed by the child process */ -void child(void) -{ - *sharedpid=getpid(); - exit(0); -} - -/* This will be executed by the child thread */ -void * threaded(void * arg) -{ - *(pid_t *)arg = getpid(); - return NULL; -} - -/* The main test function. */ -int main(int argc, char * argv[]) -{ - int ret, status; - long mf; /* Is memory mapping supported? */ - pid_t mypid, hispid, ctlpid; - pthread_t child_thread; - - /* Initialize output */ - output_init(); - - /* Get self PID */ - mypid=getpid(); - #if VERBOSE > 1 - output("Main pid: %d\n", mypid); - #endif - - /* Get a child thread PID */ - ret = pthread_create(&child_thread, NULL, threaded, &hispid); - if (ret != 0) { UNRESOLVED(ret, "Thread creation failed"); } - ret = pthread_join(child_thread, NULL); - if (ret != 0) { UNRESOLVED(ret, "Thread join failed"); } - - #if VERBOSE > 1 - output("Thread pid: %d\n", hispid); - #endif - - /* Compare threads PIDs */ - if (mypid != hispid) - { - FAILED("Child thread got a different return value from getpid()\n"); - } - - /* Test system abilities */ - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" MF : %li\n", mf); - if (mf <= 0) - output("Unable to test without shared data\n"); - #endif - - /* We need MF support for the process-cross testing */ - if (mf > 0) - { - /* We will place the child pid in a mmaped file */ - char filename[] = "/tmp/getpid-1-XXXXXX"; - void * mmaped; - int fd; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - /* Fill the file up to 1 pagesize */ - ret = ftruncate(fd, sysconf(_SC_PAGESIZE)); - if (ret != 0) { UNRESOLVED(errno, "ftruncate operation failed"); } - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - /* Set the sharedpid pointer to this mmaped area */ - sharedpid = (pid_t *) mmaped; - - /* Our data is now in shared memory */ - #if VERBOSE > 1 - output("Shared memory is ready.\n"); - #endif - - /* Okay, let's create the child process */ - hispid=fork(); - if (hispid == (pid_t)-1) { UNRESOLVED(errno, "Fork failed"); } - - /* Child process : */ - if (hispid == (pid_t)0) - child(); - - /* Otherwise, we're the parent */ - ctlpid = waitpid(hispid, &status, 0); - if (ctlpid != hispid) { UNRESOLVED(errno, "waitpid waited for the wrong process"); } - if (!WIFEXITED(status) || WEXITSTATUS(status)) - { UNRESOLVED(status, "The child process did not terminate as expected"); } - - #if VERBOSE > 1 - output("Child process pid: %d\n", hispid); - #endif - - /* Check the child pid is the same as fork returned */ - if (hispid != *sharedpid) - { FAILED("getpid() in the child returned a different value than fork() in the parent"); } - - /* Check the child pid is different than the parent pid */ - if (hispid == mypid) - { FAILED("Both child and parent getpid() return values are equal"); } - } - - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/assertions.xml deleted file mode 100644 index 4a711ee66e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/assertions.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - getpid() always returns the process ID of the calling thread/process. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/coverage.txt deleted file mode 100644 index 21afe3f34e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/coverage.txt +++ /dev/null @@ -1,4 +0,0 @@ -This file defines the coverage for the getpid() function testing. - -Assertion Status -1 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/getpid/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/1-1.c deleted file mode 100644 index 6ec3e337c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/1-1.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * - * The names in the broken-down tm structure should correspond to its values. - * - */ - - -#include -#include -#include - -int main () -{ - struct tm *tm_ptr; - time_t the_time; - int total_years; - - (void) time(&the_time); - tm_ptr = gmtime(&the_time); - printf("Raw time is %ld \n", the_time); - printf("gmtime gives:\n"); - - /* Checking the seconds */ - if ((tm_ptr->tm_sec >= 0) && (tm_ptr->tm_sec < 60 )) { - printf("sec %02d\n", tm_ptr->tm_sec); - } else { - puts("Test FAILED: seconds"); - return PTS_FAIL; - } - - /* Checking the Minutes */ - if ((tm_ptr->tm_min >= 0) && (tm_ptr->tm_min <= 59 )) { - printf("min %02d\n", tm_ptr->tm_min); - } else { - puts("Test FAILED: minutes"); - return PTS_FAIL; - } - - /* Checking the Hour */ - if ((tm_ptr->tm_hour >= 0) && (tm_ptr->tm_hour <= 23 )) { - printf("hour %02d\n", tm_ptr->tm_hour); - } else { - puts("Test FAILED: hour"); - return PTS_FAIL; - } - - /* Checking the Month Day */ - if ((tm_ptr->tm_mday >= 1) && (tm_ptr->tm_mday <= 31 )) { - printf("mday %02d\n", tm_ptr->tm_mday); - } else { - puts("Test FAILED: mday"); - return PTS_FAIL; - } - - /* Checking the Month */ - if ((tm_ptr->tm_mon >= 0) && (tm_ptr->tm_mon <= 11 )) { - printf("mon %02d\n", tm_ptr->tm_mon); - } else { - puts("Test FAILED: mon"); - return PTS_FAIL; - } - - /* Checking the Year */ - total_years = (tm_ptr->tm_year + 1900); - if (total_years >= 1900) { - printf("year %d\n", total_years); - } else { - printf("year %d\n", total_years); - puts("Test FAILED: year"); - return PTS_FAIL; - } - - /* Checking the Day of week */ - if ((tm_ptr->tm_wday >= 0) && (tm_ptr->tm_wday <= 6 )) { - printf("wday %02d\n", tm_ptr->tm_wday); - } else { - puts("Test FAILED: wday"); - return PTS_FAIL; - } - - /* Checking the Day in year */ - if ((tm_ptr->tm_yday >= 0) && (tm_ptr->tm_yday <= 365 )) { - printf("yday %02d\n", tm_ptr->tm_yday); - } else { - puts("Test FAILED: yday"); - return PTS_FAIL; - } - - /* Checking the DTS */ - if ((tm_ptr->tm_isdst >= -1) && (tm_ptr->tm_isdst <= 1 )) { - printf("isdst %02d\n", tm_ptr->tm_isdst); - } else { - puts("Test FAILED: isdst"); - return PTS_FAIL; - } - - puts("Test PASSED"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/2-1.c deleted file mode 100644 index 280f539c80..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/2-1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * - * The gmtime function shall return a pointer to struct tm. - * - */ - - -#include -#include -#include - -int main () -{ - struct tm *tm_ptr; - time_t the_time; - - (void) time(&the_time); - tm_ptr = NULL; - tm_ptr = gmtime(&the_time); - - if (tm_ptr != NULL) { - puts("Test PASSED"); - return PTS_PASS; - } else { - puts("Test FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/assertions.xml deleted file mode 100644 index c80b448f83..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/assertions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - The names in the broken-down tm structure should correspond to its values. - - - The gmtime function shall return a pointer to a struct tm. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/coverage.txt deleted file mode 100644 index 490c6c4ec5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/gmtime/coverage.txt +++ /dev/null @@ -1,5 +0,0 @@ -This file defines the coverage for the gmtime() function testing. - -Assertion Status -1 YES -2 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/1-1.c deleted file mode 100644 index 2788236f3a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/1-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the kill() function shall send signal sig to the process - * specified by pid. - * 1) Set up a signal handler for the signal that says we have caught the - * signal. - * 2) Call kill on the current process with the signal. - * 3) If signal handler was called, test passed. - * This test is only performed on one signal. All other signals are - * considered to be in the same equivalence class. - */ - -#define SIGTOTEST SIGABRT - -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("Caught signal being tested!\n"); - printf("Test PASSED\n"); - exit(0); -} - -int main() -{ - struct sigaction act; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGTOTEST, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - if (kill(getpid(), SIGTOTEST) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - printf("Should have exited from signal handler\n"); - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/1-2.c deleted file mode 100644 index d704b95e0b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/1-2.c +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include -#include -#include -#include "posixtest.h" - -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the kill() function shall send signal sig to the process - * specified by pid when the process specified by pid is not the calling - * process. - * 1) Fork a child process. - * 2) In the parent process, call kill with signal SIGTOTEST for the - * pid of the child. - * In the child, - * 3) Wait for signal SIGTOTEST. - * 4) Return 1 if SIGTOTEST is found. Return 0 otherwise. - * 5) In the parent, return success if 1 was returned from child. - * - * This test is only performed on one signal. All other signals are - * considered to be in the same equivalence class. - * - * This test makes the assumption that 1 second of sleeping on the part - * of the parent is enough to give the child time to start waiting for - * the parent's signal. If that is not the case, this test will fail. - */ - -#define SIGTOTEST SIGUSR1 - -void myhandler (int signo) { - exit(1); -} - -int main() -{ - int pid; - - int sig; - sigset_t set; - if (sigemptyset(&set) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaddset(&set, SIGTOTEST) == -1) { - perror("Error calling sigaddset\n"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - struct sigaction act; - act.sa_handler=myhandler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGTOTEST, &act, 0); - - if (0 != sigwait(&set, &sig)) { - printf("Sigwait did not return 0. Possible problem with sigwait function\n"); - return 0; /* FAIL */ - } - - if (sig != SIGTOTEST) - return 0; /* FAIL */ - - return 1; - } else { - /* parent here */ - int i; - - sleep(1); - if (kill(pid, SIGTOTEST) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (WEXITSTATUS(i)) { - printf("Child exited normally\n"); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Child did not exit normally.\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - printf("Should have exited from parent\n"); - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c deleted file mode 100644 index ba248069b4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include -#include -#include "posixtest.h" - -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that if the signal is the null signal (0), no signal is sent. - * 1) Call kill on the current process with the null signal. - * 2) If process is still functional after kill() is called, consider - * the test a pass (most likely no signal was sent). - */ - -int main() -{ - if (kill(getpid(), 0) != 0) { - printf("Could not call kill with sig = 0\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-2.c deleted file mode 100644 index 341af3f645..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-2.c +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that when the null signal is sent to kill(), error checking is - * still performed. - * 1) Send a signal to generate an ESRCH error. - * ==> Send a signal to PID 999999 - * 2) Verify ESRCH error received and kill() returned -1. - * 3) Send a signal to generate an EPERM error. - * ==> Set UID to 1 and send a signal to init (pid = 1) - * 4) Verify EPERM error received and kill() returned -1. - * - * Note: These tests make the assumptions that: - * - They will be running as root. - * - The PID 999999 can never exist. - * - The UID 1 is available for assignment and cannot sent - * signals to root. - * *** I need to check to see if these assumptions are always valid. - */ - -int main() -{ - int failure = 0; - - /* - * ESRCH - */ - if (-1 == kill(999999, 0)) { - if (ESRCH == errno) { - printf("ESRCH error received\n"); - } else { - printf("kill() failed on ESRCH errno not set correctly\n"); - failure = 1; - } - } else { - printf("kill() did not fail on ESRCH\n"); - failure = 1; - } - - /* - * EPERM - */ - setuid(1); /* this is added incase user is root. If user is normal user, then it has no effect on the tests*/ - - if (-1 == kill(1, 0)) { - if (EPERM == errno) { - printf("EPERM error received\n"); - } else { - printf("kill() failed on EPERM errno not set correctly\n"); - failure = 1; - } - } else { - printf("kill() did not fail on EPERM\n"); - failure = 1; - } - - if (failure) { - printf("At least one test FAILED -- see output for status\n"); - return PTS_FAIL; - } else { - printf("All tests PASSED\n"); - return PTS_PASS; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/3-1.c deleted file mode 100644 index e7155c3f35..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/3-1.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - This program tests the assertion that if the user id of the sending process - doesn't match the user id of the receiving process (pid), then the kill function - will fail with errno set to EPERM. - - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - setuid(1); /* this is added incase user is root. If user is normal user, then it has no effect on the tests*/ - - if (kill(1, 0) != -1) { - printf("Test FAILED: kill() succeeded even though this program's user id did not match the recieving process's user id\n"); - return PTS_FAIL; - } - - if (EPERM != errno) { - printf("Test FAILED: EPERM error not received\n"); - return PTS_FAIL; - } - - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/assertions.xml deleted file mode 100644 index 7940911d2a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/assertions.xml +++ /dev/null @@ -1,78 +0,0 @@ - - -The kill function sends a signal (sig) to a process or group of processes -(pid). - - -If sig is 0 (null signal), only error checking (such as to check the validity -of pid) is performed. No signal is sent. - - -If the real or effective user ID of the sending process does not match the real -or saved set-user-ID of the receiving process (pid), the kill function -will fail with errno set to EPERM. - - -For pid > 0, sig is sent to process ID pid. - - -For pid == 0, sig is sent to all processes (except an unspecified -set of system processes) where process group ID == process group ID of sender. -The sending process must also have permission to send a signal to the -receiving process. - - -For pid == -1, sig is sent to all processes (except an unspecified -set of system processes). The sending process must have permission -to send signal sig to the receiving process. - - -For pid below 0 and != -1, sig is sent to all processes (except -an unspecified set of system processes) where process group ID == absolute -value of pid. The sending process must have permission to send signal -sig to the receiving process. - - -If it turns out that sig should be sent to the sending process (based on -pid's value), then it (or at least one pending unblocked signal) -will be sent to the sending thread before the kill() returns. However, -if one of these is the case: -- sig is blocked for the calling thread -- another thread has sign unblocked -- another thread is waiting in a sigwait() function for sig -it will not be sent. - - -If SIGCONT is being sent to a process that happens to be a member of the -same session as the sending process, then the user ID tests described in -assertion 3 won't be applied. - - -It is allowed for an implementation to impose further restrictions on the -sending of signals (for extended security controls), including restrictions -on the null signal. A particular example is to deny the existence of some -or all of the processes specified by the pid parameter. - - -If the process has permission to sent sig to at least one of the processes -specified by pid, then kill() is successful. When kill() is successful, -it returns 0. - - -When kill() is not successful, it returns -1 and sets errno to indicate -the type of error. - - -The kill() function sets errno to EINVAL if the value of the sig argument -is an invalid or unsupported signal number. - - -The kill() function sets errno to EPERM if the process does not have -permission to send the signal to at least one receiving process. - - -The kill() function sets errno to ESRCH if not one process or process group -can be found corresponding to the pid parameter. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/coverage.txt deleted file mode 100644 index 5d26454a17..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/coverage.txt +++ /dev/null @@ -1,21 +0,0 @@ -This file defines the coverage for the kill() function testing. - -Assertion Status -1 DONE -2 DONE - Open questions on assumptions -3 DONE - Note: This has a bug. The child doesn't die; it sits in constant wait. TBD how to fix (I tried adding another layer, but can't figure out how to kill the child without killing everything, so nothing is checked in.) -4 IMPLICITLY tested by assertion 1 -5 NOT STARTED -6 NOT STARTED -7 NOT STARTED -8 NOT STARTED -9 NOT STARTED -10 WON'T test. This assertion cannot really be tested; however, it is listed - as an FYI for the tester in that the assertion may cause some - items which could be perceived as failures to actually be - passes. -11 NOT STARTED -12 NOT STARTED -13 NOT STARTED -14 NOT STARTED -15 NOT STARTED diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-1.c deleted file mode 100644 index 49dae3c964..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-1.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the killpg() function shall send signal sig to the process - group specified by prgp. - Steps: - * 1. Set up a signal handler for the signal that says we have caught the - * signal. - * 2. Call killpg on the current process group id, raising the signal. - * 3. If signal handler was called, test passed. - - */ - -#define _XOPEN_SOURCE 600 -#define SIGTOTEST SIGCHLD - -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("Caught signal being tested!\n"); - printf("Test PASSED\n"); - exit(0); -} - -int main() -{ - int pgrp; - struct sigaction act; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGTOTEST, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - - if ((pgrp = getpgrp()) == -1) { - printf("Could not get process group number\n"); - return PTS_UNRESOLVED; - } - - if (killpg(pgrp, SIGTOTEST) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - printf("Should have exited from signal handler\n"); - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-2.c deleted file mode 100644 index 85f1a99fb1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/1-2.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Steps: - * 1) Fork a child process. - * 2) In the parent process, call killpg with signal SIGTOTEST for the - * process group id of the child. Have the parent ignore such a signal - * incase the process group id of the parent is the same as process - * group id of the child. - * In the child, - * 3) Wait for signal SIGTOTEST. - * 4) Return 1 if SIGTOTEST is found. Return 0 otherwise. - * 5) In the parent, return success if 1 was returned from child. - * - */ - -#define _XOPEN_SOURCE 600 -#define SIGTOTEST SIGUSR1 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void myhandler (int signo) { - exit(1); -} - -int main() -{ - int child_pid, child_pgid; - - if ((child_pid = fork()) == 0) { - /* child here */ - struct sigaction act; - act.sa_handler=myhandler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGTOTEST, &act, 0); - - /* change child's process group id */ - setpgrp(); - - sigpause(SIGABRT); - - return 0; - } else { - /* parent here */ - int i; - sigignore(SIGTOTEST); - - sleep(1); - if ((child_pgid = getpgid(child_pid)) == -1) { - printf("Could not get pgid of child\n"); - return PTS_UNRESOLVED; - } - - - if (killpg(child_pgid, SIGTOTEST) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (WEXITSTATUS(i)) { - printf("Child exited normally\n"); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Child did not exit normally.\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - printf("Should have exited from parent\n"); - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/2-1.c deleted file mode 100644 index 9dc68f17ed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/2-1.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Call killpg on the current process with 0 as the signal number. If killpg - returns success, then we pass. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - if (killpg(getpgrp(), 0) != 0) { - printf("Could not call killpg with sig = 0\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/4-1.c deleted file mode 100644 index 2a04a955b3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/4-1.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the killpg() function shall return 0 upon success. - - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - int pgrp; - - if ((pgrp = getpgrp()) == -1) { - printf("Could not get process group number\n"); - return PTS_UNRESOLVED; - } - - if (killpg(pgrp, 0) != 0) { - printf("killpg did not return success.\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/5-1.c deleted file mode 100644 index a37a921c84..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/5-1.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the killpg() function shall return -1 on failure. - - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("Caught signal being tested!\n"); - printf("Test PASSED\n"); - exit(0); -} - -int main() -{ - int pgrp; - - if ((pgrp = getpgrp()) == -1) { - printf("Could not get process group number\n"); - return PTS_UNRESOLVED; - } - - if (killpg(pgrp, -1) != -1) { - printf("Test FAILED: killpg did not return -1 even though it was passed an invalid signal number."); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/6-1.c deleted file mode 100644 index 65edc04c5b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/6-1.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the killpg() function shall set errno to EINVAL if it is - passed an invalid signal number - - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - int pgrp; - - if ((pgrp = getpgrp()) == -1) { - printf("Could not get process group number\n"); - return PTS_UNRESOLVED; - } - - if (killpg(pgrp, -1) != -1) { - printf("killpg did not return -1 even though it was passed an invalid signal number."); - return PTS_UNRESOLVED; - } - - if (errno != EINVAL) { - printf("killpg did not set errno to EINVAL even though it was passed an invalid signal number."); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/8-1.c deleted file mode 100644 index b5b24d31b4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/8-1.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the killpg() function shall set errno to ESRCH if it is - passed an invalid process group number - - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - if (killpg(999999, 0) != -1) { - printf("killpg did not return -1 even though it was passed an invalid process group id."); - return PTS_UNRESOLVED; - } - - if (errno != ESRCH) { - printf("killpg did not set errno to ESRCH even though it was passed an invalid signal number."); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/assertions.xml deleted file mode 100644 index e6cbd80ff5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/assertions.xml +++ /dev/null @@ -1,33 +0,0 @@ - - -The killpg () function sends the signal sig to the process -group pgrp. - - -killpg(pgrp, sig) is equivalent to kill(-pgrp, sig), when pgrp is greater than 1, - - -The behavior of killpg ( ) is undefined if pgrp is less than or equal to 1. - - -killpg returns 0 upon successful completion. - - -killpg returns -1, upon unsuccessful completion. - - -errno shall be set to EINVAL, when tThe value of the sig argument is an -invalid or unsupported signal -number. - - -errno shall be set to EPERM, when the process does not have permission to -send the signal to any -receiving process. - - -errno shall be set to ESRCH, when no process or process group can be found -corresponding to that specified by pid. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/coverage.txt deleted file mode 100644 index 5caffa7ae6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/killpg/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This file defines the coverage for the kill() function testing. - -Assertion Status -1 YES -2 YES -3 WON'T test, since behavior is undefined. -4 YES -5 YES -6 YES -7 WON'T test, since too risky to test without knowing what user id's are defined on each of the platforms that these tests may be run on. -8 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/1-1.c deleted file mode 100644 index c86e31884b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/1-1.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * If mode is LIO_WAIT, lio_listio() shall wait until all I/O is - * complete and the sig argument shall be ignored. - * - * method: - * - * - open a file for writing - * - submit a list of writes to lio_listio in LIO_WAIT mode - * - check that upon return all I/Os are completed - * - check that the sig argument is ignored - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/1-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024*1024 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - received_selected = info->si_value.sival_int; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb **aiocbs; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_1_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - aiocbs = (struct aiocb**)malloc(sizeof(struct aiocb *) * NUM_AIOCBS); - - /* Queue up a bunch of aio writes */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb *)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Submit request list */ - ret = lio_listio(LIO_WAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/10-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - received_selected = info->si_value.sival_int; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_10_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - /* Queue up a bunch of aio writes */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb *)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/11-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - received_selected = info->si_value.sival_int; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_11_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - /* Queue up a bunch of aio writes */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb *)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - - if (i == 2) - aiocbs[i]->aio_lio_opcode = -1; - else - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret == 0) { - printf(TNAME " Error lio_listio() should have returned -1\n"); - - for (i=0; i -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/12-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_12_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - /* Queue up a bunch of aio writes */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb *)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - } - - /* Submit request list */ - ret = lio_listio(LIO_WAIT, aiocbs, NUM_AIOCBS, NULL); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/13-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_13_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - /* Queue up a bunch of aio writes */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb *)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - - if (i == 2) - aiocbs[i]->aio_lio_opcode = -1; - else - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - } - - /* Submit request list */ - ret = lio_listio(LIO_WAIT, aiocbs, NUM_AIOCBS, NULL); - - if (ret == 0) { - printf(TNAME " Error lio_listio() should have returned -1\n"); - - for (i=0; i -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/14-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024 - -int num_received = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - num_received++; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_14_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - /* Queue up a bunch of aio writes */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb *)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - if (i == 2) - aiocbs[i]->aio_fildes = -1; - else - aiocbs[i]->aio_fildes = fd; - - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret != 0) { - printf(TNAME " Error lio_listio() %s\n", strerror(errno)); - - for (i=0; i -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/15-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024 - -int num_received = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - num_received++; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_15_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - /* Queue up a bunch of aio writes */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb *)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - - if (i > 3) - aiocbs[i]->aio_lio_opcode = LIO_READ; - else - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret != 0) { - printf(TNAME " Error lio_listio() returned %d (%s)\n", - errno, strerror(errno)); - - for (i=0; i -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/17-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/17-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/18-1.c deleted file mode 100644 index b99800067d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/18-1.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * lio_listio() shall fail if: - * [EINVAL] mode is not LIO_NOWAIT or LIO_WAIT, or nent is greater than - * {AIO_LISTIO_MAX} - * - * method: - * - * - open a file - * - submit a list of requests to lio_listio usign incorrect mode - * - check that the error and return codes are consistent - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/18-1.c" - -#define NUM_AIOCBS 1 -#define BUF_SIZE 1024 - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_18_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - aiocbs[0] = (struct aiocb *)malloc(sizeof(struct aiocb)); - memset(aiocbs[0], 0, sizeof(struct aiocb)); - - aiocbs[0]->aio_fildes = fd; - aiocbs[0]->aio_offset = 0; - aiocbs[0]->aio_buf = bufs; - aiocbs[0]->aio_nbytes = BUF_SIZE; - aiocbs[0]->aio_lio_opcode = LIO_WRITE; - - /* Submit request list */ - ret = lio_listio(-1, aiocbs, NUM_AIOCBS, NULL); - - if (ret != -1) { - printf(TNAME " Error lio_listio() should have returned -1: %d\n", - ret); - - free (aiocbs[0]); - free (bufs); - close (fd); - exit (PTS_FAIL); - } - - if (errno != EINVAL) { - printf(TNAME " Error lio_listio() should have set errno to EINVAL: %d (%s)\n", - errno, strerror(errno)); - - free (aiocbs[0]); - free (bufs); - close (fd); - exit (PTS_FAIL); - } - - free (aiocbs[0]); - free (bufs); - close (fd); - - printf (TNAME " PASSED\n"); - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/19-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/19-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/2-1.c deleted file mode 100644 index 7fd1a03406..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/2-1.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * If mode is LIO_NOWAIT, lio_listio() shall return immediately. - * - * method: - * - * - open a file for writing - * - submit a list of writes to lio_listio in LIO_NOWAIT mode - * - check that upon return some I/Os are still running - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/2-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - received_selected = info->si_value.sival_int; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_2_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - /* Queue up a bunch of aio writes */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb *)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/21-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/21-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/22-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/22-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/22-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/23-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/23-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/23-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/24-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/24-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/24-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/25-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/25-1.c deleted file mode 100644 index c079c7db6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/25-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include - -#include "posixtest.h" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/3-1.c deleted file mode 100644 index 8445364c2a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/3-1.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * If mode is LIO_NOWAIT, and sig is not NULL, asynchronous notification - * shall occurs when all I/O operations complete. - * - * method: - * - * - Open a file for writing - * - submit a list of writes to lio_listio in LIO_NOWAIT mode - * - Check that asynchronous notification occurs upon list completion - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/3-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024 - -int received_selected = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - received_selected = info->si_value.sival_int; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_3_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - /* Queue up a bunch of aio writes */ - for (i = 0; i < NUM_AIOCBS; i++) { - - aiocbs[i] = (struct aiocb *)malloc(sizeof(struct aiocb)); - memset(aiocbs[i], 0, sizeof(struct aiocb)); - - aiocbs[i]->aio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=0; i -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/4-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024 - -int num_received = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - num_received++; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_4_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - /* Put NULL elements in list */ - for (i=0; iaio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - for (i=1; i -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define NUM_AIOCBS 3 -#define BUF_SIZE 1024 - -#define TNAME "lio_listio/5-1.c" - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char buf[BUF_SIZE]; - int errors = 0; - int ret; - int err; - int i; - - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_4_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - /* Queue valid lio_opcode requests */ - for (i=0; iaio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = buf; - aiocbs[i]->aio_nbytes = BUF_SIZE; - - if (i == 0) - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - else if (i == 1) - aiocbs[i]->aio_lio_opcode = LIO_READ; - else - aiocbs[i]->aio_lio_opcode = LIO_NOP; - } - - /* Submit request list */ - ret = lio_listio(LIO_WAIT, aiocbs, NUM_AIOCBS, NULL); - - if (ret) { - printf(TNAME " lio_listio() does not accept valid opcodes\n"); - for (i=0; iaio_lio_opcode = -1; - - if (lio_listio(LIO_WAIT, aiocbs, 1, NULL) != -1) - { - printf(TNAME " lio_listio() accepts invalid opcode\n"); - - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/6-1.c" - -int main() -{ -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - -#ifndef LIO_READ - printf(TNAME " LIO_READ not defined\n"); - exit(PTS_FAIL); -#endif - -#ifndef LIO_WRITE - printf(TNAME " LIO_WRITE not defined\n"); - exit(PTS_FAIL); -#endif - -#ifndef LIO_WRITE - printf(TNAME " LIO_WRITE not defined\n"); - exit(PTS_FAIL); -#endif - - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/7-1.c deleted file mode 100644 index a512f06728..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/7-1.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * LIO_NOP causes the entry to be ignored. - * - * method: - * - * - open a file for writing - * - create an lio list with LIO_NOP elements - * - submit list to lio_listio - * - check that LIO_NOP elements are ignored - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/7-1.c" - -#define NUM_AIOCBS 10 -#define BUF_SIZE 1024 - -int num_received = 0; -int received_all = 0; - -void -sigrt1_handler(int signum, siginfo_t *info, void *context) -{ - num_received++; -} - -void -sigrt2_handler(int signum, siginfo_t *info, void *context) -{ - received_all = 1; -} - -int main() -{ - char tmpfname[256]; - int fd; - - struct aiocb *aiocbs[NUM_AIOCBS]; - char *bufs; - struct sigaction action; - struct sigevent event; - int errors = 0; - int ret; - int err; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_4_1_%d", - getpid()); - unlink(tmpfname); - - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); - - if (fd == -1) { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - bufs = (char *) malloc (NUM_AIOCBS*BUF_SIZE); - - if (bufs == NULL) { - printf (TNAME " Error at malloc(): %s\n", strerror (errno)); - close (fd); - exit(PTS_UNRESOLVED); - } - - /* Queue up a bunch of aio writes */ - for (i=0; iaio_fildes = fd; - aiocbs[i]->aio_offset = 0; - aiocbs[i]->aio_buf = &bufs[i*BUF_SIZE]; - aiocbs[i]->aio_nbytes = BUF_SIZE; - - if ((i == 1) || (i == 7)) - aiocbs[i]->aio_lio_opcode = LIO_NOP; - else - aiocbs[i]->aio_lio_opcode = LIO_WRITE; - - /* Use SIRTMIN+1 for individual completions */ - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL; - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN+1; - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i; - } - - /* Use SIGRTMIN+2 for list completion */ - event.sigev_notify = SIGEV_SIGNAL; - event.sigev_signo = SIGRTMIN+2; - event.sigev_value.sival_ptr = NULL; - - /* Setup handler for individual operation completion */ - action.sa_sigaction = sigrt1_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+1, &action, NULL); - - /* Setup handler for list completion */ - action.sa_sigaction = sigrt2_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = SA_SIGINFO|SA_RESTART; - sigaction(SIGRTMIN+2, &action, NULL); - - /* Submit request list */ - ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event); - - if (ret) { - printf(TNAME " Error at lio_listio() %d: %s\n", errno, strerror(errno)); - - for (i=1; i -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/8-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 512 - unsigned char buf[BUF_SIZE]; - unsigned char check[BUF_SIZE]; - int fd; - struct aiocb aiocb; - struct aiocb *list[1]; - int i; - int err; - int ret; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_8_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - for (i = 0; i < BUF_SIZE; i++) - buf[i] = i; - - if (write(fd, buf, BUF_SIZE) != BUF_SIZE) - { - printf(TNAME " Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - memset(check, 0xaa, BUF_SIZE); - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = check; - aiocb.aio_nbytes = BUF_SIZE; - aiocb.aio_lio_opcode = LIO_READ; - - list[0] = &aiocb; - - if (lio_listio(LIO_WAIT, list, 1, NULL) == -1) - { - printf(TNAME " Error at lio_listio(): %s\n", - strerror(errno)); - - close(fd); - exit(PTS_FAIL); - } - - /* Check return values */ - err = aio_error(&aiocb); - ret = aio_return(&aiocb); - - if (err != 0) { - printf(TNAME " Error at aio_error(): %s\n", strerror(errno)); - - close(fd); - exit(PTS_FAIL); - } - - if (ret != BUF_SIZE) { - printf(TNAME " Error at aio_return(): %d\n", ret); - - close(fd); - exit(PTS_FAIL); - } - - - /* check it */ - for (i = 0; i < BUF_SIZE; i++) - { - if (buf[i] != check[i]) - { - printf(TNAME " read values are corrupted\n"); - exit(PTS_FAIL); - } - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/9-1.c deleted file mode 100644 index 668e83c464..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/9-1.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2004, Bull SA. All rights reserved. - * Created by: Laurent.Vivier@bull.net - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * assertion: - * - * LIO_WRITE causes the entry to be submited as if by a call to - * aio_write(). - * - * method: - * - * - open a file - * - write data using lio_listio - * - read data - * - check data is read correctly - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "posixtest.h" - -#define TNAME "lio_listio/9-1.c" - -int main() -{ - char tmpfname[256]; -#define BUF_SIZE 512 - unsigned char buf[BUF_SIZE]; - unsigned char check[BUF_SIZE]; - int fd; - struct aiocb aiocb; - struct aiocb *list[1]; - int err; - int ret; - int i; - -#if _POSIX_ASYNCHRONOUS_IO != 200112L - exit(PTS_UNSUPPORTED); -#endif - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_9_1_%d", - getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - unlink(tmpfname); - - for (i = 0; i < BUF_SIZE; i++) - buf[i] = i; - - memset(&aiocb, 0, sizeof(struct aiocb)); - aiocb.aio_fildes = fd; - aiocb.aio_buf = buf; - aiocb.aio_nbytes = BUF_SIZE; - aiocb.aio_lio_opcode = LIO_WRITE; - - list[0] = &aiocb; - - if (lio_listio(LIO_WAIT, list, 1, NULL) == -1) - { - printf(TNAME " Error at lio_listio(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - /* Check return values */ - err = aio_error(&aiocb); - ret = aio_return(&aiocb); - - if (err != 0) { - printf(TNAME " Error at aio_error(): %s\n", strerror(errno)); - - close(fd); - exit(PTS_FAIL); - } - - if (ret != BUF_SIZE) { - printf(TNAME " Error at aio_return(): %d\n", ret); - - close(fd); - exit(PTS_FAIL); - } - - - memset(check, 0xaa, BUF_SIZE); - - if (read(fd, check, BUF_SIZE) != BUF_SIZE) - { - printf(TNAME " Error at read(): %s\n", - strerror(errno)); - - close(fd); - exit(PTS_UNRESOLVED); - } - - /* check it */ - - for (i = 0; i < BUF_SIZE; i++) - { - if (buf[i] != check[i]) - { - printf(TNAME " read values are corrupted\n"); - exit(PTS_FAIL); - } - } - - close(fd); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/assertions.xml deleted file mode 100644 index da03a15f50..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/assertions.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - If mode is LIO_WAIT, lio_listio() shall wait until all I/O is - complete and the sig argument shall be ignored. - - - If mode is LIO_NOWAIT, lio_listio() shall return immediately. - - - If mode is LIO_NOWAIT, and sig is not NULL, asynchronous notification - shall occurs when all I/O operations complete. - - - The list array may contain NULL elements which shall be ignored. - - - supported operation for aio_lio_opcode shall be one of LIO_READ, - LIO_WRITE or LIO_NOP. - - - LIO_READ, LIO_WRITE and LIO_NOP are defined in <aio.h>. - - - LIO_NOP causes the entry to be ignored. - - - LIO_READ causes the entry to be submited as if by a call to aio_read(). - - - LIO_WRITE causes the entry to be submited as if by a call to - aio_write(). - - - if mode is LIO_NOWAIT, lio_listio() shall return the value zero if - operation is successfuly queued. - - - if mode is LIO_NOWAIT, lio_listio() shall return the value -1 and set - errno to indicate error if the operation is not succesfully queued. - - - if mode is LIO_WAIT, lio_listio() shall return the value zero when - all I/O has completed successfully. - - - if mode is LIO_WAIT, lio_listio() shall return the value -1 and set - errno to indicate error if all operation has not successfully - completed. - - - Failure of an individual request does not prevend completion of any - other individual request. - - - The error statuses returned are identical to those returned as the - result of an aio_read() or aio_write(). - - - lio_listio() shall fail if: - [EAGAIN] The resource necessary to queue all the I/O request were not - available. - - - lio_listio() shall fail if: - [EAGAIN] the number of entries indicated by nent would cause the - system-wide limit {AIO_MAX} to be exceeded. - - - lio_listio() shall fail if: - [EINVAL] mode is not LIO_NOWAIT or LIO_WAIT, or nent is greater than - {AIO_LISTIO_MAX} - - - [EINTR] A signal was delivered while waiting for all I/O requests - to complete during an LIO_WAIT operation. - - - if lio_listio() fails with an error other than [EAGAIN], [EINTR] or - [EIO] no operations from the list shall be initiated. - - - The error status of the operation shall be: - [EAGAIN] The requested I/O was not queued due to resource limitations. - - - The error status of the operation shall be: - [ECANCELED] The requested I/O was canceled before the I/O completed - due to an explicit aio_cancel() request. - - - The error status of the operation shall be: - [EFBIG] aio_lio_opcode is LIO_WRITE, aio_nbytes is greater than 0, - and aio_offset is before the EOF and is greater or equal to the offset - maximum associated with aio_fildes. - - - The error status of the operation shall be: - [EINPROGRESS] The requested I/O is in progress - - - The error status of the operation shall be: - [EOVERFLOW] aio_lio_opcode is LIO_READ, aio_nbytes is greater than 0, - and aio_offset is before the EOF and is greater or equal to the offset - maximum associated with aio_fildes. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/coverage.txt deleted file mode 100644 index 3cac47dc6b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/lio_listio/coverage.txt +++ /dev/null @@ -1,28 +0,0 @@ -this file defines the coverage for the lio_listio() function testing. - -Assertion Covered? -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES -8 YES -9 YES -10 YES -11 YES -12 YES -13 YES -14 YES -15 YES -16 NO -17 NO -18 YES -19 NO -20 NO -21 NO -22 NO -23 NO -24 NO -25 NO diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/localtime/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/localtime/1-1.c deleted file mode 100644 index 5d46cea486..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/localtime/1-1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * - * This test shall return a pointer to the tm structure when converting - * a time value to a broken down local time. - */ - - -#include -#include -#include "posixtest.h" - -int main() { - time_t current_time; - struct tm *timeptr; - - current_time = time(NULL); - timeptr = NULL; - timeptr = localtime(¤t_time); - - if (timeptr != NULL) { - printf("date: %s", (asctime(localtime((¤t_time))))); - puts("Test PASSED"); - return PTS_PASS; - } else { - puts("Test FAILED: localtime failed"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/localtime/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/localtime/assertions.xml deleted file mode 100644 index bd1519b6dc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/localtime/assertions.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - locatime function shall return a pointer to the tm structure when converting - a time value to a broken down local time. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/localtime/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/localtime/coverage.txt deleted file mode 100644 index 2f08d2703b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/localtime/coverage.txt +++ /dev/null @@ -1,4 +0,0 @@ -This file defines the coverage for the localtime() function testing. - -Assertion Status -1 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mktime/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mktime/1-1.c deleted file mode 100644 index 3e7561cbad..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mktime/1-1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * - * This test case shall return PASS on converting the broken down July 4th 2001 - * into a time since the Epoch, which is the same encoding as of the value - * returned by time(), otherwise it fails with -1. - */ - - -#include -#include -#include "posixtest.h" - -struct tm tm_ptr; -time_t tps; - - -int main(void) -{ - /* Break down July 4th, 2001 */ - tm_ptr.tm_year = 2001 - 1900; - tm_ptr.tm_mon = 7 - 1; - tm_ptr.tm_mday = 4; - tm_ptr.tm_hour = 0; - tm_ptr.tm_min = 0; - tm_ptr.tm_sec = 1; - tm_ptr.tm_isdst = -1; - - tps = mktime(&tm_ptr); - - if (tps != -1){ - printf("%s", ctime(&tps)); - puts("TEST PASSED"); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mktime/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mktime/assertions.xml deleted file mode 100644 index c6f9c48140..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mktime/assertions.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - This test case shall return PASS on converting the broken down July 4th 2001 - into a time since the Epoch, which is the same encoding as of the value - returned by time(), otherwise it fails with -1. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mktime/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mktime/coverage.txt deleted file mode 100644 index abcce819bc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mktime/coverage.txt +++ /dev/null @@ -1,4 +0,0 @@ -This file defines the coverage for the mktime() function testing. - -Assertion Status -1 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/10-1.c deleted file mode 100644 index 364bfbba1d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/10-1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that mlock() set errno = EINVAL when addr is not a multiple of - * {PAGESIZE} if the implementation requires that addr be a multiple of - * {PAGESIZE}. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() { - int result; - long page_size; - void *ptr, *notpage_ptr; - - page_size = sysconf(_SC_PAGESIZE); - if(errno) { - perror("An error occurs when calling sysconf()"); - return PTS_UNRESOLVED; - } - - ptr = malloc(page_size); - if(ptr == NULL) { - printf("Can not allocate memory.\n"); - return PTS_UNRESOLVED; - } - - notpage_ptr = ((long)ptr % page_size) ? ptr : ptr+1; - - result = mlock(notpage_ptr, page_size - 1); - - if(result == 0){ - printf("mlock() does not require that addr be a multiple of {PAGESIZE}.\nTest PASSED\n"); - return PTS_PASS; - } else if(result == -1 && errno == EINVAL){ - printf("mlock() requires that addr be a multiple of {PAGESIZE}.\nTest PASSED\n"); - return PTS_PASS; - } else if(errno == EPERM) { - printf("You don't have permission to lock your address space.\nTry to rerun this test as root.\n"); - return PTS_UNRESOLVED; - } else if(result != -1){ - printf("mlock() returns a value of %i instead of 0 or 1.\n", - result); - perror("mlock"); - return PTS_FAIL; - } - perror("Unexpected error"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/2-1.sh deleted file mode 100755 index 8cbb7173cb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/2-1.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -# -# Test whether the implementation requires that addr be a multiple of -# {PAGESIZE}. -# -# This is tested implicitly via assertion 10. - -echo "Tested implicitly via assertion 10." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/4-1.sh deleted file mode 100755 index 6ceabda80c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/4-1.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -# -# Test that the appropriate privilege is required to lock process memory with -# mlock() -# -# This is tested implicitly via assertion 12. - -echo "Tested implicitly via assertion 12." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/5-1.c deleted file mode 100644 index c2d503927f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/5-1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that mlock return a value of zero upon successful completion. - * - */ -#include -#include -#include -#include -#include "posixtest.h" - -#define BUFSIZE 8 - -int main() { - int result; - void *ptr; - - ptr = malloc(BUFSIZE); - if(ptr == NULL) { - printf("Can not allocate memory.\n"); - return PTS_UNRESOLVED; - } - - result = mlock(ptr, BUFSIZE); - if(result == 0 && errno == 0){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno == 0) { - printf("mlock did not return a value of zero\n"); - return PTS_FAIL; - } else if(errno == EPERM) { - printf("You don't have permission to lock your address space.\nTry to rerun this test as root.\n"); - return PTS_UNRESOLVED; - } - - perror("Unexpected error"); - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/7-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/7-1.sh deleted file mode 100755 index 2f449ac147..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/7-1.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -# -# Test that the mlock() function return -1 upon unsuccessful completion. -# -# This is tested implicitly via assertions 8 to 12. - -echo "Tested implicitly via assertions 8 to 12." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/8-1.c deleted file mode 100644 index c6598b47c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/8-1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the mlock() function sets errno = ENOMEM if some or all of the - * address range specified by the addr and len arguments does not correspond to - * valid mapped pages in the address space of the process. - * - * Assume that the value LONG_MAX is an invalid pointer. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUFSIZE 8 - -int main() { - int result; - long page_size; - void *page_ptr; - - page_size = sysconf(_SC_PAGESIZE); - if(errno) { - perror("An error occurs when calling sysconf()"); - return PTS_UNRESOLVED; - } - - page_ptr = (void*)( LONG_MAX - (LONG_MAX % page_size) ); - result = mlock(page_ptr, BUFSIZE); - - if(result == -1 && errno == ENOMEM) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno == EPERM) { - printf("You don't have permission to lock your address space.\nTry to rerun this test as root.\n"); - return PTS_UNRESOLVED; - } else { - perror("Unexpected error"); - return PTS_UNRESOLVED; - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/assertions.xml deleted file mode 100644 index 46d544289e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/assertions.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - The mlock() function shall cause those whole pages containing any part of - the address space of the process starting at address addr and continuing for - len bytes to be memory-resident until unlocked or until the process exits or - execs another process image - - - The implementation may require that addr be a multiple of {PAGESIZE} - - - Upon successful return from mlock(), pages in the specified range shall be - locked and memory-resident - - - The appropriate privilege is required to lock process memory with mlock() - - - Upon successful completion, the mlock() function shall return a value of - zero - - - Upon unsuccessful completion, no change is made to any locks in the address - space of the process - - - Upon unsuccessful completion, the function shall return a value of -1 - - - The mlock() function shall set errno = ENOMEM if some or all of the address - range specified by the addr and len arguments does not correspond to valid - mapped pages in the address space of the process - - - The mlock() function shall set errno = EAGAIN if some or all of the memory - identified by the operation could not be locked when the call was made - - - The mlock() function may set errno = EINVAL if the addr argument is not a - multiple of {PAGESIZE} - - - The mlock() function may set errno = ENOMEM if locking the pages mapped by - the specified range would exceed an implementation-defined limit on the - amount of memory that the process may lock - - - The mlock() function may set errno = EPERM if the calling process does not - have the appropriate privilege to perform the requested operation - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/coverage.txt deleted file mode 100644 index 5b09f619aa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/coverage.txt +++ /dev/null @@ -1,18 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 NO -2 YES May assertion -3 NO -4 YES -5 YES -6 NO -7 YES -8 YES -9 NO -10 YES May assertion -11 NO May assertion -12 YES May assertion diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/speculative/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/speculative/12-1.c deleted file mode 100644 index f92f4de09a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlock/speculative/12-1.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the mlock() function sets errno = EPERM if the calling process - * does not have the appropriate privilege to perform the requested operation. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUFSIZE 8 - -/** Set the euid of this process to a non-root uid */ -int set_nonroot() -{ - struct passwd *pw; - setpwent(); - /* search for the first user which is non root */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root")) - break; - endpwent(); - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return 1; - } - - if(seteuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\n"); - return 1; - } - perror("An error occurs when calling seteuid()"); - return 1; - } - - printf("Testing with user '%s' (uid: %d)\n", - pw->pw_name, (int)geteuid()); - return 0; -} - -int main() { - int result; - void *ptr; - - /* This test should be run under standard user permissions */ - if (getuid() == 0) { - if (set_nonroot() != 0) { - printf("Cannot run this test as non-root user\n"); - return PTS_UNTESTED; - } - } - - ptr = malloc(BUFSIZE); - if(ptr == NULL) { - printf("Can not allocate memory.\n"); - return PTS_UNRESOLVED; - } - - result = mlock(ptr, BUFSIZE); - - if(result == -1 && errno == EPERM) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result == 0) { - printf("You have the right to call mlock\n"); - return PTS_FAIL; - } else { - perror("Unexpected error"); - return PTS_UNRESOLVED; - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/13-1.c deleted file mode 100644 index b62d95a14b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/13-1.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the mlockall() function set errno = EINVAL if the flags argument - * is zero. - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() { - int result; - - result = mlockall(0); - - if(result == -1 && errno == EINVAL) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != -1) { - printf("mlockall() return %i instead of -1.\n", result); - return PTS_FAIL; - } else { - perror("Unexpected error"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/13-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/13-2.c deleted file mode 100644 index ccc7790330..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/13-2.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the mlockall() function set errno = EINVAL if the flags argument - * includes unimplemented flags. - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() { - int result; - - result = mlockall(~(MCL_CURRENT|MCL_FUTURE)); - - if(result == -1 && errno == EINVAL) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != -1) { - printf("mlockall() return %i instead of -1.\n", result); - return PTS_FAIL; - } else { - perror("Unexpected error"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/2-1.sh deleted file mode 100755 index 6611df1542..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/2-1.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh -# -# Test that the mlockall() checks that the flags argument is constructed from -# the bitwise-inclusive OR of one or more of the folowing symbolic constants, -# defined in sys/mman.h: -# MCL_CURRENT -# MCL_FUTURE -# -# This is tested implicitly via assertion 13. - -echo "Tested implicitly via assertion 13." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/3-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/3-6.c deleted file mode 100644 index c57bd3beb7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/3-6.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that mlockall lock the shared memory pages currently mapped into the - * address space of the process when MCL_CURRENT is set. - * - * This test use msync to check that the page is locked. - */ - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "/posixtest_3-6" - -int main() { - void *page_ptr; - size_t page_size; - int result, fd; - void *foo; - - page_size = sysconf(_SC_PAGESIZE); - if(errno) { - perror("An error occurs when calling sysconf()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - foo = mmap(NULL, BUF_SIZE, PROT_WRITE, MAP_SHARED, fd, 0); - if( foo == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(mlockall(MCL_CURRENT) == -1) { - if(errno == EPERM){ - printf("You don't have permission to lock your address space.\nTry to rerun this test as root.\n"); - } else { - perror("An error occurs when calling mlockall()"); - } - return PTS_UNRESOLVED; - } - - page_ptr = (void*) ( (long)foo - ((long)foo % page_size) ); - - result = msync(page_ptr, page_size, MS_SYNC|MS_INVALIDATE); - if(result == -1 && errno == EBUSY) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result == 0) { - printf("The shared memory pages of the process are not locked.\n"); - return PTS_FAIL; - } - perror("Unexpected error"); - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/3-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/3-7.c deleted file mode 100644 index 3a2ac1127e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/3-7.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that mlockall lock the mapped files pages currently mapped into the - * address space of the process when MCL_CURRENT is set. - * - * This test use msync to check that the page is locked. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" - - -int main() { - void *page_ptr; - size_t page_size; - int result, fd; - void *foo; - - page_size = sysconf(_SC_PAGESIZE); - if(errno) { - perror("An error occurs when calling sysconf()"); - return PTS_UNRESOLVED; - } - - fd = open("conformance/interfaces/mlockall/3-7.c", O_RDONLY); - if(fd == -1) { - perror("An error occurs when calling open()"); - return PTS_UNRESOLVED; - } - - foo = mmap(NULL, page_size, PROT_READ, MAP_SHARED, fd, 0); - if(foo == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - return PTS_UNRESOLVED; - } - - if(mlockall(MCL_CURRENT) == -1) { - if(errno == EPERM){ - printf("You don't have permission to lock your address space.\nTry to rerun this test as root.\n"); - } else { - perror("An error occurs when calling mlockall()"); - } - return PTS_UNRESOLVED; - } - - page_ptr = (void*) ( (long)foo - ((long)foo % page_size) ); - - result = msync(page_ptr, page_size, MS_SYNC|MS_INVALIDATE); - if(result == -1 && errno == EBUSY) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result == 0) { - printf("The mapped files pages of the process are not locked.\n"); - return PTS_FAIL; - } - perror("Unexpected error"); - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/7-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/7-1.sh deleted file mode 100755 index df1948566c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/7-1.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -# -# Test that the appropriate privilege is required to lock process memory with -# mlockall() -# -# This is tested implicitly via assertion 15. - -echo "Tested implicitly via assertion 15." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/8-1.c deleted file mode 100644 index bb93601a4e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/8-1.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that mlockall return a value of zero upon successful completion. - * - */ -#include -#include -#include -#include "posixtest.h" - -int main() { - int result; - - result = mlockall(MCL_CURRENT); - if(result == 0 && errno == 0){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno == 0) { - printf("mlockall did not return a value of zero\n"); - return PTS_FAIL; - } else if(errno == EPERM) { - printf("You don't have permission to lock your address space.\nTry to rerun this test as root.\n"); - return PTS_UNRESOLVED; - } - - perror("Unexpected error"); - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/9-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/9-1.sh deleted file mode 100755 index 1df8fb1022..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/9-1.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -# -# Test that the mlockall() function return -1 upon unsuccessful completion. -# -# This is tested implicitly via assertions 12 to 15. - -echo "Tested implicitly via assertions 12 to 15." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/assertions.xml deleted file mode 100644 index 21849c41ea..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/assertions.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - The mlockall() function shall cause all of the pages mapped by the address - space of a process to be memory-resident until unlocked or until the process - exits or execs another process image - - - The flags argument is constructed from the bitwise-inclusive OR of one or - more of the folowing symbolic constants, defined in sys/mman.h: - MCL_CURRENT - MCL_FUTURE - - - When the MCL_CURRENT flag is set, mlockall lock all of the pages currently - mapped into the address space of the process - - - When the MCL_FUTURE flag is set, mlockall lock all of the pages that become - mapped into the address space of the process in the future, when those - mappings are established - - - If MCL_FUTURE is specified, and the automatic locking of future mappings - eventually causes the amount of locked memory to exceed the amount of - available physical memory or any other implementation-defined limit, the - behavior is implementation-defined. The manner in which the implementation - informs the application of these situations is also implementation-defined - - - Upon successful return from the mlockall() function that specifies - MCL_CURRENT, all currently mapped pages of the process' address space shall - be memory-resident and locked - - - The appropriate privilege is required to lock process memory with mlockall() - - - Upon successful completion, the mlockall() function shall return a value of - zero - - - Upon unsuccessful completion, the mlockall() function shall return a value - of -1 - - - Upon unsuccessful completion, no additional memory shall be locked - - - The effect of failure of mlockall() on previously existing locks in the - address space is unspecified - - - The mlockall() function shall set errno = EAGAIN if some or all of the - memory identified by the operation could not be locked when the call was - made - - - The mlockall() function shall set errno = EINVAL if the flags argument is - zero, or includes unimplemented flags - - - The mlockall() function may set errno = ENOMEM if locking all of the pages - currently mapped into the address space of the process would exceed an - implementation-defined limit on the amount of memory that the process may - lock - - - The mlockall() function may set errno = EPERM if the calling process does - not have the appropriate privilege to perform the requested operation - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/coverage.txt deleted file mode 100644 index 11a933abb7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/coverage.txt +++ /dev/null @@ -1,21 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 NO -2 YES -3 NO Only page mapped by mmap() are tested -4 NO -5 NO Implementation-defined -6 NO -7 YES -8 YES -9 YES -10 NO -11 NO Unspecified -12 NO -13 YES -14 YES May assertion -15 YES May assertion diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/speculative/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/speculative/15-1.c deleted file mode 100644 index a3d984be89..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mlockall/speculative/15-1.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the mlockall() function set errno = EPERM if the calling process - * does not have the appropriate privilege to perform the requested operation - * - * It is a may assertion. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -/** Set the euid of this process to a non-root uid */ -int set_nonroot() -{ - struct passwd *pw; - setpwent(); - /* search for the first user which is non root */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root")) - break; - endpwent(); - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return 1; - } - - if(seteuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\n"); - return 1; - } - perror("An error occurs when calling seteuid()"); - return 1; - } - - printf("Testing with user '%s' (uid: %d)\n", - pw->pw_name, (int)geteuid()); - return 0; -} - -int main() { - int result; - - /* This test should be run under standard user permissions */ - if (getuid() == 0) { - if (set_nonroot() != 0) { - printf("Cannot run this test as non-root user\n"); - return PTS_UNTESTED; - } - } - - result = mlockall(MCL_CURRENT); - - if(result == -1 && errno == EPERM) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result == 0) { - printf("You have the right to call mlockall\n"); - return PTS_UNRESOLVED; - } else { - perror("Unexpected error"); - return PTS_UNRESOLVED; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/1-1.c deleted file mode 100644 index 623f1ffdf2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/1-1.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * The mmap( ) function shall establish a mapping between a process's - * address space and a file, - * - * Test Step: - * 1. Create a tmp file; - * 2. mmap it to memory using mmap(); - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/1-1.c" - -int main() -{ - char tmpfname[256]; - char* data; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t len = total_size; - int prot = PROT_READ | PROT_WRITE; - int flag = MAP_SHARED; - int fd; - off_t off = 0; - - char * ch; - - data = (char *) malloc(total_size); - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_1_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - /* Make sure the file is removed when it is closed */ - unlink(tmpfname); - memset(data, 'a', total_size); - if (write(fd, data, total_size) != total_size) - { - printf(TNAME "Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - free(data); - - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa; - - if(*ch != 'a') - { - printf ("Test Fail: " TNAME - " The file did not mapped to memory\n"); - exit(PTS_FAIL); - } - - close(fd); - munmap(pa, len); - printf ("Test Pass\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/1-2.c deleted file mode 100644 index a18d14c192..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/1-2.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * The mmap( ) function shall establish a mapping - * between a process's address space - * and a shared memory object. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/1-2.c" - -int main() -{ - char tmpfname[256]; - int shm_fd; - - void *pa = NULL; - void *addr = NULL; - size_t size = 1024 * 4 * 1024; - int prot = PROT_READ | PROT_WRITE; - int flag = MAP_SHARED; - int fd; - off_t off = 0; - - snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_1_2_%ld", - (long)getpid()); - - /* Create shared object */ - shm_unlink(tmpfname); - shm_fd = shm_open(tmpfname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - printf(TNAME " Error at shm_open(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - shm_unlink(tmpfname); - if(ftruncate(shm_fd, size) == -1) { - printf(TNAME " Error at ftruncate(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - fd = shm_fd; - pa = mmap (addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - munmap(pa, size); - printf ("Test Pass\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/10-1.c deleted file mode 100644 index c251670a76..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/10-1.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * When the implementation selects a - * value for pa, it never places a mapping at address 0. - * - * Test step: - * This is not a good test. Cannot make sure (pa == 0) never happens. - * Repeat LOOP_NUM times mmap() and mnumap(), - * make sure pa will not equal 0. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/10-1.c" - -#define LOOP_NUM 100000 - -int main() -{ - int rc; - unsigned long cnt; - - char tmpfname[256]; - long total_size; - - void *pa = NULL; - void *addr = NULL; - size_t size; - int flag; - int fd; - off_t off = 0; - int prot; - - total_size = 1024; - size = total_size; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_10_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - for (cnt = 0; cnt < LOOP_NUM; cnt++) - { - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - if (pa == 0) - { - printf("Test Fail " TNAME " mmap() map the file to 0 address " - "without setting MAP_FIXED\n"); - exit(PTS_FAIL); - } - rc = munmap (pa, size); - if (rc != 0) - { - printf(TNAME "Error at mnumap(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - } - - close (fd); - printf ("Test PASS\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-1.c deleted file mode 100644 index cffc9d7ce3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-1.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The off argument is constrained to be aligned and sized - * according to the value returned by - * sysconf( ) when passed _SC_PAGESIZE or _SC_PAGE_SIZE. - * - * The mmap( ) function shall fail if: - * [EINVAL] The addr argument (if MAP_FIXED was specified) or off is not a multiple of - * the page size as returned by sysconf( ), or is considered invalid by the - * implementation. - * - * Test step: - * 1. Set 'off' a value which is not a multiple of page size; - * 2. Call mmap() and get EINVAL; - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/11-1.c" - -int main() -{ - char tmpfname[256]; - long page_size; - long total_size; - - void *pa = NULL; - void *addr = NULL; - size_t size; - int flag; - int fd; - off_t off = 0; - int prot; - - page_size = sysconf(_SC_PAGE_SIZE); - total_size = 3 * page_size; - size = page_size; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_11_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - prot = PROT_READ | PROT_WRITE; - flag = MAP_SHARED; - - /* This offset is considered illegal, not a multiple of page_size, - * unless the page_size is 1 byte, which is considered impossible. - */ - - off = page_size + 1; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == EINVAL) - { - printf("Test Pass: " TNAME " Get " - "EINVAL when 'off' is not a multiple of page size\n"); - exit(PTS_PASS); - } - - printf ("Test FAIL, Did not get EINVAL" - " when 'off' is not a multiple of page size, get: %s\n", strerror(errno)); - close (fd); - munmap (pa, size); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-2.c deleted file mode 100644 index ed945748e5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-2.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * MPR References within the address range starting at pa and - * continuing for len bytes to whole pages following the end - * of an object shall result in delivery of a SIGBUS signal. - * - * Test step: - * 1. Map a file with size = 1/2 page_size, while len = 2 * page_size - * 2. If Memory Protection option is supported, read the second page - * beyond the object (mapped file) size (NOT the patial page), - * should get SIGBUS; - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/11-2.c" - -void sigbus_handler (int signum) -{ - printf("Test Pass: " TNAME " Trigger SIGBUS\n"); - exit(PTS_PASS); -} - -int main() -{ -#ifndef _POSIX_MEMORY_PROTECTION - printf("_POSIX_MEMORY_PROTECTION is not defined\n"); - return PTS_UNTESTED; -#endif - char tmpfname[256]; - long page_size; - long total_size; - - void *pa = NULL; - void *addr = NULL; - size_t len; - int flag; - int fd; - off_t off = 0; - int prot; - - char *ch = NULL; - struct sigaction sa; - - page_size = sysconf(_SC_PAGE_SIZE); - - /* Size of the file to be mapped */ - total_size = page_size / 2; - - /* mmap 2 pages */ - len = page_size * 2; - - sigfillset(&sa.sa_mask); - sa.sa_handler = sigbus_handler; - sigaction(SIGBUS, &sa, NULL); - - /* Create tmp file */ - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_11_2_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - prot = PROT_READ | PROT_WRITE; - flag = MAP_SHARED; - off = 0; - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test FAIL: " TNAME " Error at mmap(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - /* Read the second page */ - ch = pa + page_size + 1; - - /* This reference should trigger SIGBUS */ - *ch = 0; - - /* wait for a while */ - sleep(1); - - printf("Test Fail: " TNAME " Did not trigger SIGBUS, " - "while Memory Protection is enabled\n"); - exit(PTS_FAIL); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-3.c deleted file mode 100644 index b0a1c9b986..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-3.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * MPR References within the address range starting at pa and - * continuing for len bytes to whole pages following the end - * of an object shall result in delivery of a SIGBUS signal. - * - * Test step: - * 1. Map a shared memory object of size 1/2 * page_size, - * with len = 2 * page_size - * 2. If Memory Protection option is supported, read the second page - * beyond the end of the object, should get SIGBUS. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/11-3.c" - - -void sigbus_handler (int signum) -{ - printf("Test Pass: " TNAME " Trigger SIGBUS\n"); - exit(PTS_PASS); -} - -int main() -{ -#ifndef _POSIX_MEMORY_PROTECTION - printf("_POSIX_MEMORY_PROTECTION is not defined\n"); - return PTS_UNTESTED; -#endif - char tmpfname[256]; - long page_size; - long total_size; - - void *pa = NULL; - void *addr = NULL; - size_t len; - int flag; - int fd; - off_t off = 0; - int prot; - - char *ch = NULL; - - struct sigaction sa; - - page_size = sysconf(_SC_PAGE_SIZE); - - /* Size of the shared memory object to be mapped */ - total_size = page_size / 2; - - /* mmap will create a partial page */ - len = page_size * 2; - - sigfillset(&sa.sa_mask); - sa.sa_handler = sigbus_handler; - sigaction(SIGBUS, &sa, NULL); - - snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_11_3_%ld", - (long)getpid()); - /* Create shared object */ - shm_unlink(tmpfname); - fd = shm_open(tmpfname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(fd == -1) - { - printf(TNAME " Error at shm_open(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - shm_unlink(tmpfname); - if(ftruncate(fd, total_size) == -1) { - printf(TNAME " Error at ftruncate(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - prot = PROT_READ | PROT_WRITE; - flag = MAP_SHARED; - off = 0; - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test FAIL: " TNAME " Error at mmap(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa + page_size + 1 ; - - /* This reference should trigger SIGBUS */ - *ch = 0; - - /* wait for a while */ - sleep(1); - - printf("Test Fail: " TNAME " Did not trigger SIGBUS, " - "while Memory Protection is enabled\n"); - exit(PTS_FAIL); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-4.c deleted file mode 100644 index 3b4492669f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-4.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Implementation performs mapping operations over whole pages. - * Thus, while the argument len - * need not meet a size or alignment constraint, - * the implementation shall include, in any mapping - * operation, any partial page specified by the range [pa,pa+len). - * The system shall always zero-fill any partial page at the end of an object. - * Further, the system shall never write out any modified portions of - * the last page of an object which are beyond its end. - * - * Test step: - * 1. Create a process, in this process: - a. map a file with size of 1/2 * page_size, - * set len = 1/2 * page_size - * b. Read the partial page beyond the object size. - * Make sure the partial page is zero-filled; - * c. Modify a byte in the partial page, then un-map the and close the - * file descriptor. - * 2. Wait for the child proces to exit, then - * Map the file again, - * read the byte from the position modified at step 1-c and check. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/11-4.c" - -int main() -{ - char tmpfname[256]; - long page_size; - long total_size; - - void *pa = NULL, *pa_2 = NULL; - void *addr = NULL; - size_t len; - int flag; - int fd, fd_2; - off_t off = 0; - int prot; - - pid_t child; - char *ch = NULL, *ch_2 = NULL; - int exit_val; - - page_size = sysconf(_SC_PAGE_SIZE); - - /* Size of the file to be mapped */ - total_size = page_size / 2; - - /* mmap will create a partial page */ - len = page_size / 2; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_11_5_%ld", - (long)getpid()); - child = fork(); - if (child == 0) - { - /* Create shared object */ - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - if(ftruncate(fd, total_size) == -1) { - printf(TNAME " Error at ftruncate(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - prot = PROT_READ | PROT_WRITE; - flag = MAP_SHARED; - off = 0; - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test FAIL: " TNAME " Error at mmap(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - printf("pa: %p\n", pa); - /* Check the patial page is ZERO filled */ - ch = pa + len + 1; - if (*ch != 0) - { - printf("Test Fail: " TNAME " The partial page at the end of an object " - "is not zero-filled\n"); - return PTS_FAIL; - } - - /* Write the partial page */ - *ch = 'b'; - munmap (pa, len); - close (fd); - return PTS_PASS; - } - wait(&exit_val); - if (!(WIFEXITED(exit_val) && - (WEXITSTATUS(exit_val) == PTS_PASS))) - { - unlink(tmpfname); - return PTS_FAIL; - } - - fd_2 = open(tmpfname, O_RDWR, 0); - unlink(tmpfname); - - prot = PROT_READ | PROT_WRITE; - flag = MAP_SHARED; - off = 0; - pa = mmap(addr, len, prot, flag, fd_2, off); - pa_2 = mmap(addr, len, prot, flag, fd_2, off); - if (pa_2 == MAP_FAILED) - { - printf("Test FAIL: " TNAME " Error at 2nd mmap(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - printf("pa_2: %p\n", pa_2); - ch_2 = pa_2 + len + 1; - if (*ch_2 == 'b') - { - printf("Test Fail: " TNAME " Modification of the partial page " - "at the end of an object is written out\n"); - exit(PTS_FAIL); - } - close (fd_2); - munmap (pa_2, len); - printf("Test Passed\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-5.c deleted file mode 100644 index a8f04659ad..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/11-5.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Implementation performs mapping operations over whole pages. - * Thus, while the argument len - * need not meet a size or alignment constraint, - * the implementation shall include, in any mapping - * operation, any partial page specified by the range [pa,pa+len). - * The system shall always zero-fill any partial page at the end of an object. - * Further, the system shall never write out any modified portions of - * the last page of an object which are beyond its end. - * - * Test step: - * 1. Create a process, in this process: - a. map a shared memory object with size of 1/2 * page_size, - * set len = 1/2 * page_size - * b. Read the partial page beyond the object size. - * Make sure the partial page is zero-filled; - * c. Modify a byte in the partial page, then un-map the and close the - * file descriptor. - * 2. Wait for the child proces to exit, then - * Map the shared memory object again, - * read the byte from the position modified at step 1-c and check. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/11-5.c" - -int main() -{ - char tmpfname[256]; - long page_size; - long total_size; - - void *pa = NULL, *pa_2 = NULL; - void *addr = NULL; - size_t len; - int flag; - int fd, fd_2; - off_t off = 0; - int prot; - - pid_t child; - char *ch = NULL, *ch_2 = NULL; - int exit_val; - - page_size = sysconf(_SC_PAGE_SIZE); - - /* Size of the file to be mapped */ - total_size = page_size / 2; - - /* mmap will create a partial page */ - len = page_size / 2; - - snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_11_5_%ld", - (long)getpid()); - child = fork(); - if (child == 0) - { - /* Create shared object */ - shm_unlink(tmpfname); - fd = shm_open(tmpfname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(fd == -1) - { - printf(TNAME " Error at shm_open(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - if(ftruncate(fd, total_size) == -1) { - printf(TNAME " Error at ftruncate(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - prot = PROT_READ | PROT_WRITE; - flag = MAP_SHARED; - off = 0; - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test FAIL: " TNAME " Error at mmap(): %s\n", - strerror(errno)); - return PTS_FAIL; - } - /* Check the patial page is ZERO filled */ - ch = pa + len + 1; - if (*ch != 0) - { - printf("Test Fail: " TNAME " The partial page at the end of an object " - "is not zero-filled\n"); - return PTS_FAIL; - } - - /* Write the partial page */ - *ch = 'b'; - munmap (pa, len); - close (fd); - return PTS_PASS; - } - wait(&exit_val); - if (!(WIFEXITED(exit_val) && - (WEXITSTATUS(exit_val) == PTS_PASS))) - { - shm_unlink(tmpfname); - return PTS_FAIL; - } - - fd_2 = shm_open(tmpfname, O_RDWR, 0); - shm_unlink(tmpfname); - - prot = PROT_READ | PROT_WRITE; - flag = MAP_SHARED; - off = 0; - pa_2 = mmap(addr, len, prot, flag, fd_2, off); - if (pa_2 == MAP_FAILED) - { - printf("Test FAIL: " TNAME " Error at 2nd mmap(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch_2 = pa_2 + len + 1; - if (*ch_2 == 'b') - { - printf("Test Fail: " TNAME " Modification of the partial page " - "at the end of an object is written out\n"); - exit(PTS_FAIL); - } - close (fd_2); - munmap (pa_2, len); - printf("Test Passed\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/12-1.c deleted file mode 100644 index 3880b6b053..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/12-1.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The mmap( ) function shall add an extra reference to the file - * associated with the file descriptor fildes which is not removed - * by a subsequent close( ) on that file descriptor. - * This reference shall be removed when there are no more - * mappings to the file. - * - * Test Steps: - * 1. Create a file, while it is open call unlink(). - * 2. mmap the file to memory, then call close(). If mmap() add - * extra reference to the file, the file descriptor will not be removed. - * 3. Try to open the file, open should success; - * 3. munmap the mapped memory; - * 4. Try open the file again, should get ENOENT; - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/12-1.c" - -int main() -{ - char tmpfname[256]; - long total_size; - - void *pa = NULL; - void *addr = NULL; - size_t size; - int flag; - int fd, fd2; - off_t off = 0; - int prot; - - total_size = 1024; - size = total_size; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_12_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - /* If there is no reference to the file, - * this file will be removed - */ - unlink(tmpfname); - - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - close(fd); - - /* File still exists */ - - fd2 = open(tmpfname, O_RDWR, S_IRUSR | S_IWUSR); - if (fd == -1 && errno == ENOENT) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - printf ("Test Fail: " TNAME " The file is removed. mmap does not " - "add extra reference to the file associated with fd\n"); - exit(PTS_FAIL); - } - - munmap (pa, size); - - /* The file should have been removed */ - fd2 = open(tmpfname, O_RDWR, S_IRUSR | S_IWUSR); - if (fd2 == -1 && errno == ENOENT) - { - printf ("Test PASS: " TNAME " The file is removed. munmap removed " - "reference to the file associated with fd\n"); - exit(PTS_PASS); - } - - if (fd2 != -1) - { - printf ("Test FAIL: " TNAME - " The file is not removed. munmap does not remove " - "reference to the file associated with fd\n"); - return PTS_FAIL; - } - - printf("PTS_UNRESLOVED " TNAME " Error at open(): %s\n", - strerror(errno)); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/13-1.c deleted file mode 100644 index 6393d01514..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/13-1.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The st_atime field of the mapped file may be marked for update - * at any time between the mmap() call and the corresponding munmap() - * call. The initial read or write reference to a mapped region - * shall cause the file¡¯s st_atime field to be marked for update if - * it has not already been marked for update. - * - * Test Steps: - * 1. Do stat before mmap() and after munmap(), - * also after writing the mapped region. - * 2. Compare whether st_atime has been updated. - */ - - /* adam.li@intel.com: On linux, it looks mmap() will update - * st_atime, write to the mapped region will not cause the update - * */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/13-1.c" - -int main() -{ - char tmpfname[256]; - char* data; - long total_size; - - void *pa = NULL; - void *addr = NULL; - size_t size; - int flag; - int fd; - off_t off = 0; - int prot; - - total_size = 1024; - size = total_size; - - struct stat stat_buff, stat_buff2; - time_t atime1, atime2, atime3; - - char *ch; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_13_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - data = (char *) malloc(total_size); - memset(data, 'a', total_size); - printf("Time before write(): %ld\n", time(NULL)); - if (write(fd, data, total_size) != total_size) - { - printf(TNAME "Error at write(): %s\n", - strerror(errno)); - unlink(tmpfname); - exit(PTS_UNRESOLVED); - } - free(data); - - if (stat(tmpfname, &stat_buff) == -1) - { - printf(TNAME " Error at 1st stat(): %s\n", - strerror(errno)); - unlink(tmpfname); - exit(PTS_UNRESOLVED); - } - /* atime1: write */ - atime1 = stat_buff.st_atime; - - sleep(1); - - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - printf("Time before mmap(): %ld\n", time(NULL)); - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - unlink(tmpfname); - exit(PTS_FAIL); - } - - if (stat(tmpfname, &stat_buff2) == -1) - { - printf(TNAME " Error at 2nd stat(): %s\n", - strerror(errno)); - unlink(tmpfname); - exit(PTS_UNRESOLVED); - } - /* for mmap */ - atime2 = stat_buff2.st_atime; - - /* Wait a while in case the precision of the sa_time - * is not acurate enough to reflect the change - */ - sleep(1); - - /* write reference to mapped memory */ - ch = pa; - *ch = 'b'; - - printf("Time before munmap(): %ld\n", time(NULL)); - munmap(pa, size); - - /* FIXME: Update the in-core meta data to the disk */ - fsync(fd); - close(fd); - if (stat(tmpfname, &stat_buff) == -1) - { - printf(TNAME " Error at 3rd stat(): %s\n", - strerror(errno)); - unlink(tmpfname); - exit(PTS_UNRESOLVED); - } - /* atime3: write to memory */ - atime3 = stat_buff.st_atime; - - printf("atime1: %d, atime2: %d, atime3: %d\n", - (int)atime1, (int)atime2, (int)atime3); - if (atime1 != atime3 || - atime1 != atime2 ) - { - printf ("Test Pass\n"); - unlink(tmpfname); - exit(PTS_PASS); - } - - printf("Test Fail " TNAME " st_atime did not update properly\n"); - unlink(tmpfname); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/14-1.c deleted file mode 100644 index e790a79a6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/14-1.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The st_ctime and st_mtime fields of a file that is mapped with - * MAP_SHARED and PROT_WRITE shall be marked for update at some point - * in the interval between a write reference to the - * mapped region and the next call to msync( ) with MS_ASYNC or MS_SYNC - * for that portion of the file by any process. - * If there is no such call and if the underlying file is modified - * as a result of a write reference, then these fields shall be marked - * for update at some time after the write reference. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/14-1.c" - -int main() -{ - char tmpfname[256]; - char* data; - long total_size; - - void *pa = NULL; - void *addr = NULL; - size_t size; - int flag; - int fd; - off_t off = 0; - int prot; - struct stat stat_buff; - - total_size = 1024; - size = total_size; - - time_t mtime1, mtime2, ctime1, ctime2; - - char *ch; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_14_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - data = (char *) malloc(total_size); - memset(data, 'a', total_size); - printf("Time before write(): %ld\n", time(NULL)); - if (write(fd, data, total_size) != total_size) - { - printf(TNAME "Error at write(): %s\n", - strerror(errno)); - unlink(tmpfname); - exit(PTS_UNRESOLVED); - } - free(data); - sleep(1); - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - printf("Time before mmap(): %ld\n", time(NULL)); - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - unlink(tmpfname); - exit(PTS_FAIL); - } - sleep(1); - printf("Time before write reference: %ld\n", time(NULL)); - /* Before write reference */ - if (stat(tmpfname, &stat_buff) == -1) - { - printf(TNAME " Error at 1st stat(): %s\n", - strerror(errno)); - unlink(tmpfname); - exit(PTS_UNRESOLVED); - } - - ctime1 = stat_buff.st_ctime; - mtime1 = stat_buff.st_mtime; - - ch = pa; - *ch = 'b'; - - /* Wait a while in case the precision of the sa_time - * is not acurate enough to reflect the update - */ - sleep(1); - printf("Time before msync(): %ld\n", time(NULL)); - msync(pa, size, MS_SYNC); - - /* FIXME: Update the in-core meta data to the disk */ - fsync(fd); - - if (stat(tmpfname, &stat_buff) == -1) - { - printf(TNAME " Error at stat(): %s\n", - strerror(errno)); - unlink(tmpfname); - exit(PTS_UNRESOLVED); - } - - ctime2 = stat_buff.st_ctime; - mtime2 = stat_buff.st_mtime; - - printf("ctime1: %ld, ctime2: %ld\nmtime1: %ld, mtime2: %ld\n", - ctime1, ctime2, mtime1, mtime2); - if (ctime2 == ctime1 || mtime2 == mtime1) - { - printf("Test Fail " TNAME - " st_ctime and st_mtime were not updated properly\n"); - unlink(tmpfname); - exit(PTS_FAIL); - } - - munmap(pa, size); - close(fd); - printf("Test Pass\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/16-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/16-1.sh deleted file mode 100755 index 3bf999ffa9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/16-1.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Upon successful completion, the mmap( ) function shall return -# the address at which the mapping was placed (pa); -# otherwise, it shall return a value of MAP_FAILED and set errno to indicate the -# error. The symbol MAP_FAILED is defined in the header. No successful return -# from mmap( ) shall return the value MAP_FAILED. - - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/17-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/17-1.sh deleted file mode 100755 index 11a4c9a8f7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/17-1.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# The mmap( ) function shall fail if: -# [EACCES] The fildes argument is not open for read, -# regardless of the protection specified, -# or fildes is not open for write and PROT_WRITE was specified for a -# MAP_SHARED type mapping. - - -# This is tested implicitly via assertion 6. - -echo "Tested implicitly via assertion 6. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/18-1.c deleted file mode 100644 index 1489e7c1c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/18-1.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * - * The mmap( ) function shall fail if: - * ML [EAGAIN] The mapping could not be locked in memory, - * if required by mlockall ( ), due toa lack of resources. - * - * Test Step: - * 1. Call mlockall(), setting MCL_FUTURE; - * 2. Call setrlimit(), set rlim_cur of resource RLIMIT_MEMLOCK to a - * certain value. - * 3. Map a shared memory object, with size larger than the - * rlim_cur value set in step 2 - * 4. Should get EAGAIN. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/18-1.c" - -int main() -{ - char tmpfname[256]; - int shm_fd; - - /* size of shared memory object */ - size_t shm_size; - - void *pa = NULL; - void *addr = NULL; - size_t len; - int prot = PROT_READ | PROT_WRITE; - int flag = MAP_SHARED; - int fd; - off_t off = 0; - - size_t memlock_size; - struct rlimit rlim = {.rlim_max = RLIM_INFINITY}; - - /* Lock all memory page to be mapped */ - if (mlockall(MCL_FUTURE) == -1) - { - printf(TNAME " Error at mlockall(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - /* Set rlim.rlim_cur < len */ - - len = 1024 * 1024; - memlock_size = len / 2; - rlim.rlim_cur = memlock_size; - - /* We don't cate the size of the actual shared memory object */ - shm_size = 1024; - - if (setrlimit (RLIMIT_MEMLOCK, &rlim) == -1) - { - printf(TNAME " Error at setrlimit(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_18_1_%ld", - (long)getpid()); - - /* Create shared object */ - shm_unlink(tmpfname); - shm_fd = shm_open(tmpfname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - printf(TNAME " Error at shm_open(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - shm_unlink(tmpfname); - if(ftruncate(shm_fd, shm_size) == -1) { - printf(TNAME " Error at ftruncate(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - fd = shm_fd; - pa = mmap (addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == EAGAIN) - { - printf ("Test Pass: " TNAME " Get EAGAIN: %s\n", - strerror(errno)); - close(fd); - munmap(pa, len); - exit(PTS_PASS); - } - - if (pa == MAP_FAILED) - perror("Error at mmap()"); - close(fd); - munmap(pa, len); - printf ("Test Fail: Did not get EAGAIN as expected\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/19-1.c deleted file mode 100644 index 33d6f37172..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/19-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The mmap( ) function shall fail if: - * [EBADF] The fildes argument is not a valid open file descriptor. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/19-1.c" - -int main() -{ - void *pa = NULL; - void *addr = NULL; - size_t size; - int flag; - int fd; - off_t off = 0; - int prot; - - size = 1024; - - fd = -1; - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == EBADF) - { - printf ("Test Pass: " TNAME " Get EBADF when fd is invalid\n"); - exit(PTS_PASS); - } - - if (pa == MAP_FAILED) - perror("mmap() error"); - printf ("Test FAIL: Did not get EBADF when fd is invalid\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/20-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/20-1.sh deleted file mode 100755 index 4f27917e62..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/20-1.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# The mmap( ) function shall fail if: -# [EINVAL] The addr argument (if MAP_FIXED was specified) or off is not a multiple of -# the page size as returned by sysconf( ), or is considered invalid by the -# implementation. - -# This is tested implicitly via assertion 11. - -echo "Tested implicitly via assertion 11. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/21-1.c deleted file mode 100644 index 36032b257d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/21-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * When the implementation selects a - * The mmap( ) function shall fail if: - * [EINVAL] The value of flags is invalid (neither MAP_PRIVATE nor MAP_SHARED is - * set). - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/21-1.c" - -int main() -{ - char tmpfname[256]; - long total_size; - - void *pa = NULL; - void *addr = NULL; - size_t size; - int flag; - int fd; - off_t off = 0; - int prot; - - total_size = 1024; - size = total_size; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_21_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - flag = MAP_SHARED; - while (flag == MAP_SHARED || flag == MAP_PRIVATE - || flag == MAP_FIXED) - flag++; - - prot = PROT_READ | PROT_WRITE; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == EINVAL) - { - printf ("Test PASS: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_PASS); - } - - close (fd); - munmap (pa, size); - printf ("Test FAIL\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/23-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/23-1.c deleted file mode 100644 index 231dc6396e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/23-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The mmap( ) function shall fail if: - * [ENODEV] The fildes argument refers to a file whose type is not supported by mmap( ). - * - * Test Step: - * 1. Create pipe; - * 2. mmap the pipe fd to memory, should get ENODEV; - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/23-1.c" - -int main() -{ - int pipe_fd[2]; - - void *pa = NULL; - void *addr = NULL; - size_t len = 1024; - int prot = PROT_READ | PROT_WRITE; - int flag = MAP_SHARED; - int fd; - off_t off = 0; - - if (pipe(pipe_fd) == -1) - { - printf("Test Unresolved: " TNAME " Error at pipe(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - fd = pipe_fd[1]; - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == ENODEV) - { - printf("Test Pass: " TNAME " Get ENODEV when mmap a pipe fd\n"); - close(pipe_fd[0]); - close(pipe_fd[1]); - exit(PTS_PASS); - } - else - { - printf ("Test Fail: " TNAME - " Expect ENODEF, get: %s\n", strerror(errno)); - close(pipe_fd[0]); - close(pipe_fd[1]); - exit(PTS_FAIL); - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/24-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/24-1.c deleted file mode 100644 index 55f706af89..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/24-1.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The mmap( ) function shall fail if: - * [ENOMEM] MAP_FIXED was specified, and the range [addr,addr+len) - * exceeds that allowed for the address space of a process; - * or, if MAP_FIXED was not specified and - * there is insufficient room in the address space to effect the mapping. - * - * Test Step: - * 1. In a very long loop, keep mapping a shared memory object, - * until there this insufficient room in the address space; - * 3. Should get ENOMEM. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/24-1.c" - -int main() -{ - char tmpfname[256]; - int shm_fd; - - void *pa = NULL; - void *addr = NULL; - size_t len; - int prot = PROT_READ | PROT_WRITE; - int flag = MAP_SHARED; - int fd; - off_t off = 0; - - /* Size of the shared memory object */ - size_t shm_size = 1024; - - size_t mapped_size = 0; - - snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_25_1_%ld", - (long)getpid()); - - /* Create shared object */ - shm_unlink(tmpfname); - shm_fd = shm_open(tmpfname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - printf(TNAME " Error at shm_open(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - shm_unlink(tmpfname); - if(ftruncate(shm_fd, shm_size) == -1) { - printf(TNAME " Error at ftruncate(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - fd = shm_fd; - len = shm_size; - - mapped_size = 0; - while(mapped_size < SIZE_MAX) - { - pa = mmap (addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == ENOMEM) - { - printf ("Test Pass: " TNAME " Get ENOMEM: %s\n", - strerror(errno)); - printf ("Total mapped size is %lu bytes\n", (unsigned long)mapped_size); - exit(PTS_PASS); - } - - mapped_size += shm_size; - if (pa == MAP_FAILED) - perror("Error at mmap()"); - } - - close(fd); - printf ("Test Fail: Did not get ENOMEM as expected\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/24-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/24-2.c deleted file mode 100644 index 5448a5444b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/24-2.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * The mmap( ) function shall fail if: - * [ENOMEM] MAP_FIXED was specified, - * and the range [addr,addr+len) exceeds that allowed - * for the address space of a process; or, if MAP_FIXED was not specified and - * there is insufficient room in the address space to effect the mapping. - * - * Test Step: - * 1. Map a shared memory object, with size exceeding the value get from - * rlim_cur of resource RLIMIT_AS, setting MAP_FIXED; - * 3. Should get ENOMEM. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/24-2.c" - -int main() -{ - char tmpfname[256]; - int shm_fd; - - void *pa = NULL; - void *addr = NULL; - size_t len; - int prot = PROT_READ | PROT_WRITE; - int flag = MAP_SHARED; - int fd; - off_t off = 0; - - /* Size of the shared memory object */ - size_t shm_size; - struct rlimit rlim; - unsigned long page_size = sysconf(_SC_PAGE_SIZE); - - shm_size = 2 * page_size; - snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_24_2_%ld", - (long)getpid()); - - /* Create shared object */ - shm_unlink(tmpfname); - shm_fd = shm_open(tmpfname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - printf(TNAME " Error at shm_open(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - shm_unlink(tmpfname); - if(ftruncate(shm_fd, shm_size) == -1) { - printf(TNAME " Error at ftruncate(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - /* Currentlly total available memory of this process, in bytes */ - if (getrlimit (RLIMIT_AS, &rlim) == -1) - { - printf(TNAME " Error at getrlimit(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - printf("available memory: %lu\n", rlim.rlim_cur); - - /* First mmap, just to get a legal addr for second mmap */ - fd = shm_fd; - len = shm_size; - pa = mmap (addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " Error at first mmap(): %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - fd = shm_fd; - len = rlim.rlim_cur; - flag = MAP_FIXED | MAP_SHARED; - addr = pa; - printf("addr: %lx, len: %lx\n", (unsigned long)addr, - (unsigned long)len); - /* Make sure addr and len is aligned to page size */ - if ((unsigned long)addr % page_size) - { - /* Upper boundary */ - addr += page_size; - addr = (void *)((unsigned long)addr & ~(page_size - 1)); - } - if (len % page_size) - { - /* Lower boundary */ - len &= ~(page_size - 1); - } - printf("addr: %lx, len: %lx\n", (unsigned long)addr, - (unsigned long)len); - pa = mmap (addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == ENOMEM) - { - printf ("Test Pass: " TNAME " Get ENOMEM: %s\n", - strerror(errno)); - exit(PTS_PASS); - } - - if (pa == MAP_FAILED) - perror("Error at mmap()"); - else - munmap(pa, len); - close(fd); - printf ("Test Fail: Did not get ENOMEM as expected\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/27-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/27-1.c deleted file mode 100644 index ac8ae8a901..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/27-1.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * The mmap( ) function shall fail if: - * [ENOTSUP] MAP_FIXED or MAP_PRIVATE was specified - * in the flags argument and the - * implementation does not support this functionality. - * The implementation does not support the combination - * of accesses requested in the prot argument. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/27-1.c" - -int main() -{ - char tmpfname[256]; - char* data; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t len = total_size; - int prot; - int flag; - int fd; - off_t off = 0; -#ifdef MAP_FIXED - printf("Test Untested: MAP_FIXED defined\n"); - exit(PTS_UNTESTED); -#endif - -#ifdef MAP_SHARED - printf("Test Untested: MAP_SHARED defined\n"); - exit(PTS_UNTESTED); -#endif - -#ifdef PROT_WRITE - printf("Test Untested: PROT_WRITE defined\n"); - exit(PTS_UNTESTED); -#endif - -#ifdef PROT_READ - printf("Test Untested: PROT_READ defined\n"); - exit(PTS_UNTESTED); -#endif - - data = (char *) malloc(total_size); - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_27_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - /* Make sure the file is removed when it is closed */ - unlink(tmpfname); - - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - prot = PROT_READ | PROT_WRITE; - flag = MAP_FIXED | MAP_SHARED; - pa = mmap(addr, len, prot, flag, fd, off); - if (pa != MAP_FAILED) - { - printf("Test Fail: " TNAME " Did not get error\n"); - exit(PTS_FAIL); - } - else if (errno != ENOTSUP) - { - printf("Test Fail: " TNAME " Get error: %s\n", - strerror(errno)); - exit(PTS_FAIL); - - } - - printf ("Test Pass\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/28-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/28-1.c deleted file mode 100644 index bef85b4a96..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/28-1.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * The mmap( ) function shall fail if: - * [ENXIO] Addresses in the range [off,off+len) are invalid - * for the object specified by fildes. - * - * Test Step: - * 1. mmap a shared memory object into memory; - * 2. (off + len) will beyond the the shared memory object; - * - * FIXME: Not sure what does "invalid" mean here - * - * This mmap might trigger SIGBUS on some system. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/28-1.c" - -void sigbus_handler (int signum) -{ - printf("Test UNRESOLVED: Triger SIGBUS\n"); - exit(PTS_UNRESOLVED); -} - -int main() -{ - char tmpfname[256]; - int shm_fd; - long shm_size; - - void *pa = NULL; - void *addr = NULL; - size_t len = 0; - int prot = PROT_READ | PROT_WRITE; - int flag; - int fd; - off_t off = 0; - - long page_size = sysconf(_SC_PAGE_SIZE); - shm_size = 2 * page_size; - - if (signal(SIGBUS, sigbus_handler) == SIG_ERR) - { - printf(TNAME " Error at signal(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_28_1_%ld", - (long)getpid()); - /* Create shared object */ - shm_unlink(tmpfname); - shm_fd = shm_open(tmpfname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - printf(TNAME " Error at shm_open(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - shm_unlink(tmpfname); - if(ftruncate(shm_fd, shm_size) == -1) { - printf(TNAME " Error at ftruncate(): %s\n", strerror(errno)); - return PTS_UNRESOLVED; - } - - /* (off + len) will go outside the object */ - fd = shm_fd; - len = 2 * shm_size; - flag = MAP_SHARED; - off = page_size; - pa = mmap (addr, len, prot, flag, fd, off); - if (pa != MAP_FAILED ) - { - printf ("Test Fail: " TNAME " Got no error at mmap()\n"); - close(fd); - munmap(pa, len); - exit(PTS_FAIL); - } - else if (errno != ENXIO) - { - printf ("Test Fail: " TNAME " Did not get ENXIO," - " get other error: %s\n", strerror(errno)); - exit(PTS_FAIL); - } - - printf ("Test Pass\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/3-1.c deleted file mode 100644 index 4eda8331bb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/3-1.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The mapping established by mmap( ) shall replace any previous - * mappings for those whole pages containing any part of the address - * space of the process starting at pa and continuing for len bytes. - * - * Test Step: - * 1. Set the size of the file to be mapped as (2 * _SC_PAGE_SIZE); - * 2. Map size = (_SC_PAGE_SIZE + 2) bytes into memory, - * setting the content as 'a'. The mapped address is pa. - * 2. Map size2 = (_SC_PAGE_SIZE + 1) bytes into memory, starting at the same - * address as the first mmap, i.e. pa, using MAP_FIXED flag. - * Setting the cotent as 'b' - * 3. Test whether byte *(pa + size) is 'b'. - */ - - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/3-1.c" - -int main() -{ - char tmpfname[256]; - char tmpfname2[256]; - char* data; - long total_size; - long page_size; - - void *pa = NULL; - void *addr = NULL; - size_t size; - int prot = PROT_READ | PROT_WRITE; - int flag = MAP_SHARED; - int fd; - off_t off = 0; - - void *pa2 = NULL; - void *addr2 = NULL; - size_t size2; - int prot2 = PROT_READ | PROT_WRITE; - int flag2 ; - int fd2; - off_t off2 = 0; - - char *ch; - -#ifndef MAP_FIXED - printf("MAP_FIXED does not defined\n"); - exit(PTS_UNRESOLVED); -#endif - - page_size = sysconf(_SC_PAGE_SIZE); - size = page_size + 2; - size2 = page_size + 1; - - /* Size of the file */ - total_size = 2 * page_size; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_3_1_%ld", - (long)getpid()); - snprintf(tmpfname2, sizeof(tmpfname2), "/tmp/pts_mmap_3_1_2_%ld", - (long)getpid()); - data = (char *) malloc(total_size); - unlink(tmpfname); - unlink(tmpfname2); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - fd2 = open(tmpfname2, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1 || fd2 == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - unlink(tmpfname2); - memset(data, 'a', total_size); - if (write(fd, data, total_size) != total_size) - { - printf(TNAME "Error at write(), fd: %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - memset(data, 'b', total_size); - if (write(fd2, data, total_size) != total_size) - { - printf(TNAME "Error at write(), fd1: %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - free(data); - - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa + size; - if (*ch != 'a') - { - printf ("Test Fail: " TNAME - " The file did not mapped to memory\n"); - exit(PTS_FAIL); - } - - /* Replace orginal mapping*/ - - addr2 = pa; - flag2 = MAP_SHARED | MAP_FIXED; - pa2 = mmap(addr2, size2, prot2, flag2, fd2, off2); - if (pa2 == MAP_FAILED) - { - printf ("Test Fail: " TNAME " Error at 2nd mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - if (pa2 != pa) - { - printf ("Test Fail: " TNAME " Error at mmap: " - "Second mmap does not replace the first mmap\n"); - exit(PTS_FAIL); - } - - ch = pa2 + size; - if (*ch != 'b') - { - printf ("Test Fail: " TNAME - " The original mapped page has not been replaced\n"); - exit(PTS_FAIL); - } - - close(fd); - close(fd2); - munmap(pa, size); - munmap(pa2, size2); - printf ("Test Pass\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/31-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/31-1.c deleted file mode 100644 index 2486b0d7e2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/31-1.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The mmap( ) function shall fail if: - * [EOVERFLOW] The file is a regular file and the value of off - * plus len exceeds the offset maximum established in the open - * file description associated with fildes. - * - * Test Steps: - * 1. Set off and let to ULONG_MAX (make them align to page_size - * 2. Assume the offset maximum is ULONG_MAX (on both 32 and 64 system). - * - * FIXME: Not quite sure how to make "the value of off plus len - * exceeds the offset maxium established in the open file description - * associated with files". - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/31-1.c" - -int main() -{ - char tmpfname[256]; - - void *pa = NULL; - void *addr = NULL; - size_t len; - int flag; - int fd; - off_t off = 0; - int prot; - - long page_size = sysconf(_SC_PAGE_SIZE); - - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_31_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - - /* len + off > maximum offset - * FIXME: We assume maximum offset is ULONG_MAX - * */ - - len = ULONG_MAX; - if (len % page_size) - { - /* Lower boundary */ - len &= ~(page_size - 1); - } - - off = ULONG_MAX; - if (off % page_size) - { - /* Lower boundary */ - off &= ~(page_size - 1); - } - - printf("off: %lx, len: %lx\n", (unsigned long)off, - (unsigned long)len); - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == EOVERFLOW) - { - printf ("Test Pass: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_PASS); - } - - if (pa == MAP_FAILED) - perror("Test FAIL: expect EOVERFLOW but get other error"); - else - printf ("Test FAIL : Expect EOVERFLOW but got no error\n"); - - close (fd); - munmap (pa, len); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/5-1.c deleted file mode 100644 index c5773edb0e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/5-1.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The prot shall be either PROT_NONE or the bitwise-inclusive OR of - * one or more of the other flags in the following table, defined in the - * header. - * PROT_READ Data can be read. - * PROT_WRITE Data can be written. - * PROT_EXEC Data can be executed. - * PROT_NONE Data cannot be accessed. - * If an implementation cannot support the combination of access types - * specified by prot, the call to mmap( ) shall fail. - * - * Test Step: - * 1. mmap(), setting 'prot' as PROT_NONE; - * 2. mmap(), setting 'prot' as PROT_READ | PROT_WRITE | PROT_EXEC - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/5-1.c" - -int main() -{ - char tmpfname[256]; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t size = total_size; - int flag = MAP_SHARED; - int fd; - int prot; - off_t off = 0; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_5_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - -#ifndef PROT_READ - printf("Test Fail: " TNAME " PROT_READ not defined\n"); - exit(PTS_FAIL); -#endif -#ifndef PROT_WRITE - printf("Test Fail: " TNAME " PROT_WRITE not defined\n"); - exit(PTS_FAIL); -#endif -#ifndef PROT_EXEC - printf("Test Fail: " TNAME " PROT_EXEC not defined\n"); - exit(PTS_FAIL); -#endif -#ifndef PROT_NONE - printf("Test Fail: " TNAME " PROT_READ not defined\n"); - exit(PTS_FAIL); -#endif - - prot = PROT_NONE; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at mmap, with PROT_NONE %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - munmap(pa, size); - - prot = PROT_READ | PROT_WRITE | PROT_EXEC; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at mmap," - "with PROT_READ | PROT_WRITE | PROT_EXEC %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - munmap(pa, size); - - close(fd); - printf ("Test Pass\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-1.c deleted file mode 100644 index 483db7151b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-1.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * MPR An implementation may permit accesses other than those specified by prot; - * however, if the Memory Protection option is supported, the implementation - * shall not permit a write to succeed where PROT_WRITE has not been set or - * shall not permit any access where PROT_NONE alone has been set. - * The implementation shall support at least the following values of prot: - * PROT_NONE, PROT_READ, PROT_WRITE, and the bitwise-inclusive OR of PROT_READ and - * PROT_WRITE. - * - * Test Step: - * - * If Memory Protection option is supported: - * 1. Spawn a child process. - * 2. The child process mmap a memory region setting prot as PROT_READ. - * 3. Try to write the mapped memory. - * 4. If the writing triger SIGSEGV, the PASS. - * - * Please refer to IEEE_1003.1-2001. 2.8.3.3 Memory Protection. - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/6-1.c" - -int main() -{ -#ifdef _POSIX_MEMORY_PROTECTION - char tmpfname[256]; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t size = total_size; - int flag = MAP_SHARED; - int fd; - off_t off = 0; - int prot; - - char * ch; - - pid_t child; - int status; - int sig_num; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - child = fork(); - - if (child == 0) - { - if(ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - prot = PROT_READ; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa; - - *ch = 'b'; - exit(0); - } - else if (child > 0) - { - waitpid(child, &status, WUNTRACED); - close(fd); - if (WIFSTOPPED(status)) - { - sig_num = WSTOPSIG(status); - printf("Child process stopped by signal %d\n", sig_num); - if (sig_num == SIGSEGV) - { - printf("Test Pass: " TNAME - " Got SIGSEGV when writing to the mapped memory, " - "without setting PROT_WRITE\n"); - return PTS_PASS; - } - } - if (WIFSIGNALED(status)) - { - sig_num = WTERMSIG(status); - printf("Child process terminated by signal %d\n", sig_num); - if (sig_num == SIGSEGV) - { - printf ("Test Pass: " TNAME - " Got SIGSEGV when writing to the mapped memory, " - "without setting PROT_WRITE\n"); - return PTS_PASS; - } - } - if (WIFEXITED(status)) - { - if (WEXITSTATUS(status) == 0) - { - printf ("Test FAIL: " TNAME - " Did not got SIGSEGV when writing to the mapped memory," - " without setting PROT_WRITE\n"); - return PTS_FAIL; - } - } - printf ("Test Unresolved\n"); - return PTS_UNRESOLVED; - } - -#else - printf ("Test Unresolved: " TNAME - " _POSIX_MEMORY_PROTECTION not defined\n"); - return PTS_UNRESOLVED; -#endif - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-2.c deleted file mode 100644 index d69d8d9256..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-2.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * MPR An implementation may permit accesses other than those specified by prot; - * however, if the Memory Protection option is supported, the implementation - * shall not permit a write to succeed where PROT_WRITE has not been set or - * shall not permit any access where PROT_NONE alone has been set. - * The implementation shall support at least the following values of prot: - * PROT_NONE, PROT_READ, PROT_WRITE, and the bitwise-inclusive OR of PROT_READ and - * PROT_WRITE. - * - * Test Step: - * - * If the Memory Protection option is supported: - * - * 1. Spawn a child process. - * 2. The child process mmap a memory region setting prot as PROT_NONE. - * 3. Try to read the mapped memory. - * 4. If the read will triger SIGSEGV, the PASS. - * - * Please refer to IEEE_1003.1-2001. 2.8.3.3 Memory Protection. - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/6-2.c" - -int main() -{ - -#ifdef _POSIX_MEMORY_PROTECTION - char tmpfname[256]; - char* data; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t size = total_size; - int flag = MAP_SHARED; - int fd; - off_t off = 0; - int prot; - - char * ch; - - pid_t child; - int status; - int sig_num; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_2_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - child = fork(); - - if (child == 0) - { - fflush (NULL); - data = (char *) malloc(total_size); - memset(data, 'a', total_size); - if (write(fd, data, total_size) != total_size) - { - printf(TNAME "Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - free(data); - - prot = PROT_NONE; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa; - /* Read acess */ - if(*ch != 'a') - { - printf ("Test Fail: " TNAME - " The file did not mapped to memory\n"); - exit(PTS_FAIL); - } - exit(0); - } - else if (child > 0) - { - waitpid(child, &status, 0); - close(fd); - if (WIFSTOPPED(status)) - { - sig_num = WSTOPSIG(status); - if (sig_num == SIGSEGV) - { - printf("Test Pass: " TNAME - " Got SIGSEGV when reading the mapped memory, " - "setting PROT_NONE\n"); - return PTS_PASS; - } - printf("Child process stopped by signal %d\n", sig_num); - } - if (WIFSIGNALED(status)) - { - sig_num = WTERMSIG(status); - if (sig_num == SIGSEGV) - { - printf ("Test Pass: " TNAME - " Got SIGSEGV when reading the mapped memory, " - " setting PROT_NOTE\n"); - return PTS_PASS; - } - printf("Child process terminated by signal %d\n", sig_num); - } - if (WIFEXITED(status)) - { - if (WEXITSTATUS(status) == 0) - { - printf ("Test FAIL: " TNAME - " Did not got SIGSEGV when reading the mapped memory," - " setting PROT_NOTE\n"); - return PTS_FAIL; - } - - } - printf ("Test Unresolved\n"); - return PTS_UNRESOLVED; - } - -#else - printf ("Test Unresolved: " TNAME - " _POSIX_MEMORY_PROTECTION not defined\n"); - return PTS_UNRESOLVED; -#endif - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-3.c deleted file mode 100644 index 8f69f56fc0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-3.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * MPR An implementation may permit accesses other than those specified by prot; - * however, if the Memory Protection option is supported, the implementation - * shall not permit a write to succeed where PROT_WRITE has not been set or - * shall not permit any access where PROT_NONE alone has been set. - * The implementation shall support at least the following values of prot: - * PROT_NONE, PROT_READ, PROT_WRITE, and the bitwise-inclusive OR of PROT_READ and - * PROT_WRITE. - * - * Test Step: - * If Memory Protection option is suppored: - * 1. Spawn a child process. - * 2. The child process mmap a memory region setting prot as PROT_NONE. - * 3. Try to write the mapped memory. - * 4. If the write will triger SIGSEGV, the PASS. - * - * Please refer to IEEE_1003.1-2001. 2.8.3.3 Memory Protection. - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/6-3.c" - -int main() -{ - -#ifdef _POSIX_MEMORY_PROTECTION - char tmpfname[256]; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t size = total_size; - int flag = MAP_SHARED; - int fd; - off_t off = 0; - int prot; - - char * ch; - - pid_t child; - int status; - int sig_num; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_3_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - child = fork(); - - if (child == 0) - { - fflush (NULL); - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - prot = PROT_NONE; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa; - - /* Write acess */ - *ch = 'b'; - exit(0); - } - else if (child > 0) - { - waitpid(child, &status, 0); - close(fd); - if (WIFSTOPPED(status)) - { - sig_num = WSTOPSIG(status); - if (sig_num == SIGSEGV) - { - printf("Test Pass: " TNAME - " Got SIGSEGV when writing the mapped memory, " - "setting PROT_NONE\n"); - return PTS_PASS; - } - printf("Child process stopped by signal %d\n", sig_num); - } - if (WIFSIGNALED(status)) - { - sig_num = WTERMSIG(status); - if (sig_num == SIGSEGV) - { - printf ("Test Pass: " TNAME - " Got SIGSEGV when writing the mapped memory, " - " setting PROT_NOTE\n"); - return PTS_PASS; - } - printf("Child process terminated by signal %d\n", sig_num); - } - if (WIFEXITED(status)) - { - if (WEXITSTATUS(status) == 0) - { - printf ("Test FAIL: " TNAME - " Did not got SIGSEGV when writing the mapped memory," - " setting PROT_NOTE\n"); - return PTS_FAIL; - } - - } - printf ("Test Unresolved\n"); - return PTS_UNRESOLVED; - } - -#else - printf ("Test Unresolved: " TNAME - " _POSIX_MEMORY_PROTECTION not defined\n"); - return PTS_UNRESOLVED; -#endif -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-4.c deleted file mode 100644 index 09b692e050..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-4.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The file descriptor fildes shall have been opened with read permission, - * regardless of the protection options specified. If PROT_WRITE is - * specified, the application shall ensure that it has opened the file - * descriptor fildes with write permission unless MAP_PRIVATE - * is specified in the flags parameter as described below. - * - * Test Step: - * 1 Open a file RDONLY permition. - * 2. Mmap the file to a memory region setting prot as PROT_WRITE. - * 3. Setting flag as MAP_SHARED. - * 4. Get EACCES error when mmap(). - * - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/6-4.c" - -int main() -{ - char tmpfname[256]; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t size = total_size; - int flag; - int fd; - off_t off = 0; - int prot; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_4_%ld", - (long)getpid()); - - /* Create a tmp file, set the content as 'a' */ - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - close(fd); - - /* Open as read only */ - - fd = open(tmpfname, O_RDONLY, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at 2nd open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - prot = PROT_WRITE; - flag = MAP_SHARED; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == EACCES) - { - printf("Test PASS: " TNAME " Get EACCES Error: %s\n", - strerror(errno)); - exit(PTS_PASS); - } - - printf ("Test Fail: Did not get EACCES as expected\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-5.c deleted file mode 100644 index dd6ad557c3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-5.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The file descriptor fildes shall have been opened with read permission, - * regardless of the protection options specified. If PROT_WRITE is - * specified, the application shall ensure that it has opened the file - * descriptor fildes with write permission unless MAP_PRIVATE - * is specified in the flags parameter as described below. - * - * Test Step: - * 1 Open a file with read only permition. - * 2. Mmap the file to a memory region setting prot as PROT_WRITE. - * 3. Setting flag as MAP_PRIVATE. - * 4. The mmap() should be sucessful. - * - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/6-5.c" - -int main() -{ - char tmpfname[256]; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t size = total_size; - int flag; - int fd; - off_t off = 0; - int prot; - - /* Create the file */ - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_5_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - close(fd); - - fd = open(tmpfname, O_RDONLY, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at 2nd open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - prot = PROT_WRITE; - flag = MAP_PRIVATE; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test FAIL: " TNAME " Get Error: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - printf ("Test PASS: Mmap return successfully\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-6.c deleted file mode 100644 index fe43c4201a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-6.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The file descriptor fildes shall have been opened with read permission, - * regardless of the protection options specified. If PROT_WRITE is - * specified, the application shall ensure that it has opened the file - * descriptor fildes with write permission unless MAP_PRIVATE - * is specified in the flags parameter as described below. - * - * Test Step: - * 1 Open a file with write only permition. - * 2. Mmap the file to a memory region setting prot as PROT_READ. - * 3. Get EACCES error when mmap(). - * - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/6-6.c" - -int main() -{ - char tmpfname[256]; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t size = total_size; - int flag; - int fd; - off_t off = 0; - int prot; - - /* Create the tmp file */ - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_6_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - close(fd); - - /* Open write only */ - - fd = open(tmpfname, O_WRONLY, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - /* prot can be set as whatever value */ - prot = PROT_READ; - flag = MAP_PRIVATE; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == EACCES) - { - printf("Test PASS: " TNAME " Get EACCES Error: %s\n", - strerror(errno)); - exit(PTS_PASS); - } - - printf ("Test Fail: Did not get EACCES as expected\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-1.c deleted file mode 100644 index d08e5118a8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-1.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * MAP_SHARED and MAP_PRIVATE describe the disposition of write references - * to the memory object. If MAP_SHARED is specified, write references shall - * change the underlying object. If MAP_PRIVATE is specified, modifications - * to the mapped data by the calling process shall be visible only to the - * calling process and shall not change the underlying object. - * It is unspecified whether modifications to the underlying object done - * after the MAP_PRIVATE mapping is established are visible through - * the MAP_PRIVATE mapping. - * - * Test Step: - * 1. mmap() a file, setting MAP_SHARED; - * 2. modify the mapped memory; - * 3. call msync() to synchronize the modification; - * 4. munmap() this mapping; - * 5. mmap() the same file again into memory; - * 6. Check whether the modification has take effect; - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/7-1.c" - -int main() -{ - int rc; - - char tmpfname[256]; - char* data; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t size = total_size; - int flag; - int fd; - off_t off = 0; - int prot; - - char * ch; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_7_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - data = (char *) malloc(total_size); - memset(data, 'a', total_size); - if (write(fd, data, total_size) != total_size) - { - printf(TNAME "Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - free(data); - - prot = PROT_READ | PROT_WRITE; - flag = MAP_SHARED; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa; - *ch = 'b'; - - /* Flush changes back to the file */ - - if ((rc = msync(pa, size, MS_SYNC)) != 0) - { - printf(TNAME " Error at msync(): %s\n", - strerror(rc)); - exit(PTS_UNRESOLVED); - } - - munmap(pa, size); - - /* Mmap again */ - - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at 2nd mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa; - if (*ch == 'b') - { - printf("Test Pass\n"); - exit(PTS_PASS); - } - - close(fd); - munmap(pa, size); - - printf ("Test Fail, write referece does not change" - " the underlying file\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-2.c deleted file mode 100644 index 63a76c495d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-2.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * MAP_SHARED and MAP_PRIVATE describe the disposition of write references - * to the memory object. If MAP_SHARED is specified, write references shall - * change the underlying object. If MAP_PRIVATE is specified, modifications - * to the mapped data by the calling process shall be visible only to the - * calling process and shall not change the underlying object. - * It is unspecified whether modifications to the underlying object done - * after the MAP_PRIVATE mapping is established are visible through - * the MAP_PRIVATE mapping. - * - * Test Step: - * 1. mmap a file into memory. Set flag as MAP_PRIVATE; - * 2. Modify the mapped memory, and call msync to try to synchronize the change with - * the file; - * 3. munmap the mapped memory; - * 4. mmap the same file again into memory; - * 5. If the modification in step 2 appears in the mapped memory, then fail, - * otherwise pass. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/7-2.c" - -int main() -{ - int rc; - - char tmpfname[256]; - char* data; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t size = total_size; - int flag; - int fd; - off_t off = 0; - int prot; - - char * ch; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_7_2_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - data = (char *) malloc(total_size); - memset(data, 'a', total_size); - if (write(fd, data, total_size) != total_size) - { - printf(TNAME "Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - free(data); - - prot = PROT_READ | PROT_WRITE; - flag = MAP_PRIVATE; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa; - *ch = 'b'; - - /* Flush changes back to the file */ - - if ((rc =msync(pa, size, MS_SYNC)) != 0) - { - printf(TNAME " Error at msync(): %s\n", - strerror(rc)); - exit(PTS_UNRESOLVED); - } - - munmap(pa, size); - - /* Mmap again */ - - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at 2nd mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa; - if (*ch == 'b') - { - printf("Test FAIL\n"); - exit(PTS_FAIL); - } - - close (fd); - printf ("Test PASS, write referece does not change" - " the underlying object when setting MAP_RPIVATE\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-3.c deleted file mode 100644 index e7ce26fea7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-3.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * MAP_SHARED and MAP_PRIVATE describe the disposition of write references - * to the memory object. If MAP_SHARED is specified, write references shall - * change the underlying object. If MAP_PRIVATE is specified, modifications - * to the mapped data by the calling process shall be visible only to the - * calling process and shall not change the underlying object. - * It is unspecified whether modifications to the underlying object done - * after the MAP_PRIVATE mapping is established are visible through - * the MAP_PRIVATE mapping. - * - * Test Steps: - * - * 1. Create a shared memory object; - * 2. mmap the shared memory object into memory, setting MAP_PRIVATE; - * 3. Modify the mapped memory; - * 4. Fork a child process; - * 5. Child process mmap the same shared memory object into memory; - * 6. Check whether the change in step 3 is visible to the child; - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/7-3.c" - -int main() -{ - char tmpfname[256]; - int shm_fd; - - void *pa = NULL; - void *addr = NULL; - size_t size = 1024; - int prot = PROT_READ | PROT_WRITE; - int flag; - int fd; - off_t off = 0; - - pid_t child; - char * ch; - char * ch1; - - int exit_stat; - - /* Create shared object */ - snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_7_3_%ld", - (long)getpid()); - shm_unlink(tmpfname); - shm_fd = shm_open(tmpfname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - printf(TNAME " Error at shm_open(): %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } - - /* Set the size of the shared memory object */ - if(ftruncate(shm_fd, size) == -1) - { - printf(TNAME " Error at ftruncate(): %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } - - fd = shm_fd; - flag = MAP_PRIVATE; - pa = mmap (addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - shm_unlink(tmpfname); - - /* Write the mapped memory */ - - ch = pa; - *ch = 'a'; - - child = fork(); - if (child == 0) - { - /* Mmap again the same shared memory to child's memory */ - flag = MAP_PRIVATE; - pa = mmap (addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " child: Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch1 = pa; - - if (*ch1 == 'a') - { - printf ("Test FAIL: " TNAME "Set flag as MAP_PRIVATE, write reference will " - "change the underlying shared memory object\n"); - exit(PTS_FAIL); - } - - printf ("Test PASS: " TNAME "Set flag as MAP_PRIVATE, write reference will " - "not change the underlying shared memory object\n"); - exit(PTS_PASS); - } - else if (child > 0) - { - waitpid(child, &exit_stat, WUNTRACED); - - close(fd); - munmap(pa, size); - - if (WIFEXITED(exit_stat)) - exit(WEXITSTATUS(exit_stat)); - else - { - printf(TNAME " Child does not exit properly\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf (TNAME " Error at fork(), %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-4.c deleted file mode 100644 index ed96c0fd69..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/7-4.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * MAP_SHARED and MAP_PRIVATE describe the disposition of write references - * to the memory object. If MAP_SHARED is specified, write references shall - * change the underlying object. If MAP_PRIVATE is specified, modifications - * to the mapped data by the calling process shall be visible only to the - * calling process and shall not change the underlying object. - * It is unspecified whether modifications to the underlying object done - * after the MAP_PRIVATE mapping is established are visible through - * the MAP_PRIVATE mapping. - * - * Test Steps: - * - * 1. Create a shared memory object; - * 2. mmap the shared memory object into memory, setting MAP_PRIVATE; - * 3. Modify the mapped memory; - * 4. Fork a child process; - * 5. Child process mmap the same shared memory object into memory; - * 6. Check whether the change in step 3 is visible to the child; - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/7-4.c" - -int main() -{ - char tmpfname[256]; - int shm_fd; - - void *pa = NULL; - void *addr = NULL; - size_t size = 1024; - int prot = PROT_READ | PROT_WRITE; - int flag; - int fd; - off_t off = 0; - - pid_t child; - char * ch; - char * ch1; - - int exit_stat; - - /* Create shared object */ - snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_7_4_%ld", - (long)getpid()); - shm_unlink(tmpfname); - shm_fd = shm_open(tmpfname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - printf(TNAME " Error at shm_open(): %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } - - /* Set the size of the shared memory object */ - if(ftruncate(shm_fd, size) == -1) - { - printf(TNAME " Error at ftruncate(): %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } - - fd = shm_fd; - flag = MAP_SHARED; - pa = mmap (addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - shm_unlink(tmpfname); - /* Write the mapped memory */ - - ch = pa; - *ch = 'a'; - - child = fork(); - if (child == 0) - { - /* Mmap again the same shared memory to child's memory */ - flag = MAP_PRIVATE; - pa = mmap (addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Fail: " TNAME " child: Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch1 = pa; - - if (*ch1 == 'a') - { - printf ("Test PASS: " TNAME " Set flag as MAP_SHARED, write reference will " - "change the underlying shared memory object\n"); - exit(PTS_PASS); - } - - printf ("Test FAIL: " TNAME " Set flag as MAP_SHARED, write reference will " - "not change the underlying shared memory object\n"); - exit(PTS_PASS); - } - else if (child > 0) - { - waitpid(child, &exit_stat, WUNTRACED); - - munmap(pa, size); - - if (WIFEXITED(exit_stat)) - exit(WEXITSTATUS(exit_stat)); - else - { - printf(TNAME " Child does not exit properly\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf (TNAME " Error at fork(), %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/9-1.c deleted file mode 100644 index 2534d47029..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/9-1.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * If MAP_FIXED is set, - * mmap( ) may return MAP_FAILED and set errno to [EINVAL]. - * - * [EINVAL] The addr argument (if MAP_FIXED was specified) or off is not a multiple of - * the page size as returned by sysconf( ), or is considered invalid by the - * implementation. - * - * Test step: - * 1. Set 'addr' as an illegal address, which is not a multiple of page size; - * 2. Call mmap() and get EINVAL; - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "mmap/9-1.c" - -int main() -{ - char tmpfname[256]; - long page_size; - long total_size; - - void *illegal_addr; - void *pa = NULL; - void *addr = NULL; - size_t size; - int flag; - int fd; - off_t off = 0; - int prot; - - page_size = sysconf(_SC_PAGE_SIZE); - total_size = page_size; - size = total_size; - - /* Create tmp file */ - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_9_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - if (ftruncate(fd, total_size) == -1) - { - printf(TNAME "Error at ftruncate(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - /* Map the file for the first time, to get a legal address, pa */ - - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - pa = mmap(addr, size, prot, flag, fd, off); - - if ((unsigned long)pa % page_size) - { - printf("pa is not multiple of page_size\n"); - illegal_addr = pa; - } - else - { - printf("pa is a multiple of page_size\n"); - illegal_addr = pa + 1; - } - - munmap (pa, size); - - /* Mmap again using the illegal address, setting MAP_FIXED */ - prot = PROT_READ | PROT_WRITE; - flag = MAP_FIXED; - addr = illegal_addr; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED && errno == EINVAL) - { - printf("Test Pass: " TNAME " Set MAP_FIXED and get " - "EINVAL when 'addr' is illegal\n"); - exit(PTS_PASS); - } - - close (fd); - munmap (pa, size); - printf ("Test FAIL, Set MAP_FIXED but did not get EINVAL" - " when 'addr' is illegal\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/assertions.xml deleted file mode 100644 index de347b9f21..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/assertions.xml +++ /dev/null @@ -1,223 +0,0 @@ - - -mmap( ) function shall establish a mapping between the address space of -the process at an address pa for len bytes to the memory object represented -by the file descriptor fildes at offset off for len bytes. - - - -If fildes represents a typed memory object opened with either the -POSIX_TYPED_MEM_ALLOCATE flag or the POSIX_TYPED_MEM_ALLOCATE_CONTIG -flag, the memory object to be mapped shall be that portion of the typed memory object allocated. - - - -mapping established by mmap( ) shall replace any previous mappings for -those whole pages containing any part of the address space. - - - -TYM The mmap( ) function shall be supported for regular files, shared memory objects, and typed -memory objects. Support for any other type of file is unspecified. - - - - -The prot shall be either PROT_NONE or the bitwise- -inclusive OR of one or more of the other flags in the following table - PROT_READ Data can be read. - PROT_WRITE Data can be written. - PROT_EXEC Data can be executed. - PROT_NONE Data cannot be accessed. - - - -An implementation may permit accesses other than those specified by prot; however, if the -Memory Protection option is supported, the implementation shall not permit a write to succeed -where PROT_WRITE has not been set or shall not permit any access where PROT_NONE alone -has been set. The implementation shall support at least the following values of prot: -PROT_NONE, PROT_READ, PROT_WRITE, and the bitwise-inclusive OR of PROT_READ and -PROT_WRITE. If the Memory Protection option is not supported, the result of any access that -conflicts with the specified protection is undefined. The file descriptor fildes shall have been -opened with read permission, regardless of the protection options specified. If PROT_WRITE is -specified, the application shall ensure that it has opened the file descriptor fildes with write -permission unless MAP_PRIVATE is specified in the flags parameter as described below. - - - -It is implementation-defined whether MAP_FIXED shall be supported. MAP_FIXED shall be -supported on XSI-conformant systems. -MAP_SHARED and MAP_PRIVATE describe the disposition of write references to the memory -object. If MAP_SHARED is specified, write references shall change the underlying object. If -MAP_PRIVATE is specified, modifications to the mapped data by the calling process shall be -visible only to the calling process and shall not change the underlying object. It is unspecified -whether modifications to the underlying object done after the MAP_PRIVATE mapping is -established are visible through the MAP_PRIVATE mapping. Either MAP_SHARED or -MAP_PRIVATE can be specified, but not both. The mapping type is retained across fork( ). - - - -When fildes represents a typed memory object opened with either the -POSIX_TYPED_MEM_ALLOCATE flag or the POSIX_TYPED_MEM_ALLOCATE_CONTIG -flag, mmap( ) shall, if there are enough resources available, map len bytes allocated from the -corresponding typed memory object which were not previously allocated to any process in any -processor that may access that typed memory object. - - - -When MAP_FIXED is set in the flags argument, the implementation is informed that the value of -pa shall be addr, exactly. If MAP_FIXED is set, mmap( ) may returnMAP_FAILED and set errno to -[EINVAL]. If a MAP_FIXED request is successful, the mapping established by mmap( ) replaces -any previous mappings for the process' pages in the range [pa,pa+len). - - - -When MAP_FIXED is not set, the implementation uses addr in an implementation-defined -manner to arrive at pa. The pa so chosen shall be an area of the address space that the -implementation deems suitable for a mapping of len bytes to the file. All implementations -interpret an addr value of 0 as granting the implementation complete freedom in selecting pa, -subject to constraints described below. A non-zero value of addr is taken to be a suggestion of a -process address near which the mapping should be placed. When the implementation selects a -value for pa, it never places a mapping at address 0, nor does it replace any extant mapping. - - - -The off argument is constrained to be aligned and sized according to the value returned by -sysconf( ) when passed _SC_PAGESIZE or _SC_PAGE_SIZE. When MAP_FIXED is specified, the - application shall ensure that the argument addr also meets these constraints. The -implementation performs mapping operations over whole pages. Thus, while the argument len -need not meet a size or alignment constraint, the implementation shall include, in any mapping -operation, any partial page specified by the range [pa,pa+len). -The system shall always zero-fill any partial page at the end of an object. Further, the system -shall never write out any modified portions of the last page of an object which are beyond its -MPR end. References within the address range starting at pa and continuing for len bytes to whole -pages following the end of an object shall result in delivery of a SIGBUS signal. - - - -The mmap( ) function shall add an extra reference to the file associated with the file descriptor -fildes which is not removed by a subsequent close( ) on that file descriptor. This reference shall be -removed when there are no more mappings to the file. - - - -The st_atime field of the mapped file may be marked for update at any time between the mmap( ) -call and the corresponding munmap( ) call. The initial read or write reference to a mapped region -shall cause the file's st_atime field to be marked for update if it has not already been marked for -update. - - - -The st_ctime and st_mtime fields of a file that is mapped with MAP_SHARED and PROT_WRITE -shall be marked for update at some point in the interval between a write reference to the -mapped region and the next call to msync( ) with MS_ASYNC or MS_SYNC for that portion of -the file by any process. - - - -If mmap( ) fails for reasons other than [EBADF], [EINVAL], or [ENOTSUP], some of the -mappings in the address range starting at addr and continuing for len bytes may have been -unmapped. - - - - -Upon successful completion, the mmap( ) function shall return the address at which the mapping -was placed (pa); otherwise, it shall return a value of MAP_FAILED and set errno to indicate the -error. The symbol MAP_FAILED is defined in the sys/mman.h header. No successful return -from mmap( ) shall return the value MAP_FAILED. - - - -The mmap( ) function shall fail if: -[EACCES] The fildes argument is not open for read, regardless of the protection specified, -or fildes is not open for write and PROT_WRITE was specified for a -MAP_SHARED type mapping. - - - -The mmap( ) function shall fail if: -ML [EAGAIN] The mapping could not be locked in memory, if required by mlockall ( ), due to -a lack of resources. - - - -The mmap( ) function shall fail if: -[EBADF] The fildes argument is not a valid open file descriptor. - - - -The mmap( ) function shall fail if: -[EINVAL] The addr argument (if MAP_FIXED was specified) or off is not a multiple of -the page size as returned by sysconf( ), or is considered invalid by the -implementation. - - - -The mmap( ) function shall fail if: -[EINVAL] The value of flags is invalid (neither MAP_PRIVATE nor MAP_SHARED is -set). - - - -The mmap( ) function shall fail if: -[EMFILE] The number of mapped regions would exceed an implementation-defined -limit (per process or per system). - - - -The mmap( ) function shall fail if: -[ENODEV] The fildes argument refers to a file whose type is not supported by mmap( ). - - - -The mmap( ) function shall fail if: -[ENOMEM] MAP_FIXED was specified, and the range [addr,addr+len) exceeds that allowed -for the address space of a process; or, if MAP_FIXED was not specified and -there is insufficient room in the address space to effect the mapping. - - - - mmap( ) function shall fail if: - [ENOMEM] The mapping could not be locked in memory, if required by mlockall ( ), -because it would require more space than the system is able to supply. - - - -The mmap( ) function shall fail if: - [ENOMEM] Not enough unallocated memory resources remain in the typed memory -object designated by fildes to allocate len bytes. - - - -The mmap( ) function shall fail if: - [ENOTSUP] MAP_FIXED or MAP_PRIVATE was specified in the flags argument and the - implementation does not support this functionality. - The implementation does not support the combination of accesses requested - in the prot argument. - - - - The mmap( ) function shall fail if: - [ENXIO] Addresses in the range [off,off+len) are invalid for the object specified by fildes. - - - - The mmap( ) function shall fail if: - [ENXIO] MAP_FIXED was specified in flags and the combination of addr, len, and off is - invalid for the object specified by fildes. - - - -The mmap( ) function shall fail if: - [ENXIO] The fildes argument refers to a typed memory object that is not accessible from -the calling process. - - - -The mmap( ) function shall fail if: -[EOVERFLOW] The file is a regular file and the value of off plus len exceeds the offset -maximum established in the open file description associated with fildes. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/coverage.txt deleted file mode 100644 index 2c3b35deb0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/coverage.txt +++ /dev/null @@ -1,64 +0,0 @@ -This document defines the coverage for the mmap() function: - -Assertion Tested? -1 Not fully: ** Typed Memory object not tested. Tested file and shared -memory object. -2 NO: ** Typed Memory object -3 YES -4 NO: ** Typed Memory object not tested -5 YES -6 YES -7 YES -8 NO: ** Typed Memory object -9 YES -10 YES -11 YES -12 YES -13 YES -14 YES -15 NO ** May assertion -16 YES -17 YES -18 YES -19 YES -20 YES -21 YES -22 NO ** Not sure how to get/set the limit of the number of mapped region - ** for a process or system. -23 YES -24 YES -25 YES -26 NO ** Typed Memory Object -27 YES -28 YES -29 YES -30 NO ** Typed Memory object -31 YES - -NOTE: - -Some issues. - -11-2: Will fail with glibc-2.3 & linux kernel 2.6.0-test2. - The SIGBUS cannot be triggered as expected. - -11-3: Same as 11-2. - -13-1: Will fail with glibc-2.3 & linux kernel 2.6.0-test2. - The file's st_atime will not be updated as expected. - -14-1: Will fail with glibc-2.3 & linux kernel 2.6.0-test2. - The file's st_ctime and st_mtime will not be updated as expected. - -24-2: Will fail with glibc-2.3 & linux kernel 2.6.0-test2. - Get EINVAL instead of ENOMEM. - -25-1: Freezes with glibc-3.4 & linux kernel 2.5.67 - -28-1: Will fail with glibc-2.3 & linux kernel 2.6.0-test2. - -29-1: Will trigger SIGBUS (freezes with glibc-3.4 * linux kernel 2.5.67) - -31-1: Will fail with glibc-2.3 & linux kernel 2.6.0-test2. - EXPECT EOVERFLOW but get not error. - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/1-1.c deleted file mode 100644 index 771b105aeb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/1-1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_close test case that attempts to open a new message queue, - * close the message queue and verify that mq_close returns 0. - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "mq_close" - -int main() -{ - char qname[50]; - mqd_t queue; - - sprintf(qname, "/" FUNCTION "_" TEST "_%d", getpid()); - - queue = mq_open(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_close(queue) != 0) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/2-1.c deleted file mode 100644 index 72b12da7bf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/2-1.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - mq_close test plan: - 1. Create pipes to communicate with child process - 2. Fork, child waits for command on pipe - 3. Create and open message queue, set up notification, sends command - 4. Child opens message queue and tries to set up notification, sends command - 5. Parent closes the queue, sends command - 6. Child tries again to set up notification (should succeed verifying that - the close successfully removed notify association), sends command - 7. Parent reports result -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "mq_close" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define PIPE_READ 0 -#define PIPE_WRITE 1 - -int parent_process(char *qname, int read_pipe, int write_pipe, int child_pid); -int child_process(char *qname, int read_pipe, int write_pipe); -mqd_t open_queue(char *qname, int oflag, int mode); -int send_receive(int read_pipe, int write_pipe, char send, char *reply); - -int main() -{ - char qname[50]; - pid_t pid; - int rval; - int to_parent[2]; - int to_child[2]; - struct sigaction sa; - - sprintf(qname, "/" FUNCTION "_" TEST "_%d", getpid()); - - rval = pipe(to_parent); - if (rval == -1) { - perror(ERROR_PREFIX "pipe (1)"); - return PTS_UNRESOLVED; - } - - rval = pipe(to_child); - if (rval == -1) { - perror(ERROR_PREFIX "pipe (2)"); - return PTS_UNRESOLVED; - } - - sa.sa_handler = SIG_IGN; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - sigaction(SIGCHLD, &sa, NULL); - - pid = fork(); - if (pid == -1) { - perror(ERROR_PREFIX "fork"); - return PTS_UNRESOLVED; - } - if (pid == 0) { - // child process - close(to_parent[PIPE_READ]); - close(to_child[PIPE_WRITE]); - - return child_process(qname, to_child[PIPE_READ], - to_parent[PIPE_WRITE]); - } else { - // parent process - close(to_parent[PIPE_WRITE]); - close(to_child[PIPE_READ]); - - return parent_process(qname, to_parent[PIPE_READ], - to_child[PIPE_WRITE], pid); - } - - return PTS_UNRESOLVED; -} - -int parent_process(char *qname, int read_pipe, int write_pipe, int child_pid) -{ - mqd_t queue; - struct sigevent se; - int rval; - char reply; - - queue = open_queue(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); - if (queue == (mqd_t)-1) { - return PTS_UNRESOLVED; - } - - se.sigev_notify = SIGEV_SIGNAL; - se.sigev_signo = SIGUSR1; - - if (mq_notify(queue, &se)) { - perror(ERROR_PREFIX "mq_notify (1)"); - mq_close(queue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } - - // send 'a' - signal child to verify it can't call notify - rval = send_receive(read_pipe, write_pipe, 'a', &reply); - if (rval) { - mq_close(queue); - mq_unlink(qname); - return rval; - } - - if (reply != 'b') { - puts(ERROR_PREFIX "send_receive: " - "expected a 'b'"); - mq_close(queue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } - - // close the queue to perform test - rval = mq_close(queue); - mq_unlink(qname); - if (rval) { - perror(ERROR_PREFIX "mq_close:"); - return PTS_UNRESOLVED; - } - // send 'c' - signal child to verify it can call notify - rval = send_receive(read_pipe, write_pipe, 'c', &reply); - if (rval) { - return rval; - } - - if (reply == 'd') { - puts("Test PASSED"); - return PTS_PASS; - } else if (reply == 'e') { - puts("Test FAILED"); - return PTS_FAIL; - } else { - puts(ERROR_PREFIX "bad reply from child"); - return PTS_UNRESOLVED; - } -} - -int child_process(char *qname, int read_pipe, int write_pipe) -{ - mqd_t queue; - struct sigevent se; - char reply; - int rval; - - // wait for 'a' signal from parent - rval = send_receive(read_pipe, write_pipe, 0, &reply); - if (rval) { - return rval; - } - - if (reply != 'a') { - puts(ERROR_PREFIX "send_receive: " - "expected an 'a'"); - return PTS_UNRESOLVED; - } - - // open the queue and attempt to set up notification - queue = open_queue(qname, O_RDWR, 0); - if (queue == (mqd_t)-1) { - return PTS_UNRESOLVED; - } - - // try notify while parent still has queue open - should fail - se.sigev_notify = SIGEV_SIGNAL; - if (!mq_notify(queue, &se)) { - puts(ERROR_PREFIX "mq_notify (2): " - "should have failed"); - return PTS_UNRESOLVED; - } - - // send 'b' - signal parent to close queue - rval = send_receive(read_pipe, write_pipe, 'b', &reply); - if (rval) { - return rval; - } - - if (reply != 'c') { - puts(ERROR_PREFIX "send_receive: " - "expected a 'c'"); - return PTS_UNRESOLVED; - } - - // try notify after parent closed queue - should succeed - se.sigev_notify = SIGEV_SIGNAL; - se.sigev_signo = 0; - rval = mq_notify(queue, &se); - - // send 'd' for success and 'e' for failure - send_receive(read_pipe, write_pipe, rval ? 'e':'d', NULL); - - return 0; -} - -mqd_t open_queue(char *qname, int oflag, int mode) { - mqd_t queue; - - queue = mq_open(qname, oflag, mode, NULL); - if (queue == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - } - - return queue; -} - -int send_receive(int read_pipe, int write_pipe, char send, char *reply) { - ssize_t bytes; - - if (send) { - bytes = write(write_pipe, &send, 1); - if (bytes == -1) { - perror(ERROR_PREFIX "write (1)"); - return PTS_UNRESOLVED; - } - } - - if (reply) { - bytes = read(read_pipe, reply, 1); - if (bytes == -1) { - perror(ERROR_PREFIX "read"); - return PTS_UNRESOLVED; - } else if (bytes == 0) { - puts(ERROR_PREFIX "read: EOF"); - return PTS_UNRESOLVED; - } - } - - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/3-1.c deleted file mode 100644 index 3751ec0d2a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/3-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - mq_close test plan: - 1. Create a new message queue - 2. Close the message queue, verify success - 3. Attempt to close the same descriptor again, and verify that mq_close - returns EBADF -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-1" -#define FUNCTION "mq_close" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -int main() -{ - char qname[50]; - mqd_t queue; - - sprintf(qname, "/" FUNCTION "_" TEST "_%d", getpid()); - - queue = mq_open(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - - if (mq_close(queue) == -1) { - perror(ERROR_PREFIX "mq_close"); - mq_unlink(qname); - return PTS_UNRESOLVED; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_close(queue) != -1) { - printf("mq_close() did not return failure\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (errno != EBADF) { - printf("errno != EBADF\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/3-2.c deleted file mode 100644 index 86910e8c5c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/3-2.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - mq_close test plan: - Attempt to close a invalid descriptor and verify that returns - the correct error. - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - if (mq_close((mqd_t)-1) != -1) { - printf("mq_close() did not return -1 on invalid descriptor\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (errno != EBADF) { - printf("errno != EBADF on invalid descriptor\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/3-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/3-3.c deleted file mode 100644 index f27d617136..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/3-3.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - mq_close test plan: - Attempt to close a invalid descriptor and verify that returns - the correct error. - */ - -/* Note: Add a new test case. Use a large number as fd. Idea from - * Drepper's patch */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - /* Use some arbitrary but high number for the descriptor. */ - if (mq_close((mqd_t)274) != -1) { - printf("mq_close() did not return -1 on invalid descriptor\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (errno != EBADF) { - printf("errno != EBADF on invalid descriptor\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/4-1.c deleted file mode 100644 index 4935ed5c44..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/4-1.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - Test that a closed message queue descriptor has been disassociated from - its message queue by attempting to set a notification on the descriptor - and verifying that mq_notify returns -1 and sets errno to EBADF - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "mq_close" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -int main() -{ - char qname[50]; - mqd_t queue; - struct sigevent se; - - sprintf(qname, "/" FUNCTION "_" TEST "_%d", getpid()); - - queue = mq_open(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - - if (mq_close(queue) == -1) { - perror(ERROR_PREFIX "mq_close"); - return PTS_UNRESOLVED; - } - - se.sigev_notify = SIGEV_SIGNAL; - se.sigev_signo = SIGUSR1; - - if (mq_notify(queue, &se) != -1) { - printf("mq_notify() did not fail as expected\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (errno != EBADF) { - printf("errno != EBADF\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/5-1.c deleted file mode 100644 index 4b8aa4e872..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/5-1.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: geoffrey.r.gustafson REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Since it is undefined what will happen if mqdes is used after - * mq_close() is successfully called and mq_open() has not been - * called again, this will not be tested. (Eventually, this could - * be a speculative test) - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Functionality of using mqdes after mq_close() and before\n"); - printf("mq_open() will not be tested as POSIX says this is "); - printf("undefined.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/assertions.xml deleted file mode 100644 index 599bf4e9d2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/assertions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - -mq_close will return zero after successful completion. - - -All notification requests that have been successfully attached to -the message queue through the descriptor being closed will be removed, -so another process will be able to set up notification. - - -Calling mq_close with an invalid descriptor will result in a -mq_close returning -1 and errno being set to EBADF. - - -mq_close removes the association between the descriptor being closed and -the message queue it represents. - - -It is undefined what will happen if mqdes is used after mq_close() is -successfully called and mq_open() has not been called again. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/coverage.txt deleted file mode 100644 index 9a276e9682..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_close/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the mq_close function. - -ASSERTION COVERED? -1 YES -2 YES -3 YES -4 YES -5 WON'T - will not cover as this is undefined behavior diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/1-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/1-1.sh deleted file mode 100755 index 7bbbc11c4d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/1-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# mq_getattr will get status infomation and attributes of message queue. -# The result will return in mqstat argument. - -# This is tested implicitly via assertion 2,3,4. - -echo "Tested implicitly via assertion 2,3,4. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/2-1.c deleted file mode 100644 index 6c7ad29c69..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/2-1.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ -/* - * mq_getattr() test plan: - * mq_getattr gets mq_flags which is set when message queue - * was opened. - * - * 3/27/2003 Fixed a bug pointed out by Krzysztof Benedyczak. - * mq_getattr returns ALL flags not only those set by - * mq_setattr. So there should not be setting using - * "mqstat.mq_flags == MQFLAGS, so change to - * "!(mqstat.mq_flags & MQFLAGS)". - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "mq_getattr" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define MQFLAGS O_NONBLOCK - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct mq_attr mqstat; - int unresolved = 0; - int failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR | MQFLAGS, - S_IRUSR | S_IWUSR, NULL); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open()"); - return PTS_UNRESOLVED; - } - memset(&mqstat,0,sizeof(mqstat)); - if (mq_getattr(mqdes, &mqstat) != 0) { - perror(ERROR_PREFIX "mq_getattr"); - unresolved = 1; - } - mq_close(mqdes); - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink()"); - return PTS_UNRESOLVED; - } - if (!(mqstat.mq_flags & MQFLAGS)) { - printf("FAIL: mq_getattr didn't get the correct " - "mq_flags set by mq_open\n"); - failure = 1; - } - - if (failure == 1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved == 1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED \n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/2-2.c deleted file mode 100644 index 6d695cf794..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/2-2.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ -/* - * mq_getattr() test plan: - * mq_getattr gets mq_flags value, which is set by mq_setattr. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-2" -#define FUNCTION "mq_getattr" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define MQFLAGS O_NONBLOCK - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct mq_attr mqstat, nmqstat; - int unresolved = 0; - int failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open()"); - return PTS_UNRESOLVED; - } - memset(&mqstat,0,sizeof(mqstat)); - memset(&nmqstat,0,sizeof(nmqstat)); - if (mq_getattr(mqdes, &mqstat) == -1) { - perror(ERROR_PREFIX "mq_getattr"); - unresolved = 1; - } - mqstat.mq_flags |= MQFLAGS; - if (mq_setattr(mqdes, &mqstat, NULL) == -1) { - perror(ERROR_PREFIX "mq_setattr"); - failure = 1; - } - if (mq_getattr(mqdes, &nmqstat) != 0) { - perror(ERROR_PREFIX "mq_getattr"); - unresolved = 1; - } - if (nmqstat.mq_flags != mqstat.mq_flags) { - printf("FAIL: mq_getattr didn't get the correct mq_flags " - "set by mq_setattr \n"); - failure = 1; - } - - mq_close(mqdes); - mq_unlink(mqname); - - if (failure == 1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved == 1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED \n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/3-1.c deleted file mode 100644 index e755919738..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/3-1.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ -/* - * mq_getattr() test plan: - * mq_getattr gets mq_maxmsg, mq_msgsize, which are set when message queue - * was opened. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-1" -#define FUNCTION "mq_getattr" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define MAXMSG 40 -#define MSGSIZE 50 - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct mq_attr mqstat, nmqstat; - int unresolved = 0; - int failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - memset(&mqstat,0,sizeof(mqstat)); - mqstat.mq_msgsize = MSGSIZE; - mqstat.mq_maxmsg = MAXMSG; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &mqstat); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open()"); - return PTS_UNRESOLVED; - } - memset(&nmqstat,0,sizeof(nmqstat)); - if (mq_getattr(mqdes, &nmqstat) != 0) { - perror(ERROR_PREFIX "mq_getattr"); - unresolved = 1; - } - if ((mqstat.mq_maxmsg != nmqstat.mq_maxmsg) || - (mqstat.mq_msgsize != nmqstat.mq_msgsize)) { - printf("FAIL: mq_getattr didn't get the correct mq_maxmsg, " - "mq_msgsize set by mq_open\n"); - failure = 1; - } - - mq_close(mqdes); - mq_unlink(mqname); - - if (failure == 1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved == 1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED \n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/4-1.c deleted file mode 100644 index 212703eb2d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/4-1.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_getattr test plan: - * mq_getattr gets mq_curmsgs value, which will be returned as - * the number of the message currently on the queue. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "mq_getattr" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define MSG_NUM 5 -#define MSGSIZE 50 -#define MAXMSG 40 - -int main() -{ - char mqname[NAMESIZE]; - const char *msgptr = "test message"; - mqd_t mqdes; - struct mq_attr mqstat; - int i; - int unresolved=0, failure=0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - memset(&mqstat,0,sizeof(mqstat)); - mqstat.mq_msgsize = MSGSIZE; - mqstat.mq_maxmsg = MAXMSG; - mqdes = mq_open(mqname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &mqstat); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open()"); - return PTS_UNRESOLVED; - } - for (i = 0; i < MSG_NUM; i++) { - if (mq_send(mqdes, msgptr, strlen(msgptr), 1) == -1) { - perror(ERROR_PREFIX "mq_send()"); - unresolved = 1; - } - } - memset(&mqstat,0,sizeof(mqstat)); - if (mq_getattr(mqdes, &mqstat) != 0) { - perror(ERROR_PREFIX "mq_getattr"); - unresolved = 1; - } - else { - if (mqstat.mq_curmsgs != MSG_NUM) { - printf("mq_getattr didn't get the correct " - "mq_curmsgs \n"); - failure = 1; - } - } - - mq_close(mqdes); - mq_unlink(mqname); - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/5-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/5-1.sh deleted file mode 100755 index 4b82fdce91..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/5-1.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# mq_getattr() return 0 on success. - -# This is tested implicitly via assertion 2,3,4. - -echo "Tested implicitly via assertion 2,3,4. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/6-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/6-1.sh deleted file mode 100755 index d491fdc3b7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/6-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# If mq_getattr() is not sucessful, the function will return -1 -# and set errno to indicate the error. - -# This is tested implicitly via assertion 7. - -echo "Tested implicitly via assertion 7. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/assertions.xml deleted file mode 100644 index 48d0199770..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/assertions.xml +++ /dev/null @@ -1,24 +0,0 @@ - - -mq_getattr will get status infomation and attributes of message queue. -The result will return in mqstat argument. - - -mq_getattr gets mq_flags value, which is set when message queue was opened and can be modified by mq_setattr calls. - - -mq_getattr gets mq_maxmsg, mq_msgsize value, which will be returned when message queue was opened. - - -mq_getattr gets mq_curmsgs value, which will be returned as the number of the message currently on the queue. - - -mq_getattr will return 0 on success. - - -mq_getattr shall return -1 and set errno to indicate the error. - - -mq_getattr may fail with EBADF if the mqdes is not a valid message message queue descriptor. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/coverage.txt deleted file mode 100644 index 5c62378995..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/coverage.txt +++ /dev/null @@ -1,10 +0,0 @@ -This document defines the coverage for the mq_getattr function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/speculative/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/speculative/7-1.c deleted file mode 100644 index 6e628fe434..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_getattr/speculative/7-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ -/* - * mq_getattr() test plan: - * Test if mqdes argument is not a valid message queue descriptor, - * mq_getattr() function may fail with EBADF, and the function will - * return a value of -1. - * Since this is a "may" assertion either option will be a pass. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "7-1" -#define FUNCTION "mq_getattr" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct mq_attr mqstat; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open()"); - return PTS_UNRESOLVED; - } - mqdes = mqdes + 1; - memset(&mqstat,0,sizeof(mqstat)); - if (mq_getattr(mqdes, &mqstat) == -1) { - if (EBADF != errno) { - printf("fcn returned -1, but errno != EBADF \n"); - printf("Test FAILED \n"); - return PTS_FAIL; - } - } else { - printf("fcn returned success\n"); - return PTS_PASS; - } - printf("fcn returned -1 and errno == EBADF\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/1-1.c deleted file mode 100644 index 80da1d8f37..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/1-1.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_notify() test plan: - * If the argument notification is not NULL, it will register the - * calling process to be notified of message arrival at an empty - * message queue. The notification will be sent to the process when - * the message queue transitions from empty to non-empty. - * - * 4/11/2003 change sa_flags from SA_RESTART to 0 to avoid compile - * error. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "mq_notify" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define MSG_SIZE 50 - -int enter_handler = 0; - -void msg_handler() -{ - enter_handler = 1; -} - -void mqclean(mqd_t queue, const char *qname) -{ - mq_close(queue); - mq_unlink(qname); -} - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - const char s_msg_ptr[MSG_SIZE] = "test message \n"; - struct sigevent notification; - struct sigaction sa; - unsigned int prio = 1; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - - notification.sigev_notify = SIGEV_SIGNAL; - notification.sigev_signo = SIGUSR1; - sa.sa_handler = msg_handler; - sa.sa_flags = 0; - sigaction(SIGUSR1, &sa, NULL); - if (mq_notify(mqdes, ¬ification) != 0) { - printf("Test FAILED \n"); - mqclean(mqdes, mqname); - return PTS_FAIL; - } - if (mq_send(mqdes, s_msg_ptr, MSG_SIZE, prio) == -1) { - perror(ERROR_PREFIX "mq_send"); - mqclean(mqdes, mqname); - return PTS_UNRESOLVED; - } - sleep(1); - if (!enter_handler) { - printf("Test FAILED \n"); - mqclean(mqdes, mqname); - return PTS_FAIL; - } - else { - printf("Test PASSED \n"); - mqclean(mqdes, mqname); - return PTS_PASS; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/2-1.c deleted file mode 100644 index de86758379..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/2-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_notify() test plan: - * Only one process may be registerd for notification by a message queue. - * If the calling process or other process has already registered for the - * notification, subsequent attempts to register for that message queue - * will fail. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "mq_notify" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 - -void mqclean(mqd_t queue, const char *qname) -{ - mq_close(queue); - mq_unlink(qname); -} - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct sigevent notification; - int pid; - int status; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - - notification.sigev_notify = SIGEV_SIGNAL; - notification.sigev_signo = SIGUSR1; - if (mq_notify(mqdes, ¬ification) != 0) { - printf("Test FAILED \n"); - mqclean(mqdes, mqname); - return PTS_FAIL; - } - pid = fork(); - if (pid == -1) { - perror(ERROR_PREFIX "fork"); - mqclean(mqdes, mqname); - return PTS_UNRESOLVED; - } - if (pid == 0) { - /* child process */ - if (mq_notify(mqdes, ¬ification) != -1) { - printf("Test FAILED \n"); - return PTS_FAIL; - } - else { - printf("Test PASSED \n"); - return PTS_PASS; - } - } - else { - /* parent process */ - wait(&status); - mqclean(mqdes, mqname); - return status; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/3-1.c deleted file mode 100644 index dbe813ab89..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/3-1.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_notify() test plan: - * If the notification is NULL and the process is currently registered - * for notification by the specified message queue, the existing registration - * will be removed. - * - * 4/11/2003 change sa_flags from SA_RESTART to 0 to avoid compile - * error. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-1" -#define FUNCTION "mq_notify" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define MSG_SIZE 50 -#define NAMESIZE 50 - -int enter_handler = 0; - -void msg_handler() -{ - enter_handler = 1; -} - -void mqclean(mqd_t queue, const char *qname) -{ - mq_close(queue); - mq_unlink(qname); -} - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - const char s_msg_ptr[MSG_SIZE] = "test message \n"; - struct sigevent notification; - struct sigaction sa; - unsigned int prio = 1; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - notification.sigev_notify = SIGEV_SIGNAL; - notification.sigev_signo = SIGUSR1; - sa.sa_handler = msg_handler; - sa.sa_flags = 0; - sigaction(SIGUSR1, &sa, NULL); - if (mq_notify(mqdes, ¬ification) != 0) { - perror(ERROR_PREFIX "mq_notify"); - mqclean(mqdes, mqname); - return PTS_UNRESOLVED; - } - if (mq_notify(mqdes, NULL) != 0 ) { - printf("Test FAILED \n"); - mqclean(mqdes, mqname); - return PTS_FAIL; - } - if (mq_send(mqdes, s_msg_ptr, MSG_SIZE, prio) == -1) { - perror(ERROR_PREFIX "mq_send"); - mqclean(mqdes, mqname); - return PTS_UNRESOLVED; - } - sleep(1); - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - return PTS_UNRESOLVED; - } - if (!enter_handler) { - printf("Test PASSED \n"); - mqclean(mqdes, mqname); - return PTS_PASS; - } - else { - printf("Test FAILED \n"); - mqclean(mqdes, mqname); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/4-1.c deleted file mode 100644 index f48c8c52c8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/4-1.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_notify() test plan: - * If the notification is sent to the registered process, its registration - * will be removed, then, the message queue will be available for - * next registration. - * - * 4/11/2003 change sa_flags from SA_RESTART to 0 to avoid compile - * error. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "mq_notify" -#define MSG_SIZE 50 -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -int enter_handler = 0; - -void msg_handler() -{ - enter_handler = 1; -} - -void mqclean(mqd_t queue, const char *qname) -{ - mq_close(queue); - mq_unlink(qname); -} -int main() -{ - char mqname[50]; - mqd_t mqdes; - const char s_msg_ptr[MSG_SIZE] = "test message \n"; - struct sigevent notification; - struct sigaction sa; - unsigned int prio = 1; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - - notification.sigev_notify = SIGEV_SIGNAL; - notification.sigev_signo = SIGUSR1; - sa.sa_handler = msg_handler; - sa.sa_flags = 0; - sigaction(SIGUSR1, &sa, NULL); - if (mq_notify(mqdes, ¬ification) != 0) { - perror(ERROR_PREFIX "mq_notify"); - mqclean(mqdes, mqname); - return PTS_UNRESOLVED; - } - if (mq_send(mqdes, s_msg_ptr, MSG_SIZE, prio) == -1) { - perror(ERROR_PREFIX "mq_send"); - mqclean(mqdes, mqname); - return PTS_UNRESOLVED; - } - if (!enter_handler) { - perror(ERROR_PREFIX "mq_notify"); - mqclean(mqdes, mqname); - return PTS_UNRESOLVED; - } - if (mq_notify(mqdes, ¬ification) != 0) { - printf("Test FAILED \n"); - mqclean(mqdes, mqname); - return PTS_FAIL; - } - else { - printf("Test PASSED \n"); - mqclean(mqdes, mqname); - return PTS_PASS; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/5-1.c deleted file mode 100644 index f35046f080..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/5-1.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_notify() test plan: - * If a process has registered for notification of message arrival - * at a message queue, while some thread is blocked in mq_receive - * waiting to receive a message, the arriving message should satisfy - * the appropriate mq_receive(). In this case, no notification will - * be sent. - * NOTE: The test makes some assumptions and has some potential race - * conditions, but seems the best way to test for now. - * - * 3/28/2003 Fix a bug mentioned by Michal Wronski, pass mq_attr struct - * to the mq_open(). - * - * 4/11/2003 change sa_flags from SA_RESTART to 0 to avoid compile - * error. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-1" -#define FUNCTION "mq_notify" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define MSG_SIZE 40 -#define BUFFER 40 - -int enter_handler = 0; - -void msg_handler() -{ - enter_handler = 1; -} - -void mqclean(mqd_t queue, const char *qname) -{ - mq_close(queue); - mq_unlink(qname); -} - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - const char s_msg_ptr[MSG_SIZE] = "test message \n"; - char r_msg_ptr[MSG_SIZE]; - struct sigevent notification; - struct sigaction sa; - unsigned int prio = 1; - int pid; - struct mq_attr attr; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - mqclean(mqdes, mqname); - return PTS_UNRESOLVED; - } - - pid = fork(); - if (pid == -1) { - perror(ERROR_PREFIX "fork"); - mqclean(mqdes, mqname); - return PTS_UNRESOLVED; - } - if (pid == 0) { - /* child process */ - mq_receive(mqdes, r_msg_ptr, MSG_SIZE, NULL); - return 0; - } - else { - /* parent process */ - sleep(2); /* after 2 seconds, - assume that child with block on mq_receive. */ - notification.sigev_notify = SIGEV_SIGNAL; - notification.sigev_signo = SIGUSR1; - sa.sa_handler = msg_handler; - sa.sa_flags = 0; - sigaction(SIGUSR1, &sa, NULL); - if (mq_notify(mqdes, ¬ification) != 0) { - perror(ERROR_PREFIX "mq_notify"); - return PTS_UNRESOLVED; - } - if (mq_send(mqdes, s_msg_ptr, MSG_SIZE, prio) == -1) { - perror(ERROR_PREFIX "mq_send"); - return PTS_UNRESOLVED; - } - sleep(1); - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - return PTS_UNRESOLVED; - } - if (enter_handler) { - printf("Test FAILED \n"); - return PTS_FAIL; - } - printf("Test PASSED \n"); - mqclean(mqdes, mqname); - return PTS_PASS; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/6-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/6-1.sh deleted file mode 100755 index 84c21e0b25..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/6-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test if mq_notify is success, mq_notify will return a value of 0. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/7-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/7-1.sh deleted file mode 100755 index 581a77b402..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/7-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test if mq_notify fails, it will return a value of -1 and set -# errno to indicate the error. - -# This is tested implicitly via assertion 8,9. - -echo "Tested implicitly via assertion 8,9. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/8-1.c deleted file mode 100644 index 0497df7b94..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/8-1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_notify() test plan: - * mq_notify() will fail with EBADF if the mqdes argument is not a - * valid message queue descriptor. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "8-1" -#define FUNCTION "mq_notify" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 - -void mqclean(mqd_t queue, const char *qname) -{ - mq_close(queue); - mq_unlink(qname); -} - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct sigevent notification; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open()"); - return PTS_UNRESOLVED; - } - mqdes = mqdes + 1; - - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink()"); - return PTS_UNRESOLVED; - } - - notification.sigev_notify = SIGEV_SIGNAL; - notification.sigev_signo = SIGUSR1; - - if (mq_notify(mqdes, ¬ification) == -1) { - if (EBADF == errno) { - printf("Test PASSED \n"); - mqclean(mqdes, mqname); - return PTS_PASS; - } - else { - printf("errno != EBADF \n"); - mqclean(mqdes, mqname); - printf("Test FAILED \n"); - return PTS_FAIL; - } - } - else { - printf("Test FAILED \n"); - mqclean(mqdes, mqname); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/9-1.c deleted file mode 100644 index ed72727f08..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/9-1.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_notify() test plan: - * mq_notify will fail with EBUSY if a process is already registered for - * notification by the message queue. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "9-1" -#define FUNCTION "mq_notify" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 - -void mqclean(mqd_t queue, const char *qname) -{ - mq_close(queue); - mq_unlink(qname); -} - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct sigevent notification; - int pid; - int status; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - - notification.sigev_notify = SIGEV_SIGNAL; - notification.sigev_signo = SIGUSR1; - if (mq_notify(mqdes, ¬ification) != 0) { - printf("Test FAILED \n"); - mqclean(mqdes, mqname); - return PTS_FAIL; - } - pid = fork(); - if (pid == -1) { - perror(ERROR_PREFIX "fork"); - mqclean(mqdes, mqname); - return PTS_UNRESOLVED; - } - if (pid == 0) { - //child process - if (mq_notify(mqdes, ¬ification) == -1) { - if (EBUSY == errno) { - printf("Test PASSED \n"); - return PTS_PASS; - } - else { - printf("errno != EBUSY \n"); - printf("Test FAILED \n"); - return PTS_FAIL; - } - } - else { - printf("Test FAILED \n"); - return PTS_FAIL; - } - } - else { - //parent process - wait(&status); - mqclean(mqdes, mqname); - return status; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/assertions.xml deleted file mode 100644 index c9c6690221..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/assertions.xml +++ /dev/null @@ -1,42 +0,0 @@ - - -If notification is not NULL, this function will register the calling proces to -be notified of message arrival. The notification will be sent to the process -when the message queue transit from empty to non-empty. - - -Only one process may be registerd for notification of message arrival at any -time, other process attempts to register for that message queue shall fail. - - -If notification is NULL and the process is currently registered for -notification by the specified message queue, the existing registration shall -be removed. - - -If the notification is sent to the registered process, its registration shall -be removed. The message queue shall be available for next registration. - - -If a process is registered for notification of message arrival at a message -queue and some thread is blocked in mq_receive() waiting to receive a -message, the arriving message shall satisfy the appropriate mq_receive(). -The resulting behavior is as if the message queue remains empty, no -notification shall be sent. - - -If mq_notify is successful, it will return a value of zero. - - -If mq_notify is not successful, it will return a value of -1 and set errno -to indicate the error. - - -mq_notify will fail with EBADF if mqdes argument is not a valid messsage -queue descriptor. - - -mq_notify will fail with EBUSY if a process is already registered for -notification by the message queue. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/coverage.txt deleted file mode 100644 index 398207c4af..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_notify/coverage.txt +++ /dev/null @@ -1,12 +0,0 @@ -This document defines the coverage for the mq_notify function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES -8 YES -9 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/1-1.c deleted file mode 100644 index 7c13af6bca..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/1-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Basic test that mq_open() returns a valid message descriptor. - * Test by calling mq_open() and then verifying that that descriptor can - * be used to call mq_send(). - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - mqd_t queue; - int failure=0; - - sprintf(qname, "/mq_open_1-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (mq_send(queue, msgptr, strlen(msgptr), 1) != 0) { - perror("mq_send() did not return success"); - failure=1; - } - - mq_close(queue); - mq_unlink(qname); - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/10-1.c deleted file mode 100644 index a367a37cba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/10-1.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Will not test the user ID and group ID of the message queue as would - * need multiple users/groups for setup to test. - * - * Will also not test the file permissions as the implementation of the - * message queue is TBD and so it would not be possible to know how to - * check the file permissions. - * - * Will not test what happens if non-file permission bits are set as that - * is undefined. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the user ID and group ID of a created\n"); - printf("message queue as we would need multiple users and\n"); - printf("groups on the system to test.\n"); - printf("Will not test the file permissions as testing would\n"); - printf("be implementation defined.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/11-1.c deleted file mode 100644 index 2c3c834a78..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/11-1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if O_CREAT is set and name has already been used to create - * a currently existing message queue, then the current call has no effect. - * - * Just test by calling O_CREAT again and ensure mq_send works again (i.e., - * Basically just testing that using O_CREAT twice doesn't break anything. - * Otherwise, this assertion is basically untestable.) - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - mqd_t queue, queue2; - - sprintf(qname, "/mq_open_11-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (mq_send(queue, msgptr, strlen(msgptr), 1) != 0) { - perror("mq_send() first time did not return success"); - printf("Test UNRESOLVED\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } - - /* - * Second call should have no effect - */ - queue2 = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue2 == (mqd_t)-1) { - perror("mq_open() second time did not return success"); - printf("Test FAILED\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - - if (mq_send(queue2, msgptr, strlen(msgptr), 1) != 0) { - perror("mq_send() did not return success second time"); - printf("Test FAILED\n"); - mq_close(queue); - mq_close(queue2); - mq_unlink(qname); - return PTS_FAIL; - } - - mq_close(queue); - mq_close(queue2); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/12-1.c deleted file mode 100644 index f17e3fec48..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/12-1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if O_CREAT is set and attr == NULL, implementation defined - * attributes are used. - * - * Just test that mq_getattr() can be called after mq_open() is called - * with attr == NULL. - * - * Otherwise, this really cannot be tested as attributes are implementation- - * defined. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue; - struct mq_attr attr; - - sprintf(qname, "/mq_open_12-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (mq_getattr(queue, &attr) != 0) { - perror("mq_getattr() failed"); - printf("Test FAILED -- could not get attributes\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - - mq_close(queue); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/13-1.c deleted file mode 100644 index ed28a6657e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/13-1.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if O_CREAT is set and attr != NULL, then mq_maxmsg and - * mq_msgsize are as defined in attr. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MAXMSG 10 -#define MSGSIZE 5 - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue; - struct mq_attr attr; - struct mq_attr attrget; - - sprintf(qname, "/mq_open_13-1_%d", getpid()); - - attr.mq_maxmsg = MAXMSG; - attr.mq_msgsize = MSGSIZE; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (mq_getattr(queue, &attrget) != 0) { - perror("mq_getattr() failed"); - printf("Test FAILED -- could not get attributes\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - - if ((attrget.mq_maxmsg != attr.mq_maxmsg) || - (attrget.mq_msgsize != attr.mq_msgsize)) { - printf("sent: mq_maxmsg %ld; received %ld\n", attr.mq_maxmsg, - attrget.mq_maxmsg); - printf("sent: mq_msgsize %ld; received %ld\n", attr.mq_msgsize, - attrget.mq_msgsize); - printf("Test FAILED -- attributes do not match\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - - mq_close(queue); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/14-1.c deleted file mode 100644 index c02d1d84d1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/14-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Will not test calling process privileges on name as POSIX does not - * define when this error occurs. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test calling process privileges on name\n"); - printf("as POSIX does not define when this error occurs.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/15-1.c deleted file mode 100644 index acb6216cf2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/15-1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if O_EXCL and O_CREAT are set and message queue name already - * exists, mq_open() fails. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue, queue2; - - sprintf(qname, "/mq_open_15-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - /* - * Open queue qname again with O_CREAT and O_EXCL set - */ - queue2 = mq_open(qname, O_CREAT |O_EXCL|O_RDWR, - S_IRUSR | S_IWUSR, NULL); - if (queue2 != (mqd_t)-1) { - printf("mq_open() should have failed with O_CREAT and \n"); - printf("O_EXCL on an already opened queue.\n"); - printf("Test FAILED\n"); - mq_close(queue); - mq_close(queue2); - mq_unlink(qname); - return PTS_FAIL; - } - - mq_close(queue); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/16-1.c deleted file mode 100644 index 14d901fa41..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/16-1.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that tests to check if O_CREAT and O_EXCL are set that no other - * message queue exists are atomic. - * - * Test case will just attempt to call mq_open() with O_CREAT and O_EXCL - * using the same name in two different processes. If one process fails, - * the test is considered a pass. - * - * This is a best attempt to test that these are atomic. It does make the - * assumption (which could generally be untrue) that both mq_open() calls - * will attempt to be made at the same time. For the sake of this test case, - * this is fine (will have some false positives, but no false negatives). - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - int pid, succeeded=0; - mqd_t childqueue, queue; - - /* - * initialize both queues - */ - childqueue = (mqd_t)-1; - queue = (mqd_t)-1; - - sprintf(qname, "/mq_open_16-1_%d", getpid()); - - if ((pid = fork()) == 0) { - sigset_t mask; - int sig; - - /* child here */ - - /* try to sync with parent for mq_open*/ - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigprocmask(SIG_BLOCK,&mask,NULL); - sigwait(&mask, &sig); - - childqueue = mq_open(qname, O_CREAT|O_EXCL|O_RDWR, - S_IRUSR | S_IWUSR, NULL); - if (childqueue != (mqd_t)-1) { - succeeded++; -#ifdef DEBUG - printf("mq_open() in child succeeded\n"); - } else { - printf("mq_open() in child failed\n"); -#endif - } - } else { - /* parent here */ - int i; - - sleep(1); - kill(pid, SIGUSR1); //tell child ready to call mq_open - - queue = mq_open(qname, O_CREAT | O_EXCL |O_RDWR, - S_IRUSR | S_IWUSR, NULL); - if (queue != (mqd_t)-1) { - succeeded++; -#ifdef DEBUG - printf("mq_open() in parent succeeded\n"); - } else { - printf("mq_open() in parent failed\n"); -#endif - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit"); - printf("Test UNRESOLVED\n"); - mq_close(queue); - mq_close(childqueue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } - - mq_close(queue); - mq_close(childqueue); - mq_unlink(qname); - - if (succeeded==0) { - printf("Test FAILED - mq_open() never succeeded\n"); - return PTS_FAIL; - } - - if (succeeded>1) { - printf("Test FAILED - mq_open() succeeded twice\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; - } - - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/17-1.c deleted file mode 100644 index 1c615f75ef..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/17-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Will not test setting O_EXCL without O_CREAT because results are - * undefined. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test setting O_EXCL without O_CREAT because\n"); - printf("results are undefined.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/18-1.c deleted file mode 100644 index 7446b7a572..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/18-1.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Basic test that O_NONBLOCK can be set. The functionality of O_NONBLOCK - * is tested in the mq_send and mq_receive test cases. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "O123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - mqd_t queue; - - sprintf(qname, "/mq_open_18-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR | O_NONBLOCK, - S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success w/O_NONBLOCK set"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (mq_send(queue, msgptr, strlen(msgptr), 1) != 0) { - perror("mq_send() did not return success"); - printf("Test FAILED\n"); - /* close queue and exit */ - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - - mq_close(queue); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/19-1.c deleted file mode 100644 index d1cf208dc9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/19-1.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_open() does not add messages to the queue or remove - * messages from the queue. - * - * Test using mq_send and mq_receive: - * - Call mq_open() for non-blocking queue - * - Verify mq_receive() fails (because nothing should be in the queue yet) - * - Call mq_send() to put something in the queue - * - Call mq_open() again for non-blocking queue - * - Verify mq_receive() now succeeded (because the sent message should - * still be in the queue). - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - mqd_t queue; - struct mq_attr attr; - int failure=0; - unsigned pri; - - sprintf(qname, "/mq_open_19-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - - queue = mq_open(qname, O_CREAT |O_RDWR|O_NONBLOCK, - S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) != -1) { - printf("mq_receive() succeded\n"); - printf("mq_open() may have placed a message in the queue\n"); - failure=1; - } - - if (mq_send(queue, msgptr, strlen(msgptr), 1) == -1) { - perror("mq_send() did not return success"); - printf("Test UNRESOLVED\n"); - /* close queue and exit */ - mq_close(queue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } - - queue = mq_open(qname, O_RDWR|O_NONBLOCK, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() second time did not return success"); - printf("Test UNRESOLVED\n"); - /* close queue and exit */ - mq_close(queue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() failed"); - printf("mq_open() may have removed a msg from the queue\n"); - failure=1; - } - - mq_close(queue); - mq_unlink(qname); - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/2-1.c deleted file mode 100644 index 586c1a7fcb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/2-1.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if the first letter of name is "/", any other processes - * calling the message queue with that name will refer to the same - * message queue object. - * - * Test by creating a message queue and placing a message within it. Then, - * in another process open the first message queue and ensure the message - * can be received. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -void handler(int signo) -{ - return; -} - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - int pid, ret; - - sprintf(qname, "/mq_open_2-1_%d", getpid()); - - if ((pid = fork()) == 0) { - mqd_t childqueue; - char msgrcd[BUFFER]; - sigset_t mask; - struct mq_attr attr; - struct sigaction act; - int sig; - unsigned pri; - - /* child here */ - - /* Set up handler for SIGUSR1 */ - act.sa_handler = handler; - act.sa_flags = 0; - sigaction(SIGUSR1, &act, NULL); - - /* wait for parent to finish mq_open */ - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigprocmask(SIG_BLOCK,&mask,NULL); - sigwait(&mask, &sig); - - /* now that parent has finished, open qname */ - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - childqueue = mq_open(qname, O_RDWR, - S_IRUSR | S_IWUSR, &attr); - if (childqueue == (mqd_t)-1) { - perror("mq_open() did not return success in child"); - return CHILDFAIL; - } - - if ((ret=mq_receive(childqueue, msgrcd, BUFFER, &pri)) == -1) { - perror("mq_receive() returned failure in child"); - return CHILDFAIL; - } - - if (strcmp(msgptr, msgrcd) != 0) { - printf("FAIL: sent %s received %s\n", msgptr, msgrcd); - return CHILDFAIL; - } -#ifdef DEBUG - printf("Received message %s\n", msgrcd); -#endif - return CHILDPASS; - } else { - /* parent here */ - mqd_t queue; - int i; - struct mq_attr attr; - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - queue = mq_open(qname, O_CREAT |O_RDWR, - S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - /* stop child and exit */ - kill(pid, SIGABRT); - return PTS_UNRESOLVED; - } - - if (mq_send(queue, msgptr, strlen(msgptr)+1, 1) != 0) { - perror("mq_send() did not return success"); - printf("Test UNRESOLVED\n"); - /* close queue, stop child and exit */ - mq_close(queue); - mq_unlink(qname); - kill(pid, SIGABRT); - return PTS_UNRESOLVED; - } - - sleep(1); //Give the child time to breath - kill(pid, SIGUSR1); //tell child mq_open and mq_send finished - - if (wait(&i) == -1) { - perror("Error waiting for child to exit"); - /* close queue and exit */ - printf("Test UNRESOLVED\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } - - mq_close(queue); - mq_unlink(qname); - - if (!WIFEXITED(i) || !WEXITSTATUS(i)) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; - } - - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/20-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/20-1.c deleted file mode 100644 index ad3ca100c2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/20-1.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Another basic test that mq_open() returns a valid message queue - * descriptor on success. - * - * Test as in 1-1.c. To make this different, call mq_notify on the - * message queue descriptor returned. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -void handler(int signo) -{ -#ifdef DEBUG - printf("in handler\n"); -#endif -} - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue; - struct sigevent ev; - struct sigaction act; - int failure=0; - - sprintf(qname, "/mq_open_20-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* set up notification */ - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGUSR1; - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGUSR1, &act, NULL); - if (mq_notify(queue, &ev) != 0) { - perror("mq_notify() did not return success"); - failure=1; - } - - mq_close(queue); - mq_unlink(qname); - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/21-1.c deleted file mode 100644 index c0f4730de7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/21-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if mq_open() is not successful, it will return (mqd_t)-1 - * and set errno to indicate the error. - * - * Error case used is when O_CREAT is not set and the named message - * queue does not exist. - * Test that errno is set will be part of assertion 29. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue; - - sprintf(qname, "/mq_open_21-1_%d", getpid()); - - queue = mq_open(qname, O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue != (mqd_t)-1) { - printf("mq_open() did not return (mqd_t)-1 on error\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/22-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/22-1.c deleted file mode 100644 index 3692c7a0fb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/22-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Will not test returning EACCESS when privileges are denied as POSIX does not - * define when this error occurs. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test returning EACCESS when privileges are denied\n"); - printf("as POSIX does not define when this error occurs.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/23-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/23-1.c deleted file mode 100644 index a493cc1c69..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/23-1.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_open() fails with EEXIST if O_CREAT and O_EXCL are set - * but the message queue already exists. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue, queue2; - - sprintf(qname, "/mq_open_23-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - /* - * Open queue qname again with O_CREAT and O_EXCL set - */ - queue2 = mq_open(qname, O_CREAT |O_EXCL|O_RDWR, - S_IRUSR | S_IWUSR, NULL); - if (queue2 != (mqd_t)-1) { - printf("mq_open() should have failed with O_CREAT and \n"); - printf("O_EXCL on an already opened queue.\n"); - printf("Test FAILED\n"); - mq_close(queue); - mq_close(queue2); - mq_unlink(qname); - return PTS_FAIL; - } - -#ifdef DEBUG - printf("mq_open() failed as expected\n"); -#endif - - if (errno != EEXIST) { - printf("errno != EEXIST\n"); - printf("Test FAILED\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - -#ifdef DEBUG - printf("errno == EEXIST\n"); -#endif - - mq_close(queue); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/24-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/24-1.c deleted file mode 100644 index 248108d6bc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/24-1.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Will not test mq_open() failing with EINTR since mq_open() does not have - * a blocking situation where we could predictably interrupt it with - * a signal. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test mq_open() being interrupted as it is\n"); - printf("not possible to predictably interrupt an mq_open().\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/25-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/25-1.c deleted file mode 100644 index 07866234d1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/25-1.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Will not test mq_open() failing with EINVAL if mq_open() is not - * supported for the name parameter as unsupported names are implementation - * defined. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test mq_open() failing with EINVAL if mq_open()\n"); - printf("is not supported for the name parameter as\n"); - printf("unsupported names are implementation defined.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/25-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/25-2.c deleted file mode 100644 index 630b7c53bf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/25-2.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_open() fails with EINVAL if O_CREAT was set in oflag, - * attr != NULL, and either mq_maxmsg <= 0 or mq_msgsize <= 0. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define VALIDVAL 10 - -#define NUMTESTS 3 - -static int invalid_values[NUMTESTS] = { 0, -1, INT32_MIN }; - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue; - struct mq_attr attr; - int i, failed=0; - - sprintf(qname, "/mq_open_25-1_%d", getpid()); - - // First, test for invalid maxmsg - attr.mq_msgsize = VALIDVAL; - for (i=0; i0) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/27-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/27-1.c deleted file mode 100644 index 4cd6ca323a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/27-1.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_open() fails with ENAMETOOLONG if the name parameter's - * length is greater than PATH_MAX. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - char qname[PATH_MAX*2]; - mqd_t queue; - int i; - - sprintf(qname, "/mq_open_27-1_%d", getpid()); - - //Ensures queue name will have > PATH_MAX chars - for(i=0;i -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - char qname[NAME_MAX*2]; - mqd_t queue; - int i; - - sprintf(qname, "/mq_open_27-1_%d", getpid()); - - //Ensures queue name will have > NAME_MAX chars - for(i=0;i -#include "posixtest.h" - -int main() -{ - printf("Will not test returning with ENFILE if the system has\n"); - printf("too many message queues as this is beyond this\n"); - printf("test's domain.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/29-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/29-1.c deleted file mode 100644 index 4ed344249b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/29-1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_open() fails with ENOENT if the named message queue does - * not yet exist, but O_CREAT is not set. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue; - - sprintf(qname, "/mq_open_29-1_%d", getpid()); - - queue = mq_open(qname, O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue != (mqd_t)-1) { - printf("mq_open() did not return mqd_t - on error\n"); - printf("Test FAILED\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - - if (errno != ENOENT) { - printf("errno != ENOENT\n"); - printf("Test FAILED\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/3-1.c deleted file mode 100644 index 01fd6bb7e4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/3-1.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_open() returns an error if creation is not requested and - * name does not refer to an already existing message queue. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue; - - sprintf(qname, "/mq_open_3-1_%d", getpid()); - - queue = mq_open(qname, O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue != (mqd_t)-1) { - printf("mq_open() did not return error\n"); - printf("Test FAILED\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/30-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/30-1.c deleted file mode 100644 index 45a8a6aa8f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/30-1.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Will not test mq_open() failing with ENOSPC if there is not enough - * space to create the message queue as system space cannot be controled - * from this test. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test mq_open() failing with ENOSPC when there\n"); - printf("is not enough space to create the message queue\n"); - printf("as system space cannot be controlled from this test.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/4-1.c deleted file mode 100644 index 0f546b1ff4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/4-1.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Will not test that if the message queue descriptor is implemented with - * a file descriptor then at least {OPEN_MAX} file and message queues - * can be opened as we cannot determine at run-time if a given implementation - * is implemented with a file descriptor. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that {OPEN_MAX} file and message queues can\n"); - printf("be opened as we cannot determine at run-time if a given\n"); - printf("implementation is implemented with a file descriptor.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/7-1.c deleted file mode 100644 index 0e650280b4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/7-1.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if the access mode is O_RDONLY, the message queue can - * receive messages but not send. - * - * Test for a message queue opened twice in the same process. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - mqd_t rdwrqueue, roqueue; - struct mq_attr attr; - unsigned pri; - - sprintf(qname, "/mq_open_7-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - rdwrqueue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (rdwrqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - if (mq_send(rdwrqueue, msgptr, strlen(msgptr), 1) != 0) { - perror("mq_send() did not return success"); - printf("Test UNRESOLVED\n"); - /* close queue and exit */ - mq_close(rdwrqueue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("Message %s sent\n", msgptr); -#endif - - roqueue = mq_open(qname, O_RDONLY, S_IRUSR | S_IWUSR, &attr); - if (roqueue == (mqd_t)-1) { - perror("mq_open() for read-only queue did not return success"); - printf("Test UNRESOLVED\n"); - /* close read-write queue and exit */ - mq_close(rdwrqueue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("read-only message queue opened\n"); -#endif - - if (mq_receive(roqueue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() failed on read-only queue"); - printf("Test FAILED\n"); - /* close queues and exit */ - mq_close(roqueue); - mq_close(rdwrqueue); - mq_unlink(qname); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message received\n"); -#endif - - if (mq_send(roqueue, msgptr, strlen(msgptr), 1) == 0) { - printf("mq_send() succeeded on read-only queue\n"); - printf("Test FAILED\n"); - /* close queues and exit */ - mq_close(roqueue); - mq_close(rdwrqueue); - mq_unlink(qname); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message could not be sent, as expected\n"); -#endif - - mq_close(rdwrqueue); - mq_close(roqueue); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/7-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/7-2.c deleted file mode 100644 index e81effa7f3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/7-2.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if the access mode is O_RDONLY, the message queue can - * receive messages but not send. - * - * Test for a message queue opened twice in two different processes. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -void handler(int signo) -{ - return; -} - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - int pid; - - sprintf(qname, "/mq_open_7-2_%d", getpid()); - - if ((pid = fork()) == 0) { - mqd_t roqueue; - char msgrcd[BUFFER]; - sigset_t mask; - struct mq_attr attr; - struct sigaction act; - int sig; - unsigned pri; - - /* child here */ - - /* Set up handler for SIGUSR1 */ - act.sa_handler = handler; - act.sa_flags = 0; - sigaction(SIGUSR1, &act, NULL); - - /* wait for parent to finish mq_send */ - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigprocmask(SIG_BLOCK,&mask,NULL); - sigwait(&mask, &sig); - - /* once parent has finished sending, open read-only queue */ - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - roqueue = mq_open(qname, O_RDONLY, - S_IRUSR | S_IWUSR, &attr); - if (roqueue == (mqd_t)-1) { - perror("mq_open() read only failed"); - return CHILDFAIL; - } -#ifdef DEBUG - printf("Readonly message queue opened in child\n"); -#endif - - if (mq_receive(roqueue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() on a read only queue failed"); - mq_close(roqueue); - return CHILDFAIL; - } -#ifdef DEBUG - printf("Received message %s\n", msgrcd); -#endif - - if (mq_send(roqueue, msgptr, strlen(msgptr)+1, 1) == 0) { - printf("mq_send() on a read only queue succeeded\n"); - mq_close(roqueue); - return CHILDFAIL; - } -#ifdef DEBUG - printf("Sending message failed in child, as expected\n"); -#endif - mq_close(roqueue); - - return CHILDPASS; - } else { - /* parent here */ - mqd_t rdwrqueue; - struct mq_attr attr; - int i; - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - rdwrqueue = mq_open(qname, O_CREAT |O_RDWR, - S_IRUSR | S_IWUSR, &attr); - if (rdwrqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - /* kill child and exit */ - kill(pid, SIGABRT); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("Message queue opened in parent\n"); -#endif - - if (mq_send(rdwrqueue, msgptr, strlen(msgptr)+1, 1) != 0) { - perror("mq_send() did not return success"); - printf("Test UNRESOLVED\n"); - /* close queue, kill child and exit */ - mq_close(rdwrqueue); - mq_unlink(qname); - kill(pid, SIGABRT); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("Message %s sent\n", msgptr); -#endif - - sleep(1); - kill(pid, SIGUSR1); //tell child mq_open and mq_send finished - - if (wait(&i) == -1) { - perror("Error waiting for child to exit"); - printf("Test UNRESOLVED\n"); - /* close queue and exit */ - mq_close(rdwrqueue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("Child finished\n"); -#endif - - mq_close(rdwrqueue); - mq_unlink(qname); - - if (!WIFEXITED(i) || !WEXITSTATUS(i)) { - printf("Test FAILED: exit status %d\n", i); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; - } - - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/7-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/7-3.c deleted file mode 100644 index 1f019ad2c9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/7-3.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that a message queue can be opened more than once for read-only - * in the same process. - * - * Note: Just testing that it can be opened. No tests that it truly - * is read-only (that's 7-1.c and 7-2.c) - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - mqd_t roqueue, roqueue2; - - sprintf(qname, "/mq_open_7-3_%d", getpid()); - - roqueue = mq_open(qname, O_CREAT |O_RDONLY, S_IRUSR | S_IWUSR, NULL); - if (roqueue == (mqd_t)-1) { - perror("mq_open() for read-only queue did not return success"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - roqueue2 = mq_open(qname, O_RDONLY, S_IRUSR | S_IWUSR, NULL); - if (roqueue2 == (mqd_t)-1) { - perror("Second mq_open() for rd-only queue didn't ret success"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - mq_close(roqueue); - mq_close(roqueue2); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/8-1.c deleted file mode 100644 index bd81fbfd68..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/8-1.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if the access mode is O_WRONLY, the message queue can - * send messages but not receive. - * - * Test for a message queue opened twice in the same process. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - mqd_t woqueue, woqueue2; - struct mq_attr attr; - unsigned pri; - - sprintf(qname, "/mq_open_8-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - woqueue = mq_open(qname, O_CREAT |O_WRONLY, S_IRUSR | S_IWUSR, &attr); - if (woqueue == (mqd_t)-1) { - perror("mq_open() for write-only queue did not return success"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - if (mq_send(woqueue, msgptr, strlen(msgptr), 1) != 0) { - perror("mq_send() did not return success"); - printf("Test UNRESOLVED\n"); - /* close queue and exit */ - mq_close(woqueue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("Message %s sent\n", msgptr); -#endif - - if (mq_receive(woqueue, msgrcd, BUFFER, &pri) != -1) { - printf("mq_receive() returned success on write only queue\n"); - printf("Test FAILED\n"); - /* close queue and exit */ - mq_close(woqueue); - mq_unlink(qname); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message receive failed, as expected\n"); -#endif - - woqueue2 = mq_open(qname, O_WRONLY, S_IRUSR | S_IWUSR, &attr); - if (woqueue2 == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - /* close woqueue and exit */ - mq_close(woqueue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } - - if (mq_send(woqueue2, msgptr, strlen(msgptr), 1) != 0) { - perror("mq_send() did not return success"); - printf("Test UNRESOLVED\n"); - /* close queues and exit */ - mq_close(woqueue); - mq_close(woqueue2); - mq_unlink(qname); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("Message %s sent to second queue\n", msgptr); -#endif - - if (mq_receive(woqueue2, msgrcd, BUFFER, &pri) != -1) { - printf("mq_receive() returned success on write only queue\n"); - printf("Test FAILED\n"); - /* close queues and exit */ - mq_close(woqueue); - mq_close(woqueue2); - mq_unlink(qname); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message receive failed, as expected, on second queue\n"); -#endif - - mq_close(woqueue); - mq_close(woqueue2); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/8-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/8-2.c deleted file mode 100644 index d37086373e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/8-2.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if the access mode is O_WRONLY, the message queue can - * send messages but not receive. - * - * Test for a message queue opened twice in two different processes. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -void handler(int signo) -{ - return; -} - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - int pid; - - sprintf(qname, "/mq_open_8-2_%d", getpid()); - - if ((pid = fork()) == 0) { - mqd_t woqueue; - sigset_t mask; - struct mq_attr attr; - struct sigaction act; - char msgrcd[BUFFER]; - int sig; - unsigned pri; - - /* child here */ - - /* Set up handler for SIGUSR1 */ - act.sa_handler = handler; - act.sa_flags = 0; - sigaction(SIGUSR1, &act, NULL); - - /* wait for parent to finish mq_send */ - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigprocmask(SIG_BLOCK,&mask,NULL); - sigwait(&mask, &sig); - - /* once parent has finished mq_send, open new queue */ - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - woqueue = mq_open(qname, O_WRONLY, - S_IRUSR | S_IWUSR, &attr); - if (woqueue == (mqd_t)-1) { - perror("mq_open() read only failed in child"); - return CHILDFAIL; - } -#ifdef DEBUG - printf("write-only message queue opened in child\n"); -#endif - - if (mq_receive(woqueue, msgrcd, BUFFER, &pri) != -1) { - printf("mq_receive() ret success w write-only queue\n"); - mq_close(woqueue); - return CHILDFAIL; - } -#ifdef DEBUG - printf("Receiving message failed in child, as expected\n"); -#endif - - if (mq_send(woqueue, msgptr, strlen(msgptr), 1) == -1) { - perror("mq_send() failed on a write-only queue"); - mq_close(woqueue); - return CHILDFAIL; - } -#ifdef DEBUG - printf("Message %s sent in child\n", msgptr); -#endif - mq_close(woqueue); - - return CHILDPASS; - } else { - /* parent here */ - mqd_t woqueue; - char msgrcd[BUFFER]; - struct mq_attr attr; - int i; - unsigned pri; - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - woqueue = mq_open(qname, O_CREAT |O_WRONLY, - S_IRUSR | S_IWUSR, &attr); - if (woqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - /* kill child and exit */ - kill(pid, SIGABRT); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("write-only message queue opened in parent\n"); -#endif - - if (mq_send(woqueue, msgptr, strlen(msgptr), 1) != 0) { - perror("mq_send() did not return success"); - printf("Test FAILED\n"); - /* kill child, close queue and exit */ - kill(pid, SIGABRT); - mq_close(woqueue); - mq_unlink(qname); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message %s sent\n", msgptr); -#endif - - if (mq_receive(woqueue, msgrcd, BUFFER, &pri) != -1) { - printf("mq_receive() ret success w write only queue\n"); - printf("Test FAILED\n"); - /* kill child, close queue and exit */ - kill(pid, SIGABRT); - mq_close(woqueue); - mq_unlink(qname); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message receive failed, as expected\n"); -#endif - - sleep(1); - kill(pid, SIGUSR1); //tell child mq_open and mq_send finished - - if (wait(&i) == -1) { - perror("Error waiting for child to exit"); - printf("Test UNRESOLVED\n"); - /* close queue and exit */ - mq_close(woqueue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("Child finished\n"); -#endif - - mq_close(woqueue); - mq_unlink(qname); - - if (!WIFEXITED(i) || !WEXITSTATUS(i)) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; - } - - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/9-1.c deleted file mode 100644 index 284880d60c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/9-1.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if the access mode is O_RDWR, the message queue can - * send messages and receive messages. - * - * Test for a message queue opened twice in the same process. - * - * Note: Not testing that the message sent/received is the one expected - * (that would be part of mq_send(), mq_receive() testing). Just testing - * it can be sent/received. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER], msgrcd2[BUFFER]; - const char *msgptr = MSGSTR; - mqd_t rdwrqueue, rdwrqueue2; - struct mq_attr attr; - unsigned pri; - - sprintf(qname, "/mq_open_9-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - rdwrqueue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (rdwrqueue == (mqd_t)-1) { - perror("mq_open() did not return success on read-write queue"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - if (mq_send(rdwrqueue, msgptr, strlen(msgptr), 1) == -1) { - perror("mq_send() did not return success"); - printf("Test FAILED\n"); - /* close queue and exit */ - mq_close(rdwrqueue); - mq_unlink(qname); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message %s sent\n", msgptr); -#endif - - if (mq_receive(rdwrqueue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() did not return success"); - printf("Test FAILED\n"); - /* close queue and exit */ - mq_close(rdwrqueue); - mq_unlink(qname); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message %s received\n", msgrcd); -#endif - - rdwrqueue2 = mq_open(qname, O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (rdwrqueue2 == (mqd_t)-1) { - perror("mq_open() did not return success on read-write queue"); - /* close rdwrqueue and exit */ - mq_close(rdwrqueue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } - - if (mq_send(rdwrqueue2, msgptr, strlen(msgptr), 1) == -1) { - perror("mq_send() did not return success"); - printf("Test FAILED\n"); - /* close queues and exit */ - mq_close(rdwrqueue); - mq_close(rdwrqueue2); - mq_unlink(qname); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message %s sent to second queue\n", msgptr); -#endif - - if (mq_receive(rdwrqueue2, msgrcd2, BUFFER, &pri) == -1) { - perror("mq_receive() did not return success"); - /* close queues and exit */ - mq_close(rdwrqueue); - mq_close(rdwrqueue2); - mq_unlink(qname); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message %s received\n", msgrcd2); -#endif - - mq_close(rdwrqueue); - mq_close(rdwrqueue2); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/9-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/9-2.c deleted file mode 100644 index 3cdf081b09..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/9-2.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if the access mode is O_RDWR, the message queue can - * send and receive messages. - * - * Test for a message queue opened twice in two different processes. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -void handler(int signo) -{ - return; -} - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - int pid; - - sprintf(qname, "/mq_open_9-2_%d", getpid()); - - if ((pid = fork()) == 0) { - mqd_t rdwrqueuechild; - sigset_t mask; - struct mq_attr attr; - struct sigaction act; - char msgrcd[BUFFER]; - int sig; - unsigned pri; - - /* child here */ - - /* Set up handler for SIGUSR1 */ - act.sa_handler = handler; - act.sa_flags = 0; - sigaction(SIGUSR1, &act, NULL); - - /* wait for parent to finish with first queue */ - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigprocmask(SIG_BLOCK,&mask,NULL); - sigwait(&mask, &sig); - - /* once parent has finished, open next queue */ - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - rdwrqueuechild = mq_open(qname, O_RDWR, - S_IRUSR | S_IWUSR, &attr); - if (rdwrqueuechild == (mqd_t)-1) { - perror("mq_open() read only failed"); - return CHILDFAIL; - } -#ifdef DEBUG - printf("read-write message queue opened in child\n"); -#endif - - if (mq_send(rdwrqueuechild, msgptr, strlen(msgptr)+1, 1) == -1) { - perror("mq_send() did not return success"); - mq_close(rdwrqueuechild); - return CHILDFAIL; - } -#ifdef DEBUG - printf("Message %s sent in child\n", msgptr); -#endif - - if (mq_receive(rdwrqueuechild, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() did not return success"); - mq_close(rdwrqueuechild); - return CHILDFAIL; - } -#ifdef DEBUG - printf("Message %s received in child\n", msgrcd); -#endif - - mq_close(rdwrqueuechild); - - return CHILDPASS; - } else { - /* parent here */ - mqd_t rdwrqueue; - char msgrcd[BUFFER]; - struct mq_attr attr; - int i; - unsigned pri; - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - rdwrqueue = mq_open(qname, O_CREAT |O_RDWR, - S_IRUSR | S_IWUSR, &attr); - if (rdwrqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - /* kill child and exit */ - kill(pid, SIGABRT); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("read-write message queue opened in parent\n"); -#endif - - if (mq_send(rdwrqueue, msgptr, strlen(msgptr), 1) == -1) { - perror("mq_send() did not return success"); - printf("Test FAILED\n"); - /* close queue, kill child and exit */ - mq_close(rdwrqueue); - mq_unlink(qname); - kill(pid, SIGABRT); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message %s sent\n", msgptr); -#endif - - if (mq_receive(rdwrqueue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() did not return success"); - printf("Test FAILED\n"); - /* close queue, kill child and exit */ - mq_close(rdwrqueue); - mq_unlink(qname); - kill(pid, SIGABRT); - return PTS_FAIL; - } -#ifdef DEBUG - printf("Message %s received\n", msgrcd); -#endif - - sleep(1); - kill(pid, SIGUSR1); //tell child mq_open and mq_send finished - - if (wait(&i) == -1) { - perror("Error waiting for child to exit"); - printf("Test UNRESOLVED\n"); - /* close queue and exit */ - mq_close(rdwrqueue); - mq_unlink(qname); - return PTS_UNRESOLVED; - } -#ifdef DEBUG - printf("Child finished\n"); -#endif - - mq_close(rdwrqueue); - mq_unlink(qname); - - if (!WIFEXITED(i) || !WEXITSTATUS(i)) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; - } - - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/assertions.xml deleted file mode 100644 index dde2edc316..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/assertions.xml +++ /dev/null @@ -1,163 +0,0 @@ - - -mq_open() returns a message queue descriptor that establishes a connection -between a process and a message queue. That descriptor refers to the open -message queue description referring to the message queue created by mq_open(). - -The message queue descriptor returned by mq_open() can be used by other -functions to refer to the message queue created. - -name is the message queue name (string). -Note: It is not specified if this name actually appears as part of the -filesystem and/or if functions on files apply to the message queue. - - -name must follow the correct construction rules for a pathname - -- If the first letter of name is "/" then any other process calling the - message queue with that name will refer to that message queue object (unless - it's been removed). -- If the first letter of name is not "/" the behavior is implementation - defined. -- How other "/"s in name are interpreted is implementation-defined. - - -mq_open() returns an error if creation is not requested and name does -not refer to an already existing message queue - - -If the message queue descriptor is implemented with a file descriptor, at -least {OPEN_MAX} file and message queues can be opened. - - -oflag refers to the send/receive access to the message queue. They behave -just as read/write, respectively, access on a file with equivalent -protections. - - -oflag is a bitwise-inclusive OR of: -exactly ONE of O_RDONLY, O_WRONLY, O_RDWR (access modes) -any combination of O_CREAT, O_EXCL, O_NONBLOCK - - -If the access mode is O_RDONLY, the message queue can receive messages, but -not send. (i.e., the message queue descriptor returned can be used with -mq_receive, but not mq_send.) - -A message queue can be opened more than once in either the same -process or a different process for receiving messages. - - -If the access mode is O_WRONLY, the message queue can send messages, but -not receive. (i.e., the message queue descriptor can be used with mq_send, -but not ms_receive) - -A message queue can be opened more than once in either the same process or -a different process for sending messages. - - -If the access mode is O_RDWR, the message queue can send or receive -messages (i.e., both mq_receive and mq_send can be used). - -A message queue can be opened more than once in either the same process or -a different process for sending messages. - - -If the O_CREAT flag is set, a message queue is created. - -In addition, the arguments mode_t mode and mq_attr *attr should be sent. - -If name has not been used to create a currently-existing message queue, then -an empty message queue will be created with a user ID == the effective user -ID of the process and group ID == effective group ID of the process. The -file permissions == mode. (It's undefined what happens if non-file -permissions bits are set in mode). - - -If the O_CREAT flag is set and name has already been used to create a -currently existing message queue, then the current call has no effect -(except for exceptions noted with O_EXCL assertions). - - -If the O_CREAT flag is set and attr == NULL, then the implementation-defined -default message queue attributes will be used. - - -If the O_CREAT flag is set and attr != NULL, then, if the calling process -has the allowed privileges on name, mq_maxmsg and ms_msgsize will be set -as defined in attr. - - -If the O_CREAT flag is set and attr != NULL, but the calling process does -not have the allowed privileges on name, mq_open() will fail and return -an error. No message queue will have been created. - - -If O_EXCL and O_CREAT are set, and message queue name already exists, -mq_open() fails. - - -When O_EXCL and O_CREAT are set, this check to see if the message queue -exists and creation of the message queue (if it doesn't already exist) -are atomic w.r.t. other threads calling mq_open with O_EXCL and O_CREAT and -using the same name. - - -If O_EXCL is set without O_CREAT set, the results are undefined. - - -O_NONBLOCK determines the blocking/non-blocking behavior of the mq_send() -and mq_receive() calls. Tests will be done in the mq_send() and mq_receive() -function tests. - - -mq_open() does not add messages to the queue or remove messages from the -queue - - -If mq_open() is successful, it will return a message queue descriptor. - - -If mq_open() is not successful, it will return (mqd_t)-1 and set errno -to indicate the error. - - -mq_open() fails with EACCES if either: -- the message queue exists, but the oflag permissions are denied -or -- the message queue doesn't exist, but permission to create it is denied - - -mq_open() fails with EEXIST if O_CREAT and O_EXCL are set in the flags, but -the message queue exists already - - -mq_open() fails with EINTR if it is interrupted by a signal - - -mq_open() fails with EINVAL if either: -- mq_open() is not supported for the name parameter -- O_CREAT was set in oflag, attr != NULL, and either mq_maxmsq less than - or equal to 0 or mq_msgsize less than or equal to 0 - - -mq_open() fails with EMFILE if there are too many message queue descriptors -or file descriptors in use by the process calling mq_open - - -mq_open() fails with ENAMETOOLONG if the name parameter's length greater -than PATH_MAX or a component of the pathname in name greater than NAME_MAX - - -mq_open() fails with ENFILE if the system has too many message queues open -at the time mq_open() is called - - -mq_open() fails with ENOENT if the named message queue does not yet exist, -but O_CREAT is not set - - -mq_open() fails with ENOSPC if there is not enough space to create the -message queue - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/coverage.txt deleted file mode 100644 index 1b093c30fa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/coverage.txt +++ /dev/null @@ -1,33 +0,0 @@ -This file defines the coverage for the mq_open() function. - -ASSERTION COVERED? -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES -8 YES -9 YES -10 YES -11 YES -12 YES -13 YES -14 YES -15 YES -16 YES -17 YES -18 YES -19 YES -20 YES -21 YES -22 YES -23 YES -24 YES -25 YES -26 YES -27 YES -28 YES -29 YES -30 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/2-2.c deleted file mode 100644 index 753a0c0cfc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/2-2.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if the first letter of name is not "/" the behavior - * is implementation defined. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue; - - sprintf(qname, "msgqueue_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - printf("This implementation does not appear to support\n"); - printf("message queue names that do not start with /.\n"); - return PTS_PASS; - } - - mq_close(queue); - mq_unlink(qname); - - printf("This implementation may support message queue\n"); - printf("names that do not start with /.\n"); - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/2-3.c deleted file mode 100644 index 2c3e738182..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/2-3.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if there are two /s in a message queue name, the behavior - * is implementation defined. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue; - - sprintf(qname, "/tmp/msgqueue_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - printf("This implementation does not appear to support\n"); - printf("message queue names with two /s in them.\n"); - return PTS_PASS; - } - - mq_close(queue); - mq_unlink(qname); - - printf("This implementation may support message queue\n"); - printf("names with two /s in them.\n"); - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/26-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/26-1.c deleted file mode 100644 index c03545effa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/26-1.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_open() fails with EMFILE if there are too many message - * queue descriptors or file descriptors in use by the process calling mq_open. - * - * Test by calling mq_open() _POSIX_OPEN_MAX+1 or _POSIX_MQ_OPEN_MAX+1 times. - * If it fails, assume it was because there were too many message queue - * descriptors or file descriptors open and check that errno == EMFILE. - * - * If it does not fail, print that test results are inconclusive and - * return PTS_PASS. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ -#ifndef _POSIX_OPEN_MAX - printf("_POSIX_OPEN_MAX not defined as expected\n"); - return PTS_UNRESOLVED; -#else -#ifndef _POSIX_MQ_OPEN_MAX - printf("_POSIX_MQ_OPEN_MAX not defined as expected\n"); - return PTS_UNRESOLVED; -#else - char qname[NAMESIZE]; - mqd_t queue[_POSIX_OPEN_MAX+_POSIX_MQ_OPEN_MAX+1]; - int i, unresolved=0, failure=0, numqueues=0; - - for (i=0; (i<_POSIX_OPEN_MAX) && (i<_POSIX_MQ_OPEN_MAX); - i++, numqueues++) { - sprintf(qname, "/msgqueue%d_%d", i, getpid()); - - queue[i] = mq_open(qname, O_CREAT |O_RDWR, - S_IRUSR | S_IWUSR, NULL); - if (queue[i] == (mqd_t)-1) { - printf("mq_open() failed before expected\n"); - unresolved=1; - break; - } - } - - queue[numqueues] = mq_open(qname, O_CREAT |O_RDWR, - S_IRUSR | S_IWUSR, NULL); - if (queue[numqueues] != (mqd_t)-1) { - printf("mq_open() did not fail on > "); - printf("_POSIX_OPEN_MAX or _POSIX_MQ_OPEN_MAX queues\n"); - } else { - if (errno != EMFILE) { - printf("errno != EMFILE on > "); - printf("_POSIX_OPEN_MAX or _POSIX_MQ_OPEN_MAX queues\n"); - failure=1; - } - } - - for (i=0; i<=numqueues;i++) { - mq_close(queue[i]); - } - - for (i=0; i<=numqueues;i++) { - sprintf(qname, "/msgqueue%d_%d", i, getpid()); - mq_unlink(qname); - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -#endif -#endif -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/6-1.c deleted file mode 100644 index aa57674ac7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_open/speculative/6-1.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Brief test that oflag is a bitwise-inclusive OR of only one of - * O_RDONLY, O_WRONLY, O_RDWR. Other aspects of assertion 6 are tested - * in subsequent assertions (7-9). - * - * Moved to speculative/ as behavior for invalid flags isn't really - * defined by POSIX. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 - -int main() -{ - char qname[NAMESIZE]; - mqd_t queue; - - sprintf(qname, "/msgqueue_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR | O_WRONLY, - S_IRUSR | S_IWUSR, NULL); - if (queue != (mqd_t)-1) { - printf("In this implementation, mq_open() does not fail\n"); - printf("on invalid flags\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_PASS; - } - - printf("In this implementation, mq_open() fails on invalid flags\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/1-1.c deleted file mode 100644 index 2dc141ee8d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/1-1.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_receive test plan: - * mq_receive will receive the oldest of the highest priority messages - * from the message queue. The selected message will be removed from the - * queue and copied to the buffer pointed by the msg_ptr argument. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "mq_receive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv1[BUFFER], msgrv2[BUFFER]; - const char *msgptr1 = "test message 1"; - const char *msgptr2 = "test message 2"; - mqd_t mqdes; - unsigned rvprio; - int sdprio1 = 1, sdprio2 = 2; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr1, strlen(msgptr1), sdprio1) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - if (mq_send(mqdes, msgptr2, strlen(msgptr2), sdprio2) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - - if (mq_receive(mqdes, msgrv1, BUFFER, &rvprio) == -1) { - perror(ERROR_PREFIX "mq_receive"); - failure = 1; - } - - if (strncmp(msgptr2, msgrv1, strlen(msgptr2)) != 0) { - printf("FAIL: mq_receive didn't receive the highest priority message\n"); - failure = 1; - } - if (rvprio != sdprio2) { - printf("FAIL: receive priority %d != send priority %d \n", rvprio, sdprio2); - failure = 1; - } - if (mq_receive(mqdes, msgrv2, BUFFER, &rvprio) == -1) { - perror(ERROR_PREFIX "mq_receive"); - failure = 1; - } - if (strncmp(msgptr1, msgrv2, strlen(msgptr1)) != 0) { - printf("FAIL: mq_receive didn't receive the correct message\n"); - failure = 1; - } - if (rvprio != sdprio1) { - printf("FAIL: receive priority %d != send priority %d \n", rvprio, sdprio1); - failure = 1; - } - - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/10-1.c deleted file mode 100644 index b7d1bd7f2b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/10-1.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_receive() test plan: - * mq_receive() will fail with EAGAIN, if message queue is empty and - * O_NONBLOCK is set in the message queue, - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "10-1" -#define FUNCTION "mq_receive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_NONBLOCK | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - if (mq_receive(mqdes, msgrv, BUFFER, NULL) == -1) { - if (EAGAIN != errno) { - printf("errno != EAGAIN \n"); - failure = 1; - } - } - else { - printf("mq_receive() succeed unexpectly\n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; - -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/11-1.c deleted file mode 100644 index ca37912281..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/11-1.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_receive() test plan: - * mq_receive() will fail with EBADF, if mqdes is not a valid message - * message queue descriptor. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "11-1" -#define FUNCTION "mq_receive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - char msgrv[BUFFER]; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open()"); - unresolved = 1; - } - mqdes = mqdes + 1; - if (mq_receive(mqdes, msgrv, BUFFER, NULL) == -1) { - if (EBADF != errno) { - printf("errno != EBADF \n"); - failure = 1; - } - } - else { - printf("mq_receive() succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes - 1) != 0) { - perror(ERROR_PREFIX "mq_close()"); - unresolved=1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink()"); - unresolved=1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/11-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/11-2.c deleted file mode 100644 index fefaf47643..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/11-2.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_receive() test plan: - * mq_receive() will fail with EBADF, if message queue - * is not open for reading. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "11-2" -#define FUNCTION "mq_receive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - - char mqname[NAMESIZE]; - mqd_t mqdes; - char msgrv[BUFFER]; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open()"); - unresolved = 1; - } - if (mq_receive(mqdes, msgrv, BUFFER, NULL) == -1) { - if (EBADF != errno) { - printf("errno != EBADF \n"); - failure = 1; - } - } - else { - printf("mq_receive() succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved=1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink()"); - unresolved=1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/12-1.c deleted file mode 100644 index fdb500b369..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/12-1.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_receive test plan: - * mq_receive will return EMSGSIZE when msg_len is less than the - * message size attribute of the message queue. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "12-1" -#define FUNCTION "mq_receive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 20 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - const char *msgptr = "test message"; - mqd_t mqdes; - int prio = 1; - struct mq_attr mqstat; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - memset(&mqstat,0,sizeof(mqstat)); - mqstat.mq_msgsize = BUFFER + 1; - mqstat.mq_maxmsg = BUFFER + 1; - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &mqstat); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr, strlen(msgptr), prio) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - - if (mq_receive(mqdes, msgrv, BUFFER, NULL) == 0) { - printf("FAIL: mq_receive succeed unexpectly\n"); - failure = 1; - } - else { - if (EMSGSIZE != errno) { - printf("errno != EMSGSIZE \n"); - failure = 1; - } - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/13-1.c deleted file mode 100644 index 28c73f0d71..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/13-1.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_receive() test plan: - * mq_receive() will fail with EINTR if mq_receive() is interrupted by a signal. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "13-1" -#define FUNCTION "mq_receive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -void stopreceive(int signo) -{ - return; -} -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - int pid; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if ((pid = fork()) != 0) { - /* Parent process */ - struct sigaction act; - act.sa_handler = stopreceive; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGABRT, &act, 0); - - if (mq_receive(mqdes, msgrv, BUFFER, NULL) == -1) { - wait(NULL); - if (EINTR != errno) { - printf("errno != EINVAL \n"); - failure = 1; - } - } - else { - wait(NULL); - printf("mq_receive() succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - if (mq_unlink(mqname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; - - } - else { - /* Child Process */ - sleep(2); /* give time to parent to set up handler */ - /* send signal to parent */ - kill(getppid(), SIGABRT); - } - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/2-1.c deleted file mode 100644 index 300a69c5a1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/2-1.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_receive test plan: - * If the buffer size is less than the mq_msgsize attribute, the function - * will fail and return an error. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "mq_receive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 20 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - const char *msgptr = "test message"; - mqd_t mqdes; - int prio = 1; - struct mq_attr mqstat; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - memset(&mqstat,0,sizeof(mqstat)); - mqstat.mq_msgsize = BUFFER + 1; - mqstat.mq_maxmsg = BUFFER + 1; - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &mqstat); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr, strlen(msgptr), prio) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - - if (mq_receive(mqdes, msgrv, BUFFER, NULL) > 0) { - printf("FAIL: mq_receive succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/4-1.sh deleted file mode 100755 index 71efe4e41e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/4-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test if the msg_prio is not NULL, the priority of the selected -# message will be stored in the location pointed by msg_prio. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/5-1.c deleted file mode 100644 index d88ebc0c6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/5-1.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_receive() test plan: - * Test that if the message queue is empty and O_NONBLOCK is not set, - * mq_receive() will block until a message is enqueued on the message queue - * or until mq_receive() is interrupted by a signal. - * - * NOTE: This test makes some assumptions and has some potential race - * conditions, but seems the best way to test for now. - * - * 3/28/2003 Fix a bug mentioned by Michal Wronski, pass mq_attr struct - * to the mq_open(). - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-1" -#define FUNCTION "mq_receive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - const char *msgptr = "test message "; - mqd_t mqdes; - int prio = 1; - int pid; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if ((pid = fork()) != 0) { - /* Parent process */ - int status; - if (mq_receive(mqdes, msgrv, BUFFER, NULL) > 0) { - wait(&status); - if (status) { - printf("mq_send error \n"); - unresolved = 1; - } - } - else { - wait(NULL); /* wait for child to exit */ - perror(ERROR_PREFIX "mq_receive"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - /* Child Process */ - sleep(2); /* sleep 2 seconds, - assume that child will block on waiting then */ - if (mq_send(mqdes, msgptr, strlen(msgptr), prio) == -1) { - perror(ERROR_PREFIX "mq_send"); - return PTS_UNRESOLVED; - } - return 0; - } - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/7-1.c deleted file mode 100644 index 620bb7c38f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/7-1.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_receive() test plan: - * If message queue is empty and O_NONBLOCK is set in the message queue, - * no message will be removed from the queue, mq_receive will return an - * error. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "7-1" -#define FUNCTION "mq_receive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_NONBLOCK | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_receive(mqdes, msgrv, BUFFER, NULL) != -1) { - printf("mq_receive succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/8-1.c deleted file mode 100644 index 4254bb6455..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/8-1.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_receive test plan: - * On success, mq_receive will return the length of the selected message - * and the message will be removed from the queue. - * step: - * 1. send two messages to the message queue - * 2. call mq_receive() twice, if the two received messages are the same, - * which means the first mq_receive does not remove the message from - * the queue, the test will fail. Otherwise, the test will pass. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "8-1" -#define FUNCTION "mq_receive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv1[BUFFER], msgrv2[BUFFER]; - const char *msgptr1 = "test message1"; - const char *msgptr2 = "test message2 with differnet length"; - mqd_t mqdes; - int prio1 = 1, prio2 = 2; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr1, strlen(msgptr1), prio1) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - if (mq_send(mqdes, msgptr2, strlen(msgptr2), prio2) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - - if (mq_receive(mqdes, msgrv1, BUFFER, NULL) != strlen(msgptr2)) { - printf("FAIL: mq_receive didn't return the selected message size correctly \n"); - failure = 1; - } - if (mq_receive(mqdes, msgrv2, BUFFER, NULL) != strlen(msgptr1)) { - printf("FAIL: mq_receive didn't return the selected message size correctly \n"); - failure = 1; - } - if (!strcmp(msgrv1,msgrv2)) { - printf("FAIL: mq_receive received the same message twice\n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/9-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/9-1.sh deleted file mode 100755 index d0042efa44..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/9-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test on failure, no message will be removed from the queue, -# the funcion will return a value of -1. - -# This is tested implicitly via assertion 10,11,12,13 - -echo "Tested implicitly via assertion 10,11,12,13. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/assertions.xml deleted file mode 100644 index a208b3bf32..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/assertions.xml +++ /dev/null @@ -1,44 +0,0 @@ - - -mq_receive() receive the oldest of the highest priority message(s) from the message queue specified by mqdes. The selected message will be removed from the queue and copied to the buffer pointed to by the msg_ptr argument. - - -mq_receive() will fail and return an error if the size of the buffer in bytes, specified by the msg_len argument, is less than the mq_msgsize attribute of the message queue. - - -if msg_len is greater than SSIZE_MAX, the result is implementation-defined. - - -If msg_prio is not NULL, the priority of the selected message will be stored in the location referenced by msg_prio. - - -If the specified message queue is empty and O_NONBLOCK is not set, then mq_receive() will block until a message is enqueued on the message queue or until a signal interrupts mq_receive(). - - -If there are more than one thread waiting to receive a message when a message arrives at an empty queue and the Priority Scheduling option is supported, then the thread with highest priority that has been waiting the longest will receive the message. If Priority Scheduling option is not supported, then it is unspecified which waiting thread is able to receive the message. - - -If the specified message queue is empty and O_NONBLOCK is set, no message will be removed from the queue, and mq_receive() will return an error. - - -mq_receive() will return the length of the selected message in bytes and the message will be removed from the queue on success. - - -mq_receive() will return -1 on failure, nomessage will be removed from the queue, and the errno will be set. - - -mq_receive() will return EAGAIN if O_NONBLOCK is set and the message queue is empty. - - -mq_receive() will return EBADF if mqdes is not a valid message queue descriptor open for reading. - - -mq_receive() will return EMSGSIZE if the specified buffer size, msg_len, is less than the message size attribute of the message queue. - - -mq_receive() will return EINTR if it is interrupted by a signal - - -mq_receive() will return EBADMSG if the implementation has detected a data corruption problem with the message. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/coverage.txt deleted file mode 100644 index 21c611bfd6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_receive/coverage.txt +++ /dev/null @@ -1,17 +0,0 @@ -This document defines the coverage for the mq_receive function: - -Assertion Tested? -1 YES -2 YES -3 NO - implementation-defined, won't test. -4 YES -5 YES -6 NO - won't test. -7 YES -8 YES -9 YES -10 YES -11 YES -12 YES -13 YES -14 NO - won't test. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/1-1.c deleted file mode 100644 index dd8b2173e3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/1-1.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Basic test that mq_send() actually places a message into mqdes. Verify - * by ensuring the message can be received. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 10 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0; - unsigned pri; - - sprintf(qname, "/mq_send_1-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_send(queue, msgptr, strlen(msgptr), 1) != 0) { - perror("mq_send() did not return success"); - failure=1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr, msgrcd, strlen(msgptr)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr, msgrcd); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/10-1.c deleted file mode 100644 index cd4dc6d138..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/10-1.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if O_NONBLOCK is set and the message queue is full, mq_send() - * will set errno == EAGAIN (subset of 7-1.c). - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MESSAGESIZE 50 - -#define BUFFER 40 -#define MAXMSG 10 - -int main() -{ - char qname[NAMESIZE]; - char msgptr[MESSAGESIZE]; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0, i, maxreached=0; - - sprintf(qname, "/mq_send_10-1_%d", getpid()); - - attr.mq_maxmsg = MAXMSG; - attr.mq_msgsize = BUFFER; - queue = mq_open(qname, O_CREAT | O_RDWR | O_NONBLOCK, - S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - mqd_t queue; - int unresolved=0, failure=0; - - sprintf(qname, "/mq_send_11-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_send(queue+1, msgptr, strlen(msgptr), 1) != -1) { - printf("mq_send() did not return -1 on invalid queue\n"); - failure=1; - } - - if (errno != EBADF) { - printf("errno != EBADF\n"); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/11-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/11-2.c deleted file mode 100644 index 861e8b9c4e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/11-2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_send() returns errno == EBADF if mqdes is not open for - * writing. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - mqd_t queue; - int unresolved=0, failure=0; - - sprintf(qname, "/mq_send_11-2_%d", getpid()); - - queue = mq_open(qname, O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_send(queue, msgptr, strlen(msgptr), 1) != -1) { - printf("mq_send() did not return -1 on invalid queue\n"); - failure=1; - } - - if (errno != EBADF) { - printf("errno != EBADF\n"); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/12-1.c deleted file mode 100644 index d21075ebe5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/12-1.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test mq_send() will set errno == EINTR if it is interrupted by a signal. - * - * Have a child send signals until it starts to block. At that point, have - * the parent send a signal to interrupt the child. Test passes if errno == - * EINVAL. - * - * Test very similar to 5-2.c except we don't have the additional test to - * verify the child _was_ blocking. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 5 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -char gqname[NAMESIZE]; -mqd_t gqueue; - -/* - * This handler is just used to catch the signal and stop sleep (so the - * parent knows the child is still busy sending signals). - */ -void justreturn_handler(int signo) -{ - return; -} - -int main() -{ - int pid; - const char *msgptr = MSGSTR; - struct mq_attr attr; - struct sigaction act; - - sprintf(gqname, "/mq_send_12-1_%d", getpid()); - - attr.mq_maxmsg = MAXMSG; - attr.mq_msgsize = BUFFER; - gqueue = mq_open(gqname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (gqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - /* parent and child use justreturn_handler to just return out of - * situations -- parent uses to stop it's sleep and wait again for - * the child; child uses to stop its mq_send - */ - act.sa_handler=justreturn_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGABRT, &act, 0); - - if ((pid = fork()) == 0) { - /* child here */ - int i; - - sleep(1); // give parent time to set up handler - for (i=0; i= MQ_PRIO_MAX or < 0 (<0 N/A - * for an unsigned, so not tested). - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define NUMINVALID 3 - -static unsigned invalidpri[NUMINVALID] = { - MQ_PRIO_MAX, MQ_PRIO_MAX+1, MQ_PRIO_MAX+5 -}; - - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - mqd_t queue; - int unresolved=0, failure=0, i; - - sprintf(qname, "/mq_send_13-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - for (i=0; imq_msgsize. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "01234567890123456789" -#define NUMINVALID 3 - -static long messagesize[NUMINVALID] = { - 19, 2, 1 -}; - - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - mqd_t queue; - int unresolved=0, failure=0, i; - struct mq_attr attr; - - sprintf(qname, "/mq_send_14-1_%d", getpid()); - - for (i=0; imq_msgsize. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "01234567890123456789" -#define MSGSIZE 10 // < strlen(MSGSTR) - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - mqd_t queue; - int unresolved=0, failure=0; - struct mq_attr attr; - - sprintf(qname, "/mq_send_2-1_%d", getpid()); - - attr.mq_msgsize = MSGSIZE; - attr.mq_maxmsg = MSGSIZE; - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_send(queue, msgptr, strlen(msgptr), 1) == 0) { - printf("mq_send() returned success when msg_len>=mq_msgsize\n"); - failure=1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/3-1.c deleted file mode 100644 index d63b15f439..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/3-1.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_send() inserts messages into the message queue according - * to the priority given. - * Test by inserting multiple messages into the queue not in priority order. - * Ensure messages are received in priority order. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSG1 "1234567890" -#define PRI1 10 -#define MSG2 "234567890" -#define PRI2 8 -#define MSG3 "34567890" -#define PRI3 6 -#define MSG4 "4567890" -#define PRI4 2 -#define MSG5 "567890" -#define PRI5 1 -#define BUFFER 40 -#define MAXMSG 10 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr1 = MSG1; - const char *msgptr2 = MSG2; - const char *msgptr3 = MSG3; - const char *msgptr4 = MSG4; - const char *msgptr5 = MSG5; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0; - unsigned pri; - - sprintf(qname, "/mq_send_3-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_send(queue, msgptr3, strlen(msgptr3), PRI3) != 0) { - perror("mq_send() did not return success"); - failure=1; - } - - if (mq_send(queue, msgptr1, strlen(msgptr1), PRI1) != 0) { - perror("mq_send() did not return success"); - failure=1; - } - - if (mq_send(queue, msgptr4, strlen(msgptr4), PRI4) != 0) { - perror("mq_send() did not return success"); - failure=1; - } - - if (mq_send(queue, msgptr2, strlen(msgptr2), PRI2) != 0) { - perror("mq_send() did not return success"); - failure=1; - } - - if (mq_send(queue, msgptr5, strlen(msgptr5), PRI5) != 0) { - perror("mq_send() did not return success"); - failure=1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr1, msgrcd, strlen(msgptr1)) != 0) { - printf("FAIL: expected %s received %s\n", msgptr1, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr2, msgrcd, strlen(msgptr2)) != 0) { - printf("FAIL: expected %s received %s\n", msgptr2, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr3, msgrcd, strlen(msgptr3)) != 0) { - printf("FAIL: expected %s received %s\n", msgptr3, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr4, msgrcd, strlen(msgptr4)) != 0) { - printf("FAIL: expected %s received %s\n", msgptr4, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr5, msgrcd, strlen(msgptr5)) != 0) { - printf("FAIL: expected %s received %s\n", msgptr5, msgrcd); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/3-2.c deleted file mode 100644 index 16262a451c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/3-2.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_send() inserts messages into the message queue according - * to the priority given. Specifically, test that messages with equal - * priority values are placed after previously sent messages. - * - * Test similar to 3-1.c; however, messages 3 and 4 will have equal priority - * order, but 3 will be sent first. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSG1 "1234567890" -#define PRI1 10 -#define MSG2 "234567890" -#define PRI2 8 -#define MSG3 "34567890" -#define PRI3 6 -#define MSG4 "4567890" -#define PRI4 6 -#define MSG5 "567890" -#define PRI5 1 -#define BUFFER 40 -#define MAXMSG 10 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr1 = MSG1; - const char *msgptr2 = MSG2; - const char *msgptr3 = MSG3; - const char *msgptr4 = MSG4; - const char *msgptr5 = MSG5; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0; - unsigned pri; - - sprintf(qname, "/mq_send_3-2_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_send(queue, msgptr3, strlen(msgptr3), PRI3) != 0) { - perror("mq_send() did not return success"); - printf("error sending %s\n", msgptr3); - failure=1; - } - - if (mq_send(queue, msgptr1, strlen(msgptr1), PRI1) != 0) { - perror("mq_send() did not return success"); - printf("error sending %s\n", msgptr1); - failure=1; - } - - if (mq_send(queue, msgptr4, strlen(msgptr4), PRI4) != 0) { - perror("mq_send() did not return success"); - printf("error sending %s\n", msgptr4); - failure=1; - } - - if (mq_send(queue, msgptr2, strlen(msgptr2), PRI2) != 0) { - perror("mq_send() did not return success"); - printf("error sending %s\n", msgptr2); - failure=1; - } - - if (mq_send(queue, msgptr5, strlen(msgptr5), PRI5) != 0) { - perror("mq_send() did not return success"); - printf("error sending %s\n", msgptr5); - failure=1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr1, msgrcd, strlen(msgptr1)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr1, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr2, msgrcd, strlen(msgptr2)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr2, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr3, msgrcd, strlen(msgptr3)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr3, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr4, msgrcd, strlen(msgptr4)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr4, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr5, msgrcd, strlen(msgptr5)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr5, msgrcd); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/4-1.c deleted file mode 100644 index 342c6e0ee3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/4-1.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that msg_prio must be less than MQ_PRIO_MAX. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - mqd_t queue; - int unresolved=0, failure=0; - - sprintf(qname, "/mq_send_4-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_send(queue, msgptr, strlen(msgptr), MQ_PRIO_MAX+1) == 0) { - printf("mq_send() returned success with pri > MQ_PRIO_MAX\n"); - failure=1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/4-2.c deleted file mode 100644 index ddeb7b9a4b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/4-2.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that msg_prio cannot be equal to MQ_PRIO_MAX. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - mqd_t queue; - int unresolved=0, failure=0; - - sprintf(qname, "/mq_send_4-2_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_send(queue, msgptr, strlen(msgptr), MQ_PRIO_MAX) == 0) { - printf("mq_send() returned success with pri = MQ_PRIO_MAX\n"); - failure=1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/4-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/4-3.c deleted file mode 100644 index d15237d087..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/4-3.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that msg_prio can be equal to MQ_PRIO_MAX-1. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 10 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0; - unsigned pri; - - sprintf(qname, "/mq_send_4-3_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if (mq_send(queue, msgptr, strlen(msgptr), MQ_PRIO_MAX-1) != 0) { - perror("mq_send() did not return success"); - failure=1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr, msgrcd, strlen(msgptr)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr, msgrcd); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/5-1.c deleted file mode 100644 index ac93923ecc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/5-1.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if the message queue is full and O_NONBLOCK is not set, mq_send() - * will block until it can place the message in the queue. - * - * Test by sending messages in a child process until the message queue is full. - * At this point, the child should be blocking on sending. Then, have the - * parent receive the message and return pass when the next message is sent - * to the message queue. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 5 - -char gqname[NAMESIZE]; -mqd_t gqueue; - -/* - * This handler is just used to catch the signal and stop sleep (so the - * parent knows the child is still busy sending signals). - */ -void stopsleep_handler(int signo) -{ - return; -} - -int main() -{ - int pid; - char msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - struct mq_attr attr; - int unresolved=0; - unsigned pri; - - sprintf(gqname, "/mq_send_5-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - gqueue = mq_open(gqname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (gqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - int i; - - sleep(1); // give parent time to set up handler - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 5 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -char gqname[NAMESIZE]; -mqd_t gqueue; - -/* - * This handler is just used to catch the signal and stop sleep (so the - * parent knows the child is still busy sending signals). - */ -void justreturn_handler(int signo) -{ - return; -} - -int main() -{ - int pid; - const char *msgptr = MSGSTR; - struct mq_attr attr; - struct sigaction act; - - sprintf(gqname, "/mq_send_5-2_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - gqueue = mq_open(gqname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (gqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - /* parent and child use justreturn_handler to just return out of - * situations -- parent uses to stop it's sleep and wait again for - * the child; child uses to stop its mq_send - */ - act.sa_handler=justreturn_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGABRT, &act, 0); - - if ((pid = fork()) == 0) { - /* child here */ - int i; - - sleep(1); // give parent time to set up handler - for (i=0; i -#include "posixtest.h" - -int main() -{ - printf("Priority Scheduling needed to make a reliable test case\n"); - printf("for this instance. Will not be tested.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/7-1.c deleted file mode 100644 index 133e8ee0f7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/7-1.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if O_NONBLOCK is set and the message queue is full, mq_send() - * will just return an error message and the message will not be queued. - * - * Test by sending messages with increasing priority number until a failure - * is received. Then test that the message just sent (highest priority) is - * not the one received. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MESSAGESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 10 // send should end after MAXMSG - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - char msgptr[MESSAGESIZE]; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0, spri=1, i, maxreached=0; - unsigned pri; - - sprintf(qname, "/mq_send_7-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT | O_RDWR | O_NONBLOCK, - S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - for (i=0; i= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 10 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, ret; - unsigned pri; - - sprintf(qname, "/mq_send_8-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ret = mq_send(queue, msgptr, strlen(msgptr), 1); - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr, msgrcd, strlen(msgptr)) != 0) { - printf("send was unsuccessful: sent %s received %s\n", - msgptr, msgrcd); - unresolved = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - if (ret != 0) { - printf("mq_send() did not return 0 on success\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/9-1.c deleted file mode 100644 index ea1560466f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/9-1.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_send() returns -1 on failure, no message is queued, and - * errno is set. - * The failure case chosen is an invalid message queue descriptor. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 10 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0; - unsigned pri; - - sprintf(qname, "/mq_send_9-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT |O_RDWR | O_NONBLOCK, - S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - // Verify mq_send() returns -1 - if (mq_send(queue+1, msgptr, strlen(msgptr), 1) != -1) { - printf("mq_send() did not return -1 on invalid queue\n"); - failure=1; - } - - // Verify errno is set - if (errno != EBADF) { - printf("errno was not set on invalid queue\n"); - failure = 1; - } - - // Verify message was not queued (cannot be received) - if (mq_receive(queue, msgrcd, BUFFER, &pri) != -1) { - if (strcmp(msgptr, msgrcd) == 0) { - printf("Message ended up being sent\n"); - failure = 1; - } else { - printf("Error with mq_receive()\n"); - unresolved = 1; - } - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/assertions.xml deleted file mode 100644 index 7b7bafd7e2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/assertions.xml +++ /dev/null @@ -1,61 +0,0 @@ - - -mq_send() places the message msg_ptr points to into message queue mqdes - - -mq_send() will fail if msg_len, the message length, is not less than or -equal to mq_attr->mq_msgsize. - - -mq_send() will insert the message into the message queue according to -msg_prio (if the message queue is not full): -- Larger msg_prio values mean the message is inserted before those with - lower values. -- For messages with equal msg_prio values, the message is inserted after - those. - - -msg_prio must be less than MQ_PRIO_MAX - - -If the message queue pointed to by msg_ptr is full and O_NONBLOCK is not -set, then mq_send() will block until it can place the message in the queue -or until a signal interrupts mq_send(). - - -If there are greater than one threads which are waiting to place a message -in the message queue, the thread which will be able to place its message -when space is available is the one with the greatest priority that has been -waiting the longest if Priority Scheduling is supported. If not, then it -is unspecified which thread is able to place its message. - - -If the message queue pointed to by msg_ptr is full and O_NONBLOCK is set, -then mq_send() will just return an error and the message will not be queued. - - -mq_send() will return 0 on success. - - -mq_send() will return -1 on failure, no message will be queued, and errno -will be set. - - -mq_send() will return EAGAIN if O_NONBLOCK is set and the message queue -is full - - -mq_send() will return EBADF if mqdes is not a valid message queue descriptor -that is also open for writing - - -mq_send() will return EINTR if it is interrupted by a signal - - -mq_send() will return EINVAL if msg_prio wasn't in the valid range - - -mq_send() will return EMSGSIZE if msg_len is greater than the message -queues message size attribute - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/coverage.txt deleted file mode 100644 index 91ab870bd1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_send/coverage.txt +++ /dev/null @@ -1,17 +0,0 @@ -This document defines the coverage for the mq_send() function. - -ASSERTION COVERED? -1 YES -2 YES -3 YES -4 YES -5 YES -6 WON'T - will not test as needs Priority Scheduling to finish -7 YES -8 YES -9 YES -10 YES -11 YES -12 YES -13 YES -14 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/1-1.c deleted file mode 100644 index 3a4aa77788..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/1-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ -/* - * mq_setattr() test plan: - * mq_setattr() set attributes of the open message queue, - * then verify that mq_setattr() returns 0 on success. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "mq_setattr" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define MQFLAGS O_NONBLOCK - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct mq_attr mqstat, nmqstat; - int unresolved = 0; - int failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - memset(&mqstat,0,sizeof(mqstat)); - memset(&nmqstat,0,sizeof(nmqstat)); - if (mq_getattr(mqdes, &mqstat) == -1) { - perror(ERROR_PREFIX "mq_getattr"); - unresolved = 1; - } - mqstat.mq_flags |= MQFLAGS; - if (mq_setattr(mqdes, &mqstat, NULL) != 0) { - perror(ERROR_PREFIX "mq_setattr"); - failure = 1; - } - if (mq_getattr(mqdes, &nmqstat) == -1) { - perror(ERROR_PREFIX "mq_getattr"); - unresolved = 1; - } - mq_close(mqdes); - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - return PTS_UNRESOLVED; - } - if (nmqstat.mq_flags != mqstat.mq_flags) { - printf("FAIL: mq_flags getted is %ld , while mq_flags " - "setted is %ld\n", nmqstat.mq_flags, mqstat.mq_flags); - failure = 1; - } - - if (failure == 1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved == 1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED \n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/1-2.c deleted file mode 100644 index eb1e59094f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/1-2.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ -/* - * mq_setattr test plan: - * Test that the values of mq_maxmsg, mq_msgsize, mq_curmsgs members of - * the mq_attr structure will be ignored by mq_setattr(). - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-2" -#define FUNCTION "mq_setattr" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define MQFLAGS 1 -#define NAMESIZE 50 -#define MQCURMSGS 555 - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct mq_attr mqstat, nmqstat; - int unresolved = 0; - int failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - memset(&mqstat,0,sizeof(mqstat)); - memset(&nmqstat,0,sizeof(mqstat)); - - if (mq_getattr(mqdes, &mqstat) == -1) { - perror(ERROR_PREFIX "mq_getattr"); - unresolved = 1; - } - mqstat.mq_maxmsg = mqstat.mq_maxmsg + 1; - mqstat.mq_msgsize = mqstat.mq_msgsize + 1; - mqstat.mq_curmsgs = mqstat.mq_curmsgs + 1; - - if (mq_setattr(mqdes, &mqstat, NULL) != 0) { - perror(ERROR_PREFIX "mq_setattr()"); - failure = 1; - } - if (mq_getattr(mqdes, &nmqstat) == -1) { - perror(ERROR_PREFIX "mq_getattr()"); - unresolved = 1; - } - if ((nmqstat.mq_maxmsg == mqstat.mq_maxmsg)|| - (nmqstat.mq_msgsize == mqstat.mq_msgsize)|| - (nmqstat.mq_curmsgs == mqstat.mq_curmsgs)) { - failure = 1; - } - - mq_close(mqdes); - mq_unlink(mqname); - - if (failure == 1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved == 1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED \n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/2-1.c deleted file mode 100644 index e40383a54f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/2-1.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ -/* - * mq_setattr() test plan: - * If omqstat is non_NULL, the mq_setattr() function will store, in the - * location referenced by omqstat, the previous message queue attributes and - * the current queue status. These values will be the same as would be - * returned by a call to mq_getattr() at that point. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "mq_setattr" -#define NAMESIZE 50 -#define MQFLAGS 0 -#define MQMAXMSG 666 -#define MQMSGSIZE 777 -#define MQCURMSGS 555 - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct mq_attr omqstat, mqstat, nmqstat; - int unresolved = 0; - int failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - memset(&mqstat,0,sizeof(mqstat)); - memset(&omqstat,0,sizeof(omqstat)); - memset(&nmqstat,0,sizeof(nmqstat)); - - if (mq_getattr(mqdes, &omqstat) == -1) { - perror("mq_getattr() did not return success"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror("mq_unlink()"); - return PTS_UNRESOLVED; - } - nmqstat.mq_flags = MQFLAGS; - nmqstat.mq_maxmsg = MQMAXMSG; - nmqstat.mq_msgsize = MQMSGSIZE; - nmqstat.mq_curmsgs = MQCURMSGS; - - if (mq_setattr(mqdes, &nmqstat, &mqstat) != 0) { - failure = 1; - } - if ((omqstat.mq_flags != mqstat.mq_flags)|| - (omqstat.mq_maxmsg != mqstat.mq_maxmsg)|| - (omqstat.mq_msgsize != mqstat.mq_msgsize)|| - (omqstat.mq_curmsgs != mqstat.mq_curmsgs)) { - failure = 1; - } - - mq_close(mqdes); - mq_unlink(mqname); - - if (failure == 1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved == 1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED \n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/3-1.sh deleted file mode 100755 index 1ef4b6e1b9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test if mq_setattr is success, mq_setattr will return a value of -# 0 and the attributes of the message queue will change as specified. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/4-1.sh deleted file mode 100755 index acdf6fd3c4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/4-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# If mq_setattr() is not sucessful, the message queue attributes will -# not change, the function will return -1 nd set errno to indicate the error. - -# This is tested implicitly via assertion 5. - -echo "Tested implicitly via assertion 5. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/5-1.c deleted file mode 100644 index 164e064f6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/5-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ -/* - * mq_setattr() test plan: - * Test if mqdes argument is not a valid message queue descriptor, - * mq_setattr() function will fail with EBADF, and the function will - * return a value of -1. - * - * 2/17/2004 call mq_close and mq_unlink before exit to release mq - * resources - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-1" -#define FUNCTION "mq_setattr" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define MQFLAGS 1 -#define NAMESIZE 50 - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - struct mq_attr mqstat, nmqstat; - int unresolved = 0; - int failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open()"); - return PTS_UNRESOLVED; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink()"); - return PTS_UNRESOLVED; - } - mqdes = mqdes + 1; - - memset(&mqstat,0,sizeof(mqstat)); - memset(&nmqstat,0,sizeof(nmqstat)); - nmqstat.mq_flags = MQFLAGS; - - if (mq_setattr(mqdes, &mqstat, NULL) == -1) { - if (EBADF != errno) { - printf("errno != EBADF \n"); - failure = 1; - } - } - else { - printf("Test FAILED\n"); - failure = 1; - } - - mq_close(mqdes); - mq_unlink(mqname); - - if (failure == 1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved == 1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED \n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/assertions.xml deleted file mode 100644 index f2e0e26196..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/assertions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - -The mq_setattr() will set attributes associated with the open message queue description referenced by the message queue descriptor specified by mqdes. -The following members of mq_attr will be set to the specified value: - mq_flags is the bitwise-logical OR of zero or more of O_NONBLOCK an -d any implementation-defined flags. - mq_maxmsg, mq_msgsize, and mq_curmsgs memebers of the mq_attr stru -cture shall be ignored by mq_setattr(). - - -If omqstat is non-NULL, mq_setattr() will store the previous message queue attributes and the current queue status in the location referenced by omqstat. These values will be the same as would be returned by a call to mq_getattr() at that point. - - -If mq_setattr() is successful, it will return a value of zero and the attributes of the message queue will change as specified. - - -If mq_setattr() is not successful, the message queue attributes will be unchanged, and the function will return a value of -1 and set errno to indicate the error. - - -mq_setattr() fails with EBADF if mqdes argument is not a valid message descriptor. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/coverage.txt deleted file mode 100644 index a7ffbfc6ec..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_setattr/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the mq_setattr function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/1-1.c deleted file mode 100644 index 0a63293b77..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/1-1.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive test plan: - * mq_timedreceive will receive the oldest of the highest priority messages - * from the message queue. The selected message will be removed from the - * queue and copied to the buffer pointed by the msg_ptr argument. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv1[BUFFER], msgrv2[BUFFER]; - const char *msgptr1 = "test message 1"; - const char *msgptr2 = "test message 2"; - mqd_t mqdes; - unsigned rvprio, sdprio1 = 1, sdprio2 = 2; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr1, strlen(msgptr1), sdprio1) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - if (mq_send(mqdes, msgptr2, strlen(msgptr2), sdprio2) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv1, BUFFER, &rvprio, &ts) == -1) { - perror(ERROR_PREFIX "mq_timedreceive"); - failure = 1; - } - - if (strncmp(msgptr2, msgrv1, strlen(msgptr2)) != 0) { - printf("FAIL: mq_timedreceive didn't receive the highest priority message\n"); - failure = 1; - } - if (rvprio != sdprio2) { - printf("FAIL: receive priority %d != send priority %d \n", rvprio, sdprio2); - failure = 1; - } - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv2, BUFFER, &rvprio, &ts) == -1) { - perror(ERROR_PREFIX "mq_timedreceive"); - failure = 1; - } - if (strncmp(msgptr1, msgrv2, strlen(msgptr1)) != 0) { - printf("FAIL: mq_timedreceive didn't receive the correct message\n"); - failure = 1; - } - if (rvprio != sdprio1) { - printf("FAIL: receive priority %d != send priority %d \n", rvprio, sdprio1); - failure = 1; - } - - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/10-1.c deleted file mode 100644 index e2e6154619..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/10-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive test plan: - * If message can be removed from message queue immediately, - * mq_timedreceive will never fail with a timeout. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "10-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - const char *msgptr = "test message"; - mqd_t mqdes; - unsigned rvprio, sdprio = 1; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr, strlen(msgptr), sdprio) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - - ts.tv_sec = time(NULL) - 1; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv, BUFFER, &rvprio, &ts) == -1) { - perror("FAIL: mq_receive fails unexpectly \n"); - failure = 1; - } - - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/10-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/10-2.c deleted file mode 100644 index 4845a16390..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/10-2.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * adam.li@intel.com - */ - -/* - * If the message can be removed from the message queue immedietely, - * the operation will never fail and the validity of abs_timeout - * need not be checked. - * Test Steps: - * 1. Set the abs_timeout to be invalid, when there is message - * than can be removed from the message queue immediately. - * 2. The validity of abs_timeout will not be checked. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "10-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - const char *msgptr = "test message"; - mqd_t mqdes; - unsigned int rvprio; - int sdprio = 1; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr, strlen(msgptr), sdprio) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - - sleep(1); /* wait for a while */ - ts.tv_sec = time(NULL) -1; /* No wait */ - ts.tv_nsec = -1; /* Invalid */ - if (mq_timedreceive(mqdes, msgrv, BUFFER, &rvprio, &ts) == -1) { - if (errno == EINVAL) - printf("FAIL: the validity of abs_timeout " - "is checked\n"); - else - perror("Unexpected error at mq_timedreceive"); - failure = 1; - } - - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/11-1.c deleted file mode 100644 index 191983b9c8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/11-1.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive test plan: - * On success, mq_timedreceive will return the length of the selected message - * and the message will be removed from the queue. - * step: - * 1. send two messages to the message queue - * 2. call mq_timedreceive() twice, if the two received messages are the same, - * which means the first mq_timedreceive does not remove the message from - * the queue, the test will fail. Otherwise, the test will pass. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "11-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv1[BUFFER], msgrv2[BUFFER]; - const char *msgptr1 = "test message1"; - const char *msgptr2 = "test message2 with differnet length"; - mqd_t mqdes; - int prio1 = 1, prio2 = 2; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr1, strlen(msgptr1), prio1) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - if (mq_send(mqdes, msgptr2, strlen(msgptr2), prio2) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv1, BUFFER, NULL, &ts) != strlen(msgptr2)) { - printf("FAIL: mq_timedreceive didn't return the selected message size correctly \n"); - failure = 1; - } - if (mq_timedreceive(mqdes, msgrv2, BUFFER, NULL, &ts) != strlen(msgptr1)) { - printf("FAIL: mq_timedreceive didn't return the selected message size correctly \n"); - failure = 1; - } - if (!strcmp(msgrv1,msgrv2)) { - printf("FAIL: mq_timedreceive received the same message twice\n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/12-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/12-1.sh deleted file mode 100755 index f634097b41..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/12-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test on failure, no message will be removed from the queue, -# the funcion will return a value of -1. - -# This is tested implicitly via assertion 13,14,15,16,17,18,19 - -echo "Tested implicitly via assertion 13,14,15,16,17,18,19. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/13-1.c deleted file mode 100644 index de32202f4e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/13-1.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * mq_timedreceive() will fail with EAGAIN, if message queue is empty and - * O_NONBLOCK is set in the message queue, - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "13-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_NONBLOCK | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) == -1) { - if (EAGAIN != errno) { - printf("errno != EAGAIN \n"); - failure = 1; - } - } - else { - printf("mq_timedreceive() succeed unexpectly\n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/14-1.c deleted file mode 100644 index 7e8a2db0ab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/14-1.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * mq_timedreceive() will fail with EBADF, if mqdes is not a valid message - * message queue descriptor. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "14-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - char msgrv[BUFFER]; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open()"); - unresolved = 1; - } - mqdes = mqdes + 1; - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) == -1) { - if (EBADF != errno) { - printf("errno != EBADF \n"); - failure = 1; - } - } - else { - printf("mq_timedreceive() succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes - 1) != 0) { - perror(ERROR_PREFIX "mq_close()"); - unresolved=1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink()"); - unresolved=1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/15-1.c deleted file mode 100644 index 895a01a7d0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/15-1.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive test plan: - * mq_timedreceive will return EMSGSIZE when msg_len is less than the - * message size attribute of the message queue. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "15-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 20 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - const char *msgptr = "test message"; - mqd_t mqdes; - int prio = 1; - struct mq_attr mqstat; - struct timespec ts; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - memset(&mqstat,0,sizeof(mqstat)); - mqstat.mq_msgsize = BUFFER + 1; - mqstat.mq_maxmsg = BUFFER + 1; - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &mqstat); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr, strlen(msgptr), prio) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) > 0) { - printf("FAIL: mq_timedreceive succeed unexpectly\n"); - failure = 1; - } - else { - if (EMSGSIZE != errno) { - printf("errno != EMSGSIZE \n"); - failure = 1; - } - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/16-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/16-1.sh deleted file mode 100755 index c52853521f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/16-1.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# mq_timedreceive() will fail with EINTR if mq_receive() is interrupted by a signal. - -# This is tested implicitly via assertion 5. - -echo "Tested implicitly via assertion 5. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/17-1.c deleted file mode 100644 index dbbc0eabb0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/17-1.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * mq_timedreceive() will fail with EINVAL if message queue is - * empty and nanoseconds field value of abs_timeout is less than 0. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "17-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = -1; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) == -1) { - if (EINVAL != errno) { - printf("errno != EINVAL \n"); - failure = 1; - } - } - else { - printf("FAIL: mq_timedreceive() succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/17-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/17-2.c deleted file mode 100644 index 764298bbf6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/17-2.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * mq_timedreceive() will fail with EINVAL if message queue is - * empty and nanoseconds field value of abs_timeout greater than - * or equal to 1000 million. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "17-2" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = 1000000000; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) == -1) { - if (EINVAL != errno) { - printf("errno != EINVAL \n"); - failure = 1; - } - } - else { - printf("FAIL: mq_timedreceive() succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/17-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/17-3.c deleted file mode 100644 index 676fb5d96e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/17-3.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * mq_timedreceive() will fail with EINVAL if message queue is - * empty and nanoseconds field value of abs_timeout greater than - * 1000 million. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "17-3" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = 1000000000 + 1; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) == -1) { - if (EINVAL != errno) { - printf("errno != EINVAL \n"); - failure = 1; - } - } - else { - printf("FAIL: mq_timedreceive() succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/18-1.c deleted file mode 100644 index ea904e3d3f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/18-1.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * mq_timedreceive() will fail with ETIMEDOUT when O_NONBLOCK is not - * set and no message arrived before the timout expired. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "18-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 -#define TIMEOUT 3 - -int blocking = 0; -void exit_handler(int signo) -{ - printf("FAIL: the case is blocking, exit anyway \n"); - blocking = 1; - return; -} - - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct timespec ts; - pid_t pid; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - if ((pid = fork()) != 0) { - /* Parent process */ - struct sigaction act; - act.sa_handler=exit_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGABRT, &act, 0); - - ts.tv_sec = time(NULL) + TIMEOUT; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) == -1) { - if (ETIMEDOUT != errno) { - printf("errno != ETIMEDOUT \n"); - failure = 1; - } - } - else { - printf("FAIL: mq_timedreceive() succeed unexpectly \n"); - failure = 1; - } - /* parent is not blocking on mq_timedreceive, kill child */ - kill(pid, SIGABRT); - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1 || blocking==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - sleep(TIMEOUT + 3); /* Parent is probably blocking, - send a signal to let it abort */ - kill(getppid(), SIGABRT); - return 0; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/18-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/18-2.c deleted file mode 100644 index 275e15bf1a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/18-2.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * Test that if abs_timeout has already passed the time - * at the time mq_timedreceive() called, the timeout will expire. - * mq_timedreceive() will return with ETIMEDOUT. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "18-2" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 -#define TIMEOUT 3 - -int blocking = 0; -void exit_handler(int signo) -{ - printf("FAIL: the case is blocking, exit anyway \n"); - blocking = 1; - return; -} -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct timespec ts; - struct mq_attr attr; - pid_t pid; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if ((pid = fork()) != 0) { - /* Parent process */ - struct sigaction act; - act.sa_handler=exit_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGABRT, &act, 0); - - ts.tv_sec = time(NULL) - TIMEOUT; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) != -1) { - printf("FAIL: mq_timedreceive succeed unexpectely\n"); - failure = 1; - } - else { - if (errno != ETIMEDOUT) { - printf("errno != ETIMEDOUT\n"); - failure = 1; - } - } - /* Parent is not blocking, let child abort */ - kill(pid, SIGABRT); - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1 || blocking==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - sleep(TIMEOUT + 3); /* Parent is probably blocking - send a signal to let it abort */ - kill(getppid(), SIGABRT); - return 0; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/2-1.c deleted file mode 100644 index e80c53153b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/2-1.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive test plan: - * If the buffer size is less than the mq_msgsize attribute, the function - * will fail and return an error. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 20 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - const char *msgptr = "test message"; - mqd_t mqdes; - int prio = 1; - struct mq_attr mqstat; - struct timespec ts; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - memset(&mqstat,0,sizeof(mqstat)); - mqstat.mq_msgsize = BUFFER + 1; - mqstat.mq_maxmsg = BUFFER + 1; - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &mqstat); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr, strlen(msgptr), prio) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) > 0) { - printf("FAIL: mq_timedreceive succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/4-1.sh deleted file mode 100755 index 71efe4e41e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/4-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test if the msg_prio is not NULL, the priority of the selected -# message will be stored in the location pointed by msg_prio. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/5-1.c deleted file mode 100644 index a3f6777f1c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/5-1.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * Test that if the message queue is empty and O_NONBLOCK is not set, - * mq_timedreceive() will block until a message is enqueued on the - * message queue. - * - * NOTE: This test makes some assumptions and has some potential race - * conditions, but seems the best way to test for now. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - const char *msgptr = "test message "; - mqd_t mqdes; - int prio = 1; - int pid; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if ((pid = fork()) != 0) { - /* Parent process */ - int status; - ts.tv_sec = INT32_MAX; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) > 0) { - wait(&status); - if (WEXITSTATUS(status)) { - printf("mq_send error \n"); - unresolved = 1; - } - } - else { - printf("mq_timedreceive didn't block on waiting \n"); - wait(NULL); /* wait for child to exit */ - perror(ERROR_PREFIX "mq_timedreceive"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - /* Child Process */ - sleep(2); /* sleep 2 seconds, - assume that parent will block on waiting then */ - if (mq_send(mqdes, msgptr, strlen(msgptr), prio) == -1) { - perror(ERROR_PREFIX "mq_send"); - return PTS_UNRESOLVED; - } - return 0; - } - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/5-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/5-2.c deleted file mode 100644 index 5afe2a3323..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/5-2.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * Test that if the message queue is empty and O_NONBLOCK is not set, - * mq_timedreceive() will block until timeout expires. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-2" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 -#define TIMEOUT 3 - -int blocking = 0; -void exit_handler(int signo) -{ - printf("FAIL: the case is blocking, exit anyway \n"); - blocking = 1; - return; -} -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct timespec ts; - time_t oldtime, newtime; - struct mq_attr attr; - pid_t pid; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if ((pid = fork()) != 0) { - /* Parent process */ - struct sigaction act; - act.sa_handler=exit_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGABRT, &act, 0); - - ts.tv_sec = time(NULL) + TIMEOUT; - ts.tv_nsec = 0; - oldtime = time(NULL); - mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts); - newtime = time(NULL); - if ((newtime - oldtime) < TIMEOUT) { - printf("FAIL: mq_timedreceive didn't block until timout expires\n"); - failure = 1; - } - /* Parent is not blocking, let child abort */ - kill(pid, SIGABRT); - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1 || blocking==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - sleep(TIMEOUT + 3); /* Parent is probably blocking - send a signal to let it abort */ - kill(getppid(), SIGABRT); - return 0; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/5-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/5-3.c deleted file mode 100644 index bbdec0bbe6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/5-3.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * Test that if the message queue is empty and O_NONBLOCK is not set, - * mq_timedreceive() will block until mq_timedreceive() is interrupted by a - * signal. - * - * NOTE: This test makes some assumptions and has some potential race - * conditions, but seems the best way to test for now. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-3" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -void stopreceive(int signo) -{ - return; -} -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - int pid; - struct mq_attr attr; - struct timespec ts; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - if ((pid = fork()) != 0) { - /* Parent process */ - struct sigaction act; - act.sa_handler = stopreceive; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGABRT, &act, 0); - - ts.tv_sec = INT32_MAX; - ts.tv_nsec = 0; - - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) == -1) { - wait(NULL); - if (EINTR != errno) { - printf("errno != EINTR \n"); - failure = 1; - } - } - else { - wait(NULL); - printf("mq_timedreceive() succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - if (mq_unlink(mqname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - /* Child Process */ - sleep(1); /* give time to parent to set up handler */ - /* send signal to parent */ - kill(getppid(), SIGABRT); - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/7-1.c deleted file mode 100644 index 785ffa6fdd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/7-1.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive() test plan: - * If message queue is empty and O_NONBLOCK is set in the message queue, - * no message will be removed from the queue, mq_timedreceive will return an - * error. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "7-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_NONBLOCK | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = 0; - if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) != -1) { - printf("mq_timedreceive succeed unexpectly \n"); - failure = 1; - } - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/8-1.c deleted file mode 100644 index 1b27b0fa3a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/8-1.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2003 - 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * adam.li@intel.com - */ -/* - * If Timers option is supported, then abs_timeout is based on - * CLOCK_REALTIME. - * Otherwise, the timeout is based on the system clock (time() function). - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "8-1" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 -#define TIMEOUT 3 - -int blocking = 0; -void exit_handler(int signo) -{ - printf("FAIL: the case is blocking, exit anyway \n"); - blocking = 1; - return; -} -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - mqd_t mqdes; - struct timespec ts; - time_t oldtime, newtime; - struct mq_attr attr; - pid_t pid; - int unresolved = 0, failure = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if ((pid = fork()) != 0) { - /* Parent process */ - struct sigaction act; - act.sa_handler=exit_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGABRT, &act, 0); -#ifdef _POSIX_TIMERS - printf("Using CLOCK_REALTIME\n"); - clock_gettime(CLOCK_REALTIME, &ts); - oldtime = ts.tv_sec; - ts.tv_sec = ts.tv_sec + TIMEOUT; -#else - ts.tv_sec = time(NULL) + TIMEOUT; - oldtime = time(NULL); -#endif - ts.tv_nsec = 0; - mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts); -#ifdef _POSIX_TIMERS - clock_gettime(CLOCK_REALTIME, &ts); - newtime = ts.tv_sec; -#else - newtime = time(NULL); -#endif - if ((newtime - oldtime) < TIMEOUT) { - printf("FAIL: mq_timedreceive didn't block until timout expires\n"); - failure = 1; - } - /* Parent is not blocking, let child abort */ - kill(pid, SIGABRT); - wait(NULL); - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - if (failure==1 || blocking==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - sleep(TIMEOUT + 3); /* Parent is probably blocking - send a signal to let it abort */ - kill(getppid(), SIGABRT); - return 0; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/assertions.xml deleted file mode 100644 index 8cd60d1c26..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/assertions.xml +++ /dev/null @@ -1,63 +0,0 @@ - - -mq_timedreceive() receive the oldest of the highest priority message(s) from the message queue specified by mqdes. The selected message will be removed from the queue and copied to the buffer pointed to by the msg_ptr argument. - - -mq_timedreceive() will fail and return an error if the size of the buffer in bytes, specified by the msg_len argument, is less than the mq_msgsize attribute of the message queue. - - -if msg_len is greater than SSIZE_MAX, the result is implementation-defined. - - -If msg_prio is not NULL, the priority of the selected message will be stored in the location referenced by msg_prio. - - -If the specified message queue is empty and O_NONBLOCK is not set, then mq_timedreceive() will block until a message is enqueued on the message queue or until a signal interrupts mq_timedreceive() or until the time specified by abs_timeout expires. -abs_timeout refers to the absolute time at which the timeout will expire -(current time meets or exceeds that time). - - -If there are more than one thread waiting to receive a message when a message arrives at an empty queue and the Priority Scheduling option is supported, then the thread with highest priority that has been waiting the longest will receive the message. If Priority Scheduling option is not supported, then it is unspecified which waiting thread is able to receive the message. - - -If the specified message queue is empty and O_NONBLOCK is set, no message will be removed from the queue, and mq_timedreceive() will return an error. - - -If Timers option is supported, then abs_timeout is based on CLOCK_REALTIME. -Otherwise, the timeout is based on the system clock (time() function). - - -The timeout has the same resolution as the clock it is based on. - - -If the message can be removed from the message queue immedietely, the operation will never fail and the validity of abs_timeout need not be checked. - - -mq_timedreceive() will return the length of the selected message in bytes and the message will be removed from the queue on success. - - -mq_timedreceive() will return -1 on failure, no message will be removed from the queue, and the errno will be set. - - -mq_timedreceive() will return EAGAIN if O_NONBLOCK is set and the message queue is empty. - - -mq_timedreceive() will return EBADF if mqdes is not a valid message queue descriptor open for reading. - - -mq_timedreceive() will return EMSGSIZE if the specified buffer size, msg_len, is less than the message size attribute of the message queue. - - -mq_timedreceive() will return EINTR if it is interrupted by a signal - - -mq_timedreceive() will return EINVAL if the process or thread have blocked, and abs_timeout had a tv_nsec field less than zero or greater than or equal to 1000 million. - - -mq_timedreceive() will return ETIMEDOUT if O_NONBLOCK was not set when open the message queue, and no message arrived on the queue before the timeout expired. -If abs_timeout has already passed the time at the time mq_timedreceive() called, the timeout shall expire too. - - -mq_timedreceive() will return EBADMSG if the implementation has detected a data corruption problem with the message. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/coverage.txt deleted file mode 100644 index dfad317741..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/coverage.txt +++ /dev/null @@ -1,22 +0,0 @@ -This document defines the coverage for the mq_timedreceive function: - -Assertion Tested? -1 YES -2 YES -3 NO - implementation-defined, won't test. -4 YES -5 YES -6 NO - won't test. -7 YES -8 YES -9 NO -10 YES -11 YES -12 YES -13 YES -14 YES -15 YES -16 YES -17 YES -18 YES -19 NO - won't test diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/speculative/10-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/speculative/10-2.c deleted file mode 100644 index 4c114d4c63..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedreceive/speculative/10-2.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_timedreceive test plan: - * If message can be removed from message queue immediately, the validity - * of timout need not be checked. - * - * This is a speculative test because if abs_timeout _is_ checked for - * validity, it is not a failure. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "10-2" -#define FUNCTION "mq_timedreceive" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 -#define BUFFER 40 - -int main() -{ - char mqname[NAMESIZE], msgrv[BUFFER]; - const char *msgptr = "test message"; - mqd_t mqdes; - unsigned rvprio, sdprio = 1; - struct timespec ts; - struct mq_attr attr; - int unresolved = 0; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - unresolved = 1; - } - - if (mq_send(mqdes, msgptr, strlen(msgptr), sdprio) != 0) { - perror(ERROR_PREFIX "mq_send"); - unresolved = 1; - } - - ts.tv_sec = time(NULL) + 1; - ts.tv_nsec = -1; - if (mq_timedreceive(mqdes, msgrv, BUFFER, &rvprio, &ts) == -1) { - printf("mq_timedreceive() did fail on invalid abs_time\n"); - } - else { - printf("mq_timedreceive() did not fail on invalid abs_time\n"); - } - - if (mq_close(mqdes) != 0) { - perror(ERROR_PREFIX "mq_close"); - unresolved = 1; - } - - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink"); - unresolved = 1; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/1-1.c deleted file mode 100644 index 18a2cfff73..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/1-1.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Basic test that mq_timedsend() actually places a message into mqdes. Verify - * by ensuring the message can be received. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 10 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0; - unsigned pri; - - sprintf(qname, "/mq_timedsend_1-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - if (mq_timedsend(queue, msgptr, strlen(msgptr), 1, &ts) != 0) { - perror("mq_timedsend() did not return success"); - failure=1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr, msgrcd, strlen(msgptr)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr, msgrcd); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/10-1.c deleted file mode 100644 index dbaf045c39..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/10-1.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if O_NONBLOCK is set and the message queue is full, mq_timedsend() - * will set errno == EAGAIN (subset of 7-1.c). - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MESSAGESIZE 50 - -#define BUFFER 100 -#define MAXMSG 5 - -int main() -{ - char qname[NAMESIZE]; - char msgptr[MESSAGESIZE]; - struct timespec ts; - struct mq_attr attr; - mqd_t queue; - int unresolved=0, failure=0, i, maxreached=0; - - sprintf(qname, "/mq_timedsend_10-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT | O_RDWR | O_NONBLOCK, - S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - int unresolved=0, failure=0; - - sprintf(qname, "/mq_timedsend_11-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - if (mq_timedsend(queue+1, msgptr, strlen(msgptr), 1, &ts) != -1) { - printf("mq_timedsend() did not return -1 on invalid queue\n"); - failure=1; - } - - if (errno != EBADF) { - printf("errno != EBADF\n"); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/11-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/11-2.c deleted file mode 100644 index 128ed8ff55..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/11-2.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_timedsend() returns errno == EBADF if mqdes is not open for - * writing. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - int unresolved=0, failure=0; - - sprintf(qname, "/mq_timedsend_11-2_%d", getpid()); - - queue = mq_open(qname, O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - if (mq_timedsend(queue, msgptr, strlen(msgptr), 1, &ts) != -1) { - printf("mq_timedsend() did not return -1 on invalid queue\n"); - failure=1; - } - - if (errno != EBADF) { - printf("errno != EBADF\n"); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/12-1.c deleted file mode 100644 index 9bc08a0a6d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/12-1.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test mq_timedsend() will set errno == EINTR if it is interrupted by a signal. - * - * Steps: - * 1. Create a thread and set up a signal handler for SIGUSR1 - * 2. Thread indicates to main that it is ready to start calling mq_timedsend until it - * blocks for a timeout of 10 seconds. - * 3. In main, send the thread the SIGUSR1 signal while mq_timedsend is blocking. - * 4. Check to make sure that mq_timedsend blocked, and that it returned EINTR when it was - * interrupted by SIGUSR1. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 10 - -#define INTHREAD 0 -#define INMAIN 1 - -int sem; /* manual semaphore */ -int in_handler; /* flag to indicate signal handler was called */ -int errno_eintr; /* flag to indicate that errno was set to eintr when mq_timedsend() - was interruped. */ - -/* - * This handler is just used to catch the signal and stop sleep (so the - * parent knows the child is still busy sending signals). - */ -void justreturn_handler(int signo) -{ - /* Indicate that the signal handler was called */ - in_handler=1; - return; -} - -void *a_thread_func() -{ - - int i; - struct sigaction act; - char gqname[NAMESIZE]; - mqd_t gqueue; - const char *msgptr = MSGSTR; - struct mq_attr attr; - struct timespec ts; - - /* Set up handler for SIGUSR1 */ - act.sa_handler=justreturn_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGUSR1, &act, 0); - - /* Set up mq */ - sprintf(gqname, "/mq_timedsend_12-1_%d", getpid()); - - attr.mq_maxmsg = MAXMSG; - attr.mq_msgsize = BUFFER; - gqueue = mq_open(gqname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (gqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - pthread_exit((void*)PTS_UNRESOLVED); - return NULL; - } - - /* mq_timedsend will block for 10 seconds when it waits */ - ts.tv_sec=time(NULL)+10; - ts.tv_nsec=0; - - /* Tell main it can go ahead and start sending SIGUSR1 signal */ - sem = INMAIN; - - for (i=0; i= MQ_PRIO_MAX or < 0 (<0 N/A - * for an unsigned, so not tested). - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define NUMINVALID 3 - -static unsigned invalidpri[NUMINVALID] = { - MQ_PRIO_MAX, MQ_PRIO_MAX+1, MQ_PRIO_MAX+5 -}; - - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - int unresolved=0, failure=0, i; - - sprintf(qname, "/mq_timedsend_13-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - for (i=0; imq_msgsize. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "01234567890123456789" -#define NUMINVALID 3 - -static long messagesize[NUMINVALID] = { - 19, 2, 1 -}; - - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - int unresolved=0, failure=0, i; - struct mq_attr attr; - - sprintf(qname, "/mq_timedsend_14-1_%d", getpid()); - - ts.tv_sec=time(NULL); - ts.tv_nsec=0; - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define TIMEOUT 5 -#define DELTA 1 -#define BUFFER 40 -#define MAXMSG 5 - -char gqname[NAMESIZE]; -mqd_t gqueue; - -void testfailed_handler(int signo) -{ - printf("Timeout never happened\n"); - printf("Test FAILED\n"); - mq_close(gqueue); - mq_unlink(gqname); - exit(PTS_FAIL); -} - -int main() -{ - char *msgptr=MSGSTR; - struct timespec ts; - struct sigaction act; - struct mq_attr attr; - time_t currsec; - int maxreached=0, i; - - sprintf(gqname, "/mq_timedsend_15-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - gqueue = mq_open(gqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (gqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - currsec = time(NULL); - - ts.tv_sec=currsec-5; //time in past - ts.tv_nsec=0; - - /* - * If timeout never happens, set up an alarm that will go off - * after TIMEOUT seconds and call a handler to end the test - */ - act.sa_handler=testfailed_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - alarm(TIMEOUT); - - for (i=0; i currsec+DELTA) { - printf("Timeout lasted too long\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/16-1.c deleted file mode 100644 index eea709567b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/16-1.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * adam.li@intel.com - 2004-04-29 - */ - -/* - * Test that if the message queue is full and O_NONBLOCK is not set, - * mq_timedsend() will block until abs_timeout is reached. - * - * Test by sending messages in a child process until the message queue is full. - * At this point, the child should be blocking on sending. Then, have the - * parent wait for the timeout and return pass when the next message is sent - * to the message queue. - * - * If Timers is supported, then abs_timeout is based on CLOCK_REALTIME. - * Otherwise, the timeout is based on the system clock (time() function). - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 5 - -#define TIMEOUT 7 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -char gqname[NAMESIZE]; -mqd_t gqueue; - -/* - * This handler is just used to catch the signal and stop sleep (so the - * parent knows the child is still busy sending signals). - */ -void stopsleep_handler(int signo) -{ - return; -} - -int main() -{ - int pid; - struct mq_attr attr; - const char *msgptr = MSGSTR; - - sprintf(gqname, "/mq_timedsend_16-1_%d", getpid()); - - attr.mq_maxmsg = MAXMSG; - attr.mq_msgsize = BUFFER; - gqueue = mq_open(gqname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - mq_unlink(gqname); - if (gqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - int i, sig; - struct timespec ts; - sigset_t mask; - - /* wait for parent to set up handler */ - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigprocmask(SIG_BLOCK,&mask,NULL); - sigwait(&mask, &sig); - - /* child should block in < TIMEOUT seconds */ -#ifdef _POSIX_TIMERS - printf("Using CLOCK_REALTIME\n"); - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += TIMEOUT; -#else - ts.tv_sec=time(NULL)+TIMEOUT; -#endif - ts.tv_nsec=0; - - for (i=0; i -#include "posixtest.h" - -int main() -{ - printf("Will not test timeout resolution.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/18-1.c deleted file mode 100644 index 115b03cbc2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/18-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Basic test that if the queue already has room, then mq_timedsend() - * does not fail. - * - * Test by calling mq_timedsend() with an already expired timeout value - * on an empty queue. Should succeed. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - - sprintf(qname, "/mq_timedsend_18-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)-1; - ts.tv_nsec=0; - if (mq_timedsend(queue, msgptr, strlen(msgptr), 1, &ts) != 0) { - perror("mq_timedsend() did not return success on empty queue"); - printf("Test FAILED\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_FAIL; - } - - mq_close(queue); - mq_unlink(qname); - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/19-1.c deleted file mode 100644 index a1ae2d8474..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/19-1.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_timedsend() will return EINVAL if the message queue is - * full and abs_timeout has a tv_nsec < 0 or >= 1000 million. - * - * Fill message queue until full and then call mq_timedsend with invalid - * abs_timeout values. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define NUMTESTS 5 -#define BUFFER 40 -#define MAXMSG 5 - -int invalid_tests[NUMTESTS] = {-1, INT32_MIN, 1000000000, 1000000001 , - INT32_MAX }; - -int main() -{ - char qname[NAMESIZE]; - char *msgptr=MSGSTR; - struct timespec ts; - mqd_t queue; - struct mq_attr attr; - int failure=0, i, maxreached=0; - - sprintf(qname, "/mq_timedsend_19-1_%d", getpid()); - - attr.mq_maxmsg = MAXMSG; - attr.mq_msgsize = BUFFER; - queue = mq_open(qname, O_CREAT | O_RDWR | O_NONBLOCK, - S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL); - ts.tv_nsec=0; - for (i=0; imq_msgsize. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "01234567890123456789" -#define MSGSIZE 10 // < strlen(MSGSTR) - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - int unresolved=0, failure=0; - struct mq_attr attr; - - sprintf(qname, "/mq_timedsend_2-1_%d", getpid()); - - attr.mq_msgsize = MSGSIZE; - attr.mq_maxmsg = MSGSIZE; - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - if (mq_timedsend(queue, msgptr, strlen(msgptr), 1, &ts) == 0) { - printf("mq_timedsend() ret success w/msg_len>=mq_msgsize\n"); - failure=1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/20-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/20-1.c deleted file mode 100644 index 977ae5bec7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/20-1.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_timedsend() will return ETIMEDOUT if O_NONBLOCK - * was not set when mq_open() was called and the message could - * not be added to the queue because it timed out. - * - * Test by sending messages until a block happens and then verify - * that mq_timedsend() times out. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define TIMEOUT 5 -#define DELTA 1 - -#define BUFFER 40 -#define MAXMSG 5 - -char gqname[NAMESIZE]; -mqd_t gqueue; - -void testfailed_handler(int signo) -{ - printf("Timeout never happened\n"); - printf("Test FAILED\n"); - mq_close(gqueue); - mq_unlink(gqname); - exit(PTS_FAIL); -} - -int main() -{ - char *msgptr=MSGSTR; - struct timespec ts; - struct sigaction act; - time_t currsec; - struct mq_attr attr; - int failure=0, i, maxreached=0; - - sprintf(gqname, "/mq_timedsend_20-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - gqueue = mq_open(gqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (gqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - currsec = time(NULL); - - ts.tv_sec=currsec+TIMEOUT; - ts.tv_nsec=0; - - /* - * If timeout never happens, set up an alarm that will go off - * after TIMEOUT+1 seconds and call a handler to end the test - */ - act.sa_handler=testfailed_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - alarm(TIMEOUT+1); - - for (i=0; i ts.tv_sec+DELTA) { - printf("Timeout lasted too long\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/3-1.c deleted file mode 100644 index c1d9c2abb3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/3-1.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_timedsend() inserts messages into the message queue according - * to the priority given. - * Test by inserting multiple messages into the queue not in priority order. - * Ensure messages are received in priority order. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSG1 "1234567890" -#define PRI1 10 -#define MSG2 "234567890" -#define PRI2 8 -#define MSG3 "34567890" -#define PRI3 6 -#define MSG4 "4567890" -#define PRI4 2 -#define MSG5 "567890" -#define PRI5 1 -#define BUFFER 40 -#define MAXMSG 10 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr1 = MSG1; - const char *msgptr2 = MSG2; - const char *msgptr3 = MSG3; - const char *msgptr4 = MSG4; - const char *msgptr5 = MSG5; - struct timespec ts; - struct mq_attr attr; - mqd_t queue; - int unresolved=0, failure=0; - unsigned pri; - - sprintf(qname, "/mq_timedsend_3-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - if (mq_timedsend(queue, msgptr3, strlen(msgptr3), PRI3, &ts) != 0) { - perror("mq_timedsend() did not return success"); - failure=1; - } - - ts.tv_sec++; - if (mq_timedsend(queue, msgptr1, strlen(msgptr1), PRI1, &ts) != 0) { - perror("mq_timedsend() did not return success"); - failure=1; - } - - ts.tv_sec++; - if (mq_timedsend(queue, msgptr4, strlen(msgptr4), PRI4, &ts) != 0) { - perror("mq_timedsend() did not return success"); - failure=1; - } - - ts.tv_sec++; - if (mq_timedsend(queue, msgptr2, strlen(msgptr2), PRI2, &ts) != 0) { - perror("mq_timedsend() did not return success"); - failure=1; - } - - ts.tv_sec++; - if (mq_timedsend(queue, msgptr5, strlen(msgptr5), PRI5, &ts) != 0) { - perror("mq_timedsend() did not return success"); - failure=1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr1, msgrcd, strlen(msgptr1)) != 0) { - printf("FAIL: expected %s received %s\n", msgptr1, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr2, msgrcd, strlen(msgptr2)) != 0) { - printf("FAIL: expected %s received %s\n", msgptr2, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr3, msgrcd, strlen(msgptr3)) != 0) { - printf("FAIL: expected %s received %s\n", msgptr3, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr4, msgrcd, strlen(msgptr4)) != 0) { - printf("FAIL: expected %s received %s\n", msgptr4, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr5, msgrcd, strlen(msgptr5)) != 0) { - printf("FAIL: expected %s received %s\n", msgptr5, msgrcd); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/3-2.c deleted file mode 100644 index e9f90d3950..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/3-2.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_timedsend() inserts messages into the message queue according - * to the priority given. Specifically, test that messages with equal - * priority values are placed after previously sent messages. - * - * Test similar to 3-1.c; however, messages 3 and 4 will have equal priority - * order, but 3 will be sent first. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSG1 "1234567890" -#define PRI1 10 -#define MSG2 "234567890" -#define PRI2 8 -#define MSG3 "34567890" -#define PRI3 2 -#define MSG4 "4567890" -#define PRI4 2 -#define MSG5 "567890" -#define PRI5 1 -#define BUFFER 40 -#define MAXMSG 10 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr1 = MSG1; - const char *msgptr2 = MSG2; - const char *msgptr3 = MSG3; - const char *msgptr4 = MSG4; - const char *msgptr5 = MSG5; - struct timespec ts; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0; - unsigned pri; - - sprintf(qname, "/mq_timedsend_3-2_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - if (mq_timedsend(queue, msgptr3, strlen(msgptr3), PRI3, &ts) != 0) { - perror("mq_timedsend() did not return success"); - printf("error sending %s\n", msgptr3); - failure=1; - } - - ts.tv_sec++; - if (mq_timedsend(queue, msgptr1, strlen(msgptr1), PRI1, &ts) != 0) { - perror("mq_timedsend() did not return success"); - printf("error sending %s\n", msgptr1); - failure=1; - } - - ts.tv_sec++; - if (mq_timedsend(queue, msgptr4, strlen(msgptr4), PRI4, &ts) != 0) { - perror("mq_timedsend() did not return success"); - printf("error sending %s\n", msgptr4); - failure=1; - } - - ts.tv_sec++; - if (mq_timedsend(queue, msgptr2, strlen(msgptr2), PRI2, &ts) != 0) { - perror("mq_timedsend() did not return success"); - printf("error sending %s\n", msgptr2); - failure=1; - } - - ts.tv_sec++; - if (mq_timedsend(queue, msgptr5, strlen(msgptr5), PRI5, &ts) != 0) { - perror("mq_timedsend() did not return success"); - printf("error sending %s\n", msgptr5); - failure=1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr1, msgrcd, strlen(msgptr1)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr1, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr2, msgrcd, strlen(msgptr2)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr2, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr3, msgrcd, strlen(msgptr3)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr3, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr4, msgrcd, strlen(msgptr4)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr4, msgrcd); - failure = 1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr5, msgrcd, strlen(msgptr5)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr5, msgrcd); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/4-1.c deleted file mode 100644 index 52a0078f7b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/4-1.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that msg_prio must be less than MQ_PRIO_MAX. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - int unresolved=0, failure=0; - - sprintf(qname, "/mq_timedsend_4-1_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - if (mq_timedsend(queue, msgptr, strlen(msgptr), MQ_PRIO_MAX+1, &ts) - == 0) { - printf("mq_timedsend() ret success with pri > MQ_PRIO_MAX\n"); - failure=1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/4-2.c deleted file mode 100644 index e040008eeb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/4-2.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that msg_prio cannot be equal to MQ_PRIO_MAX. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - int unresolved=0, failure=0; - - sprintf(qname, "/mq_timedsend_4-2_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - if (mq_timedsend(queue, msgptr, strlen(msgptr), MQ_PRIO_MAX, &ts) - == 0) { - printf("mq_timedsend() ret success with pri = MQ_PRIO_MAX\n"); - failure=1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/4-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/4-3.c deleted file mode 100644 index d80246a1fd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/4-3.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that msg_prio can be equal to MQ_PRIO_MAX-1. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 5 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0; - unsigned pri; - - sprintf(qname, "/mq_timedsend_4-3_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - if (mq_timedsend(queue, msgptr, strlen(msgptr), MQ_PRIO_MAX-1, &ts) - != 0) { - perror("mq_timedsend() did not return success"); - failure=1; - } - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - failure=1; - } - - if (strncmp(msgptr, msgrcd, strlen(msgptr)) != 0) { - printf("FAIL: sent %s received %s\n", msgptr, msgrcd); - failure = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/5-1.c deleted file mode 100644 index 01efb460f9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/5-1.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if the message queue is full and O_NONBLOCK is not set, - * mq_timedsend() will block until it can place the message in the queue. - * - * Test by sending messages in a child process until the message queue is full. - * At this point, the child should be blocking on sending. Then, have the - * parent receive the message and return pass when the next message is sent - * to the message queue. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 5 - -char gqname[NAMESIZE]; -mqd_t gqueue; - -/* - * This handler is just used to catch the signal and stop sleep (so the - * parent knows the child is still busy sending signals). - */ -void stopsleep_handler(int signo) -{ - return; -} - -int main() -{ - int pid; - char msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - struct mq_attr attr; - int unresolved=0; - unsigned pri; - - sprintf(gqname, "/mq_timedsend_5-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - gqueue = mq_open(gqname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (gqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - int i; - struct timespec ts; - - /* set up timeout to be as long as possible */ - ts.tv_sec=INT32_MAX; - ts.tv_nsec=0; - - sleep(1); // give parent time to set up handler - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 5 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -char gqname[NAMESIZE]; -mqd_t gqueue; - -/* - * This handler is just used to catch the signal and stop sleep (so the - * parent knows the child is still busy sending signals). - */ -void justreturn_handler(int signo) -{ - return; -} - -int main() -{ - int pid; - const char *msgptr = MSGSTR; - struct mq_attr attr; - struct sigaction act; - - sprintf(gqname, "/mq_timedsend_5-2_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - gqueue = mq_open(gqname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (gqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - /* parent and child use justreturn_handler to just return out of - * situations -- parent uses to stop it's sleep and wait again for - * the child; child uses to stop its mq_timedsend - */ - act.sa_handler=justreturn_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGABRT, &act, 0); - - if ((pid = fork()) == 0) { - /* child here */ - int i; - struct timespec ts; - /* set up timeout to be as long as possible */ - ts.tv_sec=INT32_MAX; - ts.tv_nsec=0; - - sleep(1); // give parent time to set up handler - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 5 - -#define TIMEOUT 7 - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -char gqname[NAMESIZE]; -mqd_t gqueue; - -/* - * This handler is just used to catch the signal and stop sleep (so the - * parent knows the child is still busy sending signals). - */ -void stopsleep_handler(int signo) -{ - return; -} - -int main() -{ - int pid; - struct mq_attr attr; - const char *msgptr = MSGSTR; - - sprintf(gqname, "/mq_timedsend_5-3_%d", getpid()); - - attr.mq_maxmsg = MAXMSG; - attr.mq_msgsize = BUFFER; - gqueue = mq_open(gqname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (gqueue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - int i, sig; - struct timespec ts; - sigset_t mask; - - /* wait for parent to set up handler */ - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigprocmask(SIG_BLOCK,&mask,NULL); - sigwait(&mask, &sig); - - /* child should block in < TIMEOUT seconds */ - ts.tv_sec=time(NULL)+TIMEOUT; - ts.tv_nsec=0; - - for (i=0; i -#include "posixtest.h" - -int main() -{ - printf("Priority Scheduling needed to make a reliable test case\n"); - printf("for this instance. Will not be tested.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/7-1.c deleted file mode 100644 index 6fd87d7eb7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/7-1.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that if O_NONBLOCK is set and the message queue is full, mq_timedsend() - * will just return an error message and the message will not be queued. - * - * Test by sending messages with increasing priority number until a failure - * is received. Then test that the message just sent (highest priority) is - * not the one received. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_msgsize >= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MESSAGESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 5 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - char msgptr[MESSAGESIZE]; - struct timespec ts; - struct mq_attr attr; - mqd_t queue; - int unresolved=0, failure=0, spri=1, i, maxreached=0; - unsigned pri; - - sprintf(qname, "/mq_timedsend_7-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT | O_RDWR | O_NONBLOCK, - S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL); - ts.tv_nsec=0; - for (i=0; i= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 -#define MAXMSG 5 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, ret; - unsigned pri; - - sprintf(qname, "/mq_timedsend_8-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = MAXMSG; - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - ret = mq_timedsend(queue, msgptr, strlen(msgptr), 1, &ts); - - if (mq_receive(queue, msgrcd, BUFFER, &pri) == -1) { - perror("mq_receive() returned failure"); - unresolved=1; - } - - if (strncmp(msgptr, msgrcd, strlen(msgptr)) != 0) { - printf("send was unsuccessful: sent %s received %s\n", - msgptr, msgrcd); - unresolved = 1; - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - if (ret != 0) { - printf("mq_timedsend() did not return 0 on success\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/9-1.c deleted file mode 100644 index b977715430..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/9-1.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test that mq_timedsend() returns -1 on failure, no message is queued, and - * errno is set. - * The failure case chosen is an invalid message queue descriptor. - * - * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr - * with a mq_maxmsg >= BUFFER. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" -#define BUFFER 40 - -int main() -{ - char qname[NAMESIZE], msgrcd[BUFFER]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - struct mq_attr attr; - int unresolved=0, failure=0; - unsigned pri; - - sprintf(qname, "/mq_timedsend_9-1_%d", getpid()); - - attr.mq_msgsize = BUFFER; - attr.mq_maxmsg = BUFFER; - queue = mq_open(qname, O_CREAT |O_RDWR | O_NONBLOCK, - S_IRUSR | S_IWUSR, &attr); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - return PTS_UNRESOLVED; - } - - // Verify mq_timedsend() returns -1 - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - if (mq_timedsend(queue+1, msgptr, strlen(msgptr), 1, &ts) != -1) { - printf("mq_timedsend() did not return -1 on invalid queue\n"); - failure=1; - } - - // Verify errno is set - if (errno != EBADF) { - printf("errno was not set on invalid queue\n"); - failure = 1; - } - - // Verify message was not queued (cannot be received) - if (mq_receive(queue, msgrcd, BUFFER, &pri) != -1) { - if (strcmp(msgptr, msgrcd) == 0) { - printf("Message ended up being sent\n"); - failure = 1; - } else { - printf("Error with mq_receive()\n"); - unresolved = 1; - } - } - - if (mq_close(queue) != 0) { - perror("mq_close() did not return success"); - unresolved=1; - } - - if (mq_unlink(qname) != 0) { - perror("mq_unlink() did not return success"); - unresolved=1; - } - - if (failure==1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (unresolved==1) { - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/assertions.xml deleted file mode 100644 index 465101af79..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/assertions.xml +++ /dev/null @@ -1,91 +0,0 @@ - - -mq_timedsend() places the message msg_ptr points to into message queue mqdes - - -mq_timedsend() will fail if msg_len, the message length, is not less than or -equal to mq_attr->mq_msgsize. - - -mq_timedsend() will insert the message into the message queue according to -msg_prio (if the message queue is not full): -- Larger msg_prio values mean the message is inserted before those with - lower values. -- For messages with equal msg_prio values, the message is inserted after - those. - - -msg_prio must be less than MQ_PRIO_MAX - - -If the message queue pointed to by msg_ptr is full and O_NONBLOCK is not -set, then mq_timedsend() will block until it can place the message in the queue -or until a signal interrupts mq_timedsend() or when the time specified by -abs_timeout expires. - -abs_timeout refers to the absolute time at which the timeout will expire -(current time meets or exceeds that time). - - -If there are greater than one threads which are waiting to place a message -in the message queue, the thread which will be able to place its message -when space is available is the one with the greatest priority that has been -waiting the longest if Priority Scheduling is supported. If not, then it -is unspecified which thread is able to place its message. - - -If the message queue pointed to by msg_ptr is full and O_NONBLOCK is set, -then mq_timedsend() will just return an error and the message will not -be queued. - - -mq_timedsend() will return 0 on success. - - -mq_timedsend() will return -1 on failure, no message will be queued, and errno -will be set. - - -mq_timedsend() will return EAGAIN if O_NONBLOCK is set and the message queue -is full - - -mq_timedsend() will return EBADF if mqdes is not a valid message queue descriptor -that is also open for writing - - -mq_timedsend() will return EINTR if it is interrupted by a signal - - -mq_timedsend() will return EINVAL if msg_prio wasn't in the valid range - - -mq_timedsend() will return EMSGSIZE if msg_len is greater than the message -queues message size attribute - - -If abs_timeout has already passed at the time mq_timedsend is called, then the -timeout shall expire. - - -If Timers is supported, then abs_timeout is based on CLOCK_REALTIME. -Otherwise, the timeout is based on the system clock (time() function). - - -The timeout has the same resolution as the clock it's based on. - - -If the queue already has room, then mq_timedsend() should never fail. -Also, in this case, abs_timeout doesn't need to be checked for validity. - - -mq_timedsend() will return EINVAL if the message queue was full and -abs_timeout had a tv_nsec field less than 0 or greater than or equal -to 1000 million. - - -mq_timedsend() will return ETIMEDOUT if O_NONBLOCK was not set when -mq_open() was called for the message queue, but the message could not -be added to the queue because it timed out - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/coverage.txt deleted file mode 100644 index 60d22d6faa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/coverage.txt +++ /dev/null @@ -1,30 +0,0 @@ -This file defines the coverage for mq_timedsend. - -Note: Most tests in mq_timedsend() are cut and pastes from mq_send. -Due to the structure of the test suite, there wasn't a better, quick way -I could find to reduce this redundancy. - -Note 2: These tests assume that the TMR functionality isn't implemented. -If it is, the time() calls should be replaced with clock_gettime(). - -ASSERTION COVERED? -1 YES -2 YES -3 YES -4 YES -5 YES -6 WON'T - won't test b/c TBD if Priority Scheduling is enabled -7 YES -8 YES -9 YES -10 YES -11 YES -12 YES -13 YES -14 YES -15 YES -16 YES -17 WON'T -18 YES -19 YES -20 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/speculative/18-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/speculative/18-2.c deleted file mode 100644 index 244dbb906a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_timedsend/speculative/18-2.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Basic test that if the queue already has room, then mq_timedsend() - * does not need to check abs_timeout for validity. - * - * This is a speculative test because if abs_timeout _is_ checked for - * validity, it is not a failure. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAMESIZE 50 -#define MSGSTR "0123456789" - -int main() -{ - char qname[NAMESIZE]; - const char *msgptr = MSGSTR; - struct timespec ts; - mqd_t queue; - - sprintf(qname, "/msgqueue_%d", getpid()); - - queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - perror("mq_open() did not return success"); - printf("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)-1; - ts.tv_nsec=-1; - if (mq_timedsend(queue, msgptr, strlen(msgptr), 1, &ts) == -1) { - printf("mq_timedsend() did fail on invalid abs_time\n"); - mq_close(queue); - mq_unlink(qname); - return PTS_PASS; - } - - mq_close(queue); - mq_unlink(qname); - - printf("mq_timedsend() did not fail on invalid abs_time\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/1-1.c deleted file mode 100644 index 1d344d09fd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/1-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_unlink() test plan: - * mq_unlink() will remove the message queue named by the pathname name - * and return 0 on success. After the success call to mq_unlink() with name, - * a call to mq_open() with name will fail if the flag O_CREAT is not set. - * - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "mq_unlink" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 - -int main() -{ - char mqname[NAMESIZE]; - mqd_t mqdes; - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - if (mq_unlink(mqname) == 0) { - if (mq_open(mqname, O_RDWR, S_IRUSR | S_IWUSR, 0) == -1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - printf("mq_open succeed unexpectly \n"); - return PTS_FAIL; - } - } - else { - perror(ERROR_PREFIX "mq_unlink"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/2-1.c deleted file mode 100644 index ebff368029..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/2-1.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_unlink() test plan: - * If one or more process have the message queue open, destruction of the - * message queue will be postponed until all reference to the message queue - * have been closed. At this time, call to mq_open() with O_CREAT flag may fail - * until the message queue is actually removed. - * Steps: - * 1. Create 2 pipes to communicate with parent and child processes. - * 2. Parent uses mq_open to create a new mq and tell child to open it using pipe. - * 3. Child open the mq and tell parent, so mq has 2 reference now. - * 4. Parent want to mq_unlink the mq, since Child does not close the mq, - * mq_unlink will postpone. At this time, if using mq_open to create - * a new mq with the same name, mq_open may fail. - * - * 3/27/2003 Fixed a bug pointed by Krzysztof Benedyczak and - * Gregoire Pichon. mq_open may fail in this case. Not - * must fail. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define PIPE_READ 0 -#define PIPE_WRITE 1 - -#define TEST "2-1" -#define FUNCTION "mq_unlink" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NAMESIZE 50 - -int parent_process(char *mqname, int read_pipe, int write_pipe, int child_pid); -int child_process(char *mqname, int read_pipe, int write_pipe); -int send_receive(int read_pipe, int write_pipe, char send, char *reply); - -int main() -{ - char mqname[NAMESIZE]; - pid_t pid; - int to_parent[2]; - int to_child[2]; - int rval; - struct sigaction sa; - - sa.sa_handler = SIG_IGN; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - sigaction(SIGCHLD, &sa, NULL); - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - rval = pipe(to_parent); - if (rval == -1) { - perror(ERROR_PREFIX "fd[0]"); - return PTS_UNRESOLVED; - } - rval = pipe(to_child); - if (rval == -1) { - perror(ERROR_PREFIX "fd[1]"); - return PTS_UNRESOLVED; - } - pid = fork(); - if (pid == -1) { - perror(ERROR_PREFIX "fork"); - return PTS_UNRESOLVED; - } - if (pid == 0) { - //child process - close(to_parent[PIPE_READ]); - close(to_child[PIPE_WRITE]); - return child_process(mqname, to_child[PIPE_READ], - to_parent[PIPE_WRITE]); - } - else { - //parent process - close(to_parent[PIPE_WRITE]); - close(to_child[PIPE_READ]); - return parent_process(mqname, to_parent[PIPE_READ], - to_child[PIPE_WRITE], pid); - } -} -int parent_process(char *mqname, int read_pipe, int write_pipe, int child_pid) -{ - mqd_t mqdes; - char reply; - int rval; - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - // Tell child a message queue has been opened. - rval = send_receive(read_pipe, write_pipe, 'a', &reply); - if (rval) { - return rval; - } - if (reply != 'b') { - printf(ERROR_PREFIX "send_receive: " "expected a 'b'"); - return PTS_UNRESOLVED; - } - if (mq_unlink(mqname) == 0) { - if (mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0) == -1) { - printf("mq_open to recreate the message mqueue may fail until all references to the message queue have been closed, or until the message queue is actually removed. \n"); - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - if (mq_unlink(mqname) != 0) { - printf(ERROR_PREFIX "mq_unlink(2)"); - return PTS_UNRESOLVED; - } - printf("mq_open to recreate the message mqueue may succeed even if the references to the message queue have not been closed or the message queue is not actually removed. \n"); - printf("Test PASSED\n"); - return PTS_PASS; - } - } - printf(ERROR_PREFIX "mq_unlink \n"); - return PTS_UNRESOLVED; -} - -int child_process(char *mqname, int read_pipe, int write_pipe) -{ - mqd_t mqdes; - int rval; - char reply; - - rval = send_receive(read_pipe, write_pipe, 0, &reply); - if (rval) { - return rval; - } - if (reply != 'a') { - printf(ERROR_PREFIX "send_receive: " "expected an 'a'\n"); - return PTS_UNRESOLVED; - } - mqdes = mq_open(mqname, O_RDWR, 0, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - rval = send_receive(read_pipe, write_pipe, 'b', NULL); - - return 0; -} - -int send_receive(int read_pipe, int write_pipe, char send, char *reply) -{ - ssize_t bytes; - - if (send) { - bytes = write(write_pipe, &send, 1); - if (bytes == -1) { - perror(ERROR_PREFIX "write fd[1]"); - return PTS_UNRESOLVED; - } - } - if (reply) { - bytes = read(read_pipe, reply, 1); - if (bytes == -1) { - perror(ERROR_PREFIX "read fd[0]"); - return PTS_UNRESOLVED; - } else if (bytes == 0) { - printf(ERROR_PREFIX "read: EOF \n"); - return PTS_UNRESOLVED; - } - } - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/2-2.c deleted file mode 100644 index be2a1feb11..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/2-2.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_unlink() test plan: - * If one or more process have the message queue open, destruction of the - * message queue will be postponed until all reference to the message queue - * have been closed. At this time, call to mq_open() with O_CREAT flag may fail - * until the message queue is actually removed. - * Steps: - * 1. Create 2 pipes to communicate with parent and child processes. - * 2. Parent uses mq_open to create a new mq and tell child to open it using pipe. - * 3. Child open the mq and tell Parent, so mq has 2 reference now. - * 4. Parent mq_unlink the mq and tell Child to close this mq. - * 5. Child close the mq and tell parent. - * 6. Parent recreate the mq using mq_open, if the mq is actually removed, this operation - * will succeed, if not, it may fail. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define PIPE_READ 0 -#define PIPE_WRITE 1 - -#define TEST "2-2" -#define FUNCTION "mq_unlink" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -int parent_process(char *mqname, int read_pipe, int write_pipe, int child_pid); -int child_process(char *mqname, int read_pipe, int write_pipe); -int send_receive(int read_pipe, int write_pipe, char send, char *reply); - -int main() -{ - char mqname[50]; - pid_t pid; - int to_parent[2]; - int to_child[2]; - int rval; - struct sigaction sa; - - sa.sa_handler = SIG_IGN; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - sigaction(SIGCHLD, &sa, NULL); - - sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid()); - rval = pipe(to_parent); - if (rval == -1) { - perror(ERROR_PREFIX "fd[0]"); - return PTS_UNRESOLVED; - } - rval = pipe(to_child); - if (rval == -1) { - perror(ERROR_PREFIX "fd[1]"); - return PTS_UNRESOLVED; - } - pid = fork(); - if (pid == -1) { - perror(ERROR_PREFIX "fork"); - return PTS_UNRESOLVED; - } - if (pid == 0) { - //child process - close(to_parent[PIPE_READ]); - close(to_child[PIPE_WRITE]); - return child_process(mqname, to_child[PIPE_READ], - to_parent[PIPE_WRITE]); - } - else { - //parent process - close(to_parent[PIPE_WRITE]); - close(to_child[PIPE_READ]); - return parent_process(mqname, to_parent[PIPE_READ], - to_child[PIPE_WRITE], pid); - } -} -int parent_process(char *mqname, int read_pipe, int write_pipe, int child_pid) -{ - mqd_t mqdes; - char reply; - int rval; - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - // Tell child a message queue has been opened. - rval = send_receive(read_pipe, write_pipe, 'a', &reply); - if (rval) { - return rval; - } - if (reply != 'b') { - printf(ERROR_PREFIX "send_receive: " "expected a 'b'\n"); - return PTS_UNRESOLVED; - } - if (mq_unlink(mqname) == 0) { - rval = send_receive(read_pipe, write_pipe, 'c', &reply); - if (rval) { - return rval; - } - if (reply != 'd') { - printf(ERROR_PREFIX "send_receive: " "expected a 'd'\n"); - return PTS_UNRESOLVED; - } - if (mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0) != -1) { - if (mq_unlink(mqname) != 0) { - perror(ERROR_PREFIX "mq_unlink(2)"); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - printf("mq_open may fail until the message queue is actually removed \n"); - printf("Test PASSED\n"); - return PTS_PASS; - } - } - printf(ERROR_PREFIX "mq_unlink\n"); - return PTS_UNRESOLVED; -} - -int child_process(char *mqname, int read_pipe, int write_pipe) -{ - mqd_t mqdes; - int rval; - char reply; - - rval = send_receive(read_pipe, write_pipe, 0, &reply); - if (rval) { - return rval; - } - if (reply != 'a') { - printf(ERROR_PREFIX "send_receive: " "expected an 'a'"); - return PTS_UNRESOLVED; - } - mqdes = mq_open(mqname, O_RDWR, 0, 0); - if (mqdes == (mqd_t)-1) { - perror(ERROR_PREFIX "mq_open"); - return PTS_UNRESOLVED; - } - rval = send_receive(read_pipe, write_pipe, 'b', &reply); - if (rval) { - return rval; - } - if (reply != 'c') { - printf(ERROR_PREFIX "send_receive: " "expected a 'c'\n"); - return PTS_UNRESOLVED; - } - if (mq_close(mqdes) == -1) { - perror(ERROR_PREFIX "mq_close"); - return PTS_UNRESOLVED; - } - rval = send_receive(read_pipe, write_pipe, 'd', NULL); - if (rval) { - return rval; - } - return 0; -} - -int send_receive(int read_pipe, int write_pipe, char send, char *reply) -{ - ssize_t bytes; - if (send) { - bytes = write(write_pipe, &send, 1); - if (bytes == -1) { - perror(ERROR_PREFIX "write fd[1]"); - return PTS_UNRESOLVED; - } - } - if (reply) { - bytes = read(read_pipe, reply, 1); - if (bytes == -1) { - perror(ERROR_PREFIX "read fd[0]"); - return PTS_UNRESOLVED; - } else if (bytes == 0) { - printf(ERROR_PREFIX "read: EOF\n"); - return PTS_UNRESOLVED; - } - } - return 0; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/2-3.c deleted file mode 100644 index 5620910d65..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/2-3.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com:wq - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * If one or more process have the message queue open, - * mq_unlink() may block until all the referneces have been closed. - * NOTE: It is difficult to detect such instance. so won't test. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Difficult to detect whether mq_unlink will block until all the reference have been closed\n"); - printf("for this instance. Will not be tested.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/3-1.sh deleted file mode 100755 index e3db95cccb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/3-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test mq_unlink returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/4-1.sh deleted file mode 100755 index 0c3972f461..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/4-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test mq_unlink returns -1 on failure and set errno to indicate the -# error, named message queue will be unchanged. - -# This is tested implicitly via assertion 5, 6, 7. - -echo "Tested implicitly via assertion 5, 6, 7. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/7-1.c deleted file mode 100644 index a9fdb65572..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/7-1.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_unlink() test plan: - * mq_unlink() fails with ENOENT, if the named message queue does not - * exist. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "7-1" -#define FUNCTION "mq_unlink" - -int main() -{ - char mqname[50] = "/something-which-does-not-exit"; - - mq_unlink(mqname); - if (ENOENT == errno) { - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/assertions.xml deleted file mode 100644 index d5c3ddd884..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/assertions.xml +++ /dev/null @@ -1,23 +0,0 @@ - - -mq_unlink() function will remove the message queue named by the pathname name. After a successful call to mq_unlink() with name, mq_open() with name will fail if the flag O_CREAT is not set. - - -Destruction of the message queue will be postponed until all references to the message queue have been closed. So calls to mq_open() to recreate the message queue may fail until all the message queue is actually removed. However, mq_unlink() call need not block untill all the references have been closed, it may return immediately. - - -If mq_unlink() is successful, it will return a value of zero. - - -If mq_unlink() is not successful, the named message queue will be unchanged by this function call, and the function will return a value of -1 and set errno to indicate the error. - - -mq_unlink() fails with EACCES if permission is denied to unlink the named message queue. - - -mq_unlink() fails with ENAMETOOLONG if the length of the name argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. - - -mq_unlink() fails with ENOENT if the named message queue does not exist. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/coverage.txt deleted file mode 100644 index db066d8793..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/coverage.txt +++ /dev/null @@ -1,10 +0,0 @@ -This document defines the coverage for the mq_unlink function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 NO - won't test -6 YES -7 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/speculative/7-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/speculative/7-2.c deleted file mode 100644 index f742e8ee20..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mq_unlink/speculative/7-2.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * mq_unlink() test plan: - * mq_unlink() fails with ENOENT, if the named message queue does not - * exist. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "7-2" -#define FUNCTION "mq_unlink" - -int main() -{ - char mqname[50]; - -// sprintf(mqname, FUNCTION "_" TEST "_%d", getpid()); - - mq_unlink(mqname); - if (ENOENT == errno) { - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - printf("Test FAILED, error is %s\n", strerror(errno)); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/10-1.c deleted file mode 100644 index 2b5e64b1c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/10-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the munlock() function sets errno = ENOMEM if some or all of the - * address range specified by the addr and len arguments does not correspond to - * valid mapped pages in the address space of the process. - * - * Assume that the value LONG_MAX is an invalid pointer. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUFSIZE 8 - -int main() { - int result; - long page_size; - void *page_ptr; - - page_size = sysconf(_SC_PAGESIZE); - if(errno) { - perror("An error occurs when calling sysconf()"); - return PTS_UNRESOLVED; - } - - page_ptr = (void*)( LONG_MAX - (LONG_MAX % page_size) ); - result = munlock(page_ptr, BUFSIZE); - - if(result == -1 && errno == ENOMEM) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("Unexpected error"); - return PTS_UNRESOLVED; - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/11-1.c deleted file mode 100644 index 5991ac9588..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/11-1.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that munlock() set errno = EINVAL when addr is not a multiple of - * {PAGESIZE} if the implementation requires that addr be a multiple of - * {PAGESIZE}. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() { - int result; - long page_size; - void *ptr, *notpage_ptr; - - page_size = sysconf(_SC_PAGESIZE); - if(errno) { - perror("An error occurs when calling sysconf()"); - return PTS_UNRESOLVED; - } - - ptr = malloc(page_size); - if(ptr == NULL) { - printf("Can not allocate memory.\n"); - return PTS_UNRESOLVED; - } - - notpage_ptr = ((long)ptr % page_size) ? ptr : ptr+1; - - result = munlock(notpage_ptr, page_size - 1); - - if(result == 0){ - printf("munlock() does not require that addr be a multiple of {PAGESIZE}.\nTest PASSED\n"); - return PTS_PASS; - } else if(result == -1 && errno == EINVAL){ - printf("munlock() requires that addr be a multiple of {PAGESIZE}.\nTest PASSED\n"); - return PTS_PASS; - } else if(result != -1){ - printf("munlock() returns a value of %i instead of 0 or 1.\n", - result); - perror("munlock"); - return PTS_FAIL; - } - perror("Unexpected error"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/2-1.sh deleted file mode 100755 index 307b23e49e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/2-1.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -# -# Test whether the implementation requires that addr be a multiple of -# {PAGESIZE}. -# -# This is tested implicitly via assertion 11. - -echo "Tested implicitly via assertion 11." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/7-1.c deleted file mode 100644 index bca756a2f8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/7-1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that munlock return a value of zero upon successful completion. - * - */ -#include -#include -#include -#include -#include "posixtest.h" - -#define BUFSIZE 8 - -int main() { - int result; - void *ptr; - - ptr = malloc(BUFSIZE); - if(ptr == NULL) { - printf("Can not allocate memory.\n"); - return PTS_UNRESOLVED; - } - - if(mlock(ptr, BUFSIZE) != 0){ - if(errno == EPERM) { - printf("You don't have permission to lock your address space.\nTry to rerun this test as root.\n"); - } else { - perror("An error occurs when calling mlock()"); - } - return PTS_UNRESOLVED; - } - - result = munlock(ptr, BUFSIZE); - if(result == 0 && errno == 0){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno == 0) { - printf("mlock did not return a value of zero\n"); - return PTS_FAIL; - } - - perror("Unexpected error"); - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/9-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/9-1.sh deleted file mode 100755 index 241ffe7fdf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/9-1.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -# -# Test that the munlock() function return -1 upon unsuccessful completion. -# -# This is tested implicitly via assertions 10 and 11. - -echo "Tested implicitly via assertions 10 and 11." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/assertions.xml deleted file mode 100644 index d72155da5a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/assertions.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - The munlock() function shall unlock those whole pages containing any part of - the address space of the process starting at address addr and continuing for - len bytes, regardless of how many times mlock() has been called by the - process for any of the pages in the specified range - - - The implementation may require that addr be a multiple of {PAGESIZE} - - - If any of the pages in the range specified to a call to munlock() are also - mapped into the address spaces of other processes, any locks established on - those pages by another process are unaffected by the call of this process to munlock() - - - If any of the pages in the range specified by a call to munlock() are also - mapped into other portions of the address space of the calling process - outside the range specified, any locks established on those pages via the - other mappings are also unaffected by this call - - - Upon successful return from munlock(), pages in the specified range shall be - unlocked with respect to the address space of the process - - - Memory residency of unlocked pages is unspecified - - - Upon successful completion, the munlock() function shall return a value of - zero - - - Upon unsuccessful completion, no change is made to any locks in the address - space of the process - - - Upon unsuccessful completion, the function shall return a value of -1 - - - The munlock() function shall set errno = ENOMEM if some or all of the - address range specified by the addr and len arguments does not correspond - to valid mapped pages in the address space of the process - - - The munlock() function may set errno = EINVAL if the addr argument is not a - multiple of {PAGESIZE} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/coverage.txt deleted file mode 100644 index dc822dcb55..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlock/coverage.txt +++ /dev/null @@ -1,18 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 NO -2 YES May assertion -3 NO -4 NO -5 NO -6 NO Unspecified -7 YES -8 NO -9 YES -10 YES -11 YES May assertion - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/5-1.c deleted file mode 100644 index d4703be7e2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/5-1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the munlockall() function always return a value of zero if it is - * supported by the implementation. - */ - - -#include -#include -#include -#include -#include "posixtest.h" - - -#if !defined(_POSIX_MEMLOCK) || _POSIX_MEMLOCK == -1 - -int main(){ - printf("Does not support ML (Memory Lock).\n"); - return PTS_UNSUPPORTED; -} - -#else - -#if _POSIX_MEMLOCK != 0 -int main(){ - int result; - - result = munlockall(); - - if(result == 0){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno == EPERM){ - printf("You don't have permission to unlock your address space.\nTry to rerun this test as root.\n"); - return PTS_UNRESOLVED; - } else { - printf("munlockall() returns %i instead of zero.\n", - result); - return PTS_FAIL; - } - -} - -#else - -int main(){ - int result; - long memlock; - - memlock = sysconf(_SC_MEMLOCK); - if(errno){ - perror("An errno occurs when calling sysconf().\n"); - return PTS_UNRESOLVED; - } - - result = munlockall(); - - if( (result == 0 && memlock > 0) || (result == -1 && memlock <=0) ){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno == EPERM){ - printf("You don't have permission to unlock your address space.\nTry to rerun this test as root.\n"); - return PTS_UNRESOLVED; - } else { - printf("munlockall() returns %i instead of zero.\n", - result); - return PTS_FAIL; - } - -} - -#endif - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/6-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/6-1.sh deleted file mode 100755 index 8cacfc7a8e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/6-1.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Test that the munlockall() function return a value of -1 if it is not -# supported by the implementation. -# -# This is tested implicitly via assertion 5. - -echo "Tested implicitly via assertion 5." -exit 0 - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/assertions.xml deleted file mode 100644 index edb6589ef1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/assertions.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - Any pages that become mapped into the address space of the process after a - call to munlockall() shall not be locked, unless there is an intervening - call to mlockall() specifying MCL_FUTURE or a subsequent call to mlockall() - specifying MCL_CURRENT - - - If pages mapped into the address space of the process are also mapped into - the address spaces of other processes and are locked by those processes, the - locks established by the other processes shall be unaffected by a call by - this process to munlockall() - - - Upon return from the munlockall() function, all currently mapped pages of - the process' address space shall be unlocked with respect to the process' - address space - - - The memory residency of unlocked pages is unspecified - - - If it is supported by the implementation, the munlockall() function shall - always return a value of zero - - - If it is not supported by the implementation, the munlockall() function - shall return a value of -1 and set errno to indicate the error - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/coverage.txt deleted file mode 100644 index 929bee9a44..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munlockall/coverage.txt +++ /dev/null @@ -1,13 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 NO -2 NO -3 NO -4 NO Unspecified -5 YES -6 YES - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-1.c deleted file mode 100644 index b988029732..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-1.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The munmap( ) function shall remove any mappings for those - * entire pages containing any part of the address space of - * the process starting at addr and continuing for len bytes. - * Further references to these pages shall result in the - * generation of a SIGSEGV signal to the process. - * - * Test Step: - * 1. map a file into memory; - * 2. unmap; - * 3. Try to reference the unmapped memory, outside the - * mapped file, test whether SIGSEGV is triggered. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "munmap/1-1.c" - -void sigsegv_handler(int signum) -{ - printf ("Got SIGSEGV\n"); - printf ("Test PASSED\n"); - exit(PTS_PASS); -} - -int main() -{ - char tmpfname[256]; - long file_size; - - void *pa = NULL; - void *addr = NULL; - size_t len; - int flag; - int fd; - off_t off = 0; - int prot; - - int page_size; - - char *ch1; - - struct sigaction sa; - - sigfillset(&sa.sa_mask); - sa.sa_handler = sigsegv_handler; - sigaction(SIGSEGV, &sa, NULL); - - page_size = sysconf(_SC_PAGE_SIZE); - file_size = 2 * page_size; - - /* We hope to map 2 pages */ - len = page_size + 1; - - /* Create tmp file */ - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - if (ftruncate (fd, file_size) == -1) - { - printf("Error at ftruncate: %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } - - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test UNRESOLVED: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - /* ch1 is outside the mapped object, but in the mapped file */ - ch1 = pa + len + 1; - *ch1 = 'b'; - - close (fd); - if (munmap (pa, len) == -1) - { - printf ("Test FAILED: " TNAME " Error at munmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - /* Try to reference the unmapped area, should trigger SIGSEGV */ - *ch1 = 'a'; - - /* If reach this point, test fail */ - printf ("Test FAILED: Did not trigger SIGSEGV\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-2.c deleted file mode 100644 index 1784526b38..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-2.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The munmap( ) function shall remove any mappings for those - * entire pages containing any part of the address space of - * the process starting at addr and continuing for len bytes. - * Further references to these pages shall result in the - * generation of a SIGSEGV signal to the process. - * - * Test Step: - * 1. map a file into memory; - * 2. unmap; - * 3. Try to reference the unmapped memory, test whether SIGSEGV - * is triggered. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "munmap/1-2.c" - -void sigsegv_handler(int signum) -{ - printf ("Got SIGSEGV\n"); - printf ("Test PASSED\n"); - exit(PTS_PASS); -} - -int main() -{ - char tmpfname[256]; - long file_size; - - void *pa = NULL; - void *addr = NULL; - size_t len; - int flag; - int fd; - off_t off = 0; - int prot; - - int page_size; - - char *ch; - - struct sigaction sa; - - sigfillset(&sa.sa_mask); - sa.sa_handler = sigsegv_handler; - sigaction(SIGSEGV, &sa, NULL); - - page_size = sysconf(_SC_PAGE_SIZE); - file_size = 2 * page_size; - - /* We hope to map 2 pages */ - len = page_size + 1; - - /* Create tmp file */ - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - if (ftruncate (fd, file_size) == -1) - { - printf("Error at ftruncate: %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } - - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test UNRESOLVED: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - ch = pa; - *ch = 'b'; - - close (fd); - munmap (pa, len); - - /* Should trigger SIGSEGV here */ - *ch = 'a'; - - printf ("Test FAILED: Did not trigger SIGSEGV\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/10-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/10-1.sh deleted file mode 100755 index f421d51be7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/10-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# The munmap( ) function shall fail if: -# [EINVAL] The addr argument is not a multiple of the page size -# as returned by sysconf( ). - -# This is tested implicitly via assertion 3. - -echo "Tested implicitly via assertion 3. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/2-1.c deleted file mode 100644 index e4da968c01..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/2-1.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * If there are no - * mappings in the specified address range, then munmap( ) has no effect. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "munmap/2-1.c" - -int main() -{ - int rc; - - int page_size; - void *buffer = NULL, *new_addr = NULL; - - page_size = sysconf(_SC_PAGE_SIZE); - buffer = malloc(page_size * 2); - if (buffer == NULL) - { - printf("Error at malloc\n"); - exit(PTS_UNRESOLVED); - } - - /* Make new_addr is a multiple of page_size, while - * [new_addr, new_addr + page_size] is a valid memory range - */ - new_addr = buffer + (page_size - (unsigned long)buffer % page_size); - - rc = munmap(new_addr, page_size); - if (rc == -1) - { - printf ("Test FAILED " TNAME " Error at munmap(): %s\n", - strerror(errno)); - free(buffer); - exit(PTS_FAIL); - } - - free(buffer); - printf ("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/3-1.c deleted file mode 100644 index f3b4e4fb17..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/3-1.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The implementation shall require that addr be a multiple - * of the page size {PAGESIZE}. - * - * Test step: - * Try to call unmap, with addr NOT a multiple of page size. - * Should get EINVAL. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "munmap/3-1.c" - -int main() -{ - char tmpfname[256]; - long file_size; - - void *pa = NULL; - void *addr = NULL; - size_t len; - int flag; - int fd; - off_t off = 0; - int prot; - - int page_size; - - char *pa2; - - - page_size = sysconf(_SC_PAGE_SIZE); - file_size = 2 * page_size; - - /* We hope to map 2 pages */ - len = page_size + 1; - - /* Create tmp file */ - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - if (ftruncate (fd, file_size) == -1) - { - printf("Error at ftruncate: %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } - - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Unresolved: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - /* pa should be a multiple of page size */ - pa2 = pa; - - while (((unsigned long)pa2 % page_size) == 0) - pa2++; - - close (fd); - if (munmap (pa2, len) == -1 && errno == EINVAL) - { - printf ("Got EINVAL\n"); - printf ("Test PASSED\n"); - exit(PTS_PASS); - } - else - { - printf ("Test FAILED: " TNAME " munmap returns: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/4-1.c deleted file mode 100644 index 6d656d8eea..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/4-1.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * - * If a mapping to be removed was private, any modifications - * made in this address range shall be discarded. - * - * Test Step: - * 1. mmap a file into memory. Set flag as MAP_PRIVATE; - * 2. Modify the mapped memory, and call msync to try to synchronize the change with - * the file; - * 3. munmap the mapped memory; - * 4. mmap the same file again into memory; - * 5. If the modification in step 2 appears in the mapped memory, then fail, - * otherwise pass. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "munmap/4-1.c" - -int main() -{ - int rc; - - char tmpfname[256]; - char* data; - int total_size = 1024; - - void *pa = NULL; - void *addr = NULL; - size_t size = total_size; - int flag; - int fd; - off_t off = 0; - int prot; - - char * ch; - - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_4_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - data = (char *) malloc(total_size); - memset(data, 'a', total_size); - if (write(fd, data, total_size) != total_size) - { - printf(TNAME "Error at write(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - free(data); - - prot = PROT_READ | PROT_WRITE; - flag = MAP_PRIVATE; - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa; - *ch = 'b'; - - /* Flush changes back to the file */ - - if ((rc =msync(pa, size, MS_SYNC)) != 0) - { - printf(TNAME " Error at msync(): %s\n", - strerror(rc)); - exit(PTS_UNRESOLVED); - } - - munmap(pa, size); - - /* Mmap again */ - - pa = mmap(addr, size, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf("Test Fail: " TNAME " Error at 2nd mmap: %s\n", - strerror(errno)); - exit(PTS_FAIL); - } - - ch = pa; - if (*ch == 'b') - { - printf("Test FAIL\n"); - exit(PTS_FAIL); - } - - close (fd); - printf ("Write referece is discarded when setting MAP_RPIVATE\n"); - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/7-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/7-1.sh deleted file mode 100755 index 8bc356efc6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/7-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Upon successful completion, munmap( ) shall return 0; -# otherwise, it shall return .1 and set errno to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/8-1.c deleted file mode 100644 index d49e56a9d6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/8-1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The munmap( ) function shall fail if: - * [EINVAL] Addresses in the range [addr,addr+len) - * are outside the valid range for the - * address space of a process. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "munmap/8-1.c" - -int main() -{ - int rc; - void *pa; - - /* -1 should be an invalid address */ - pa = (void*)-1; - rc = munmap(pa, 1); - if (rc == -1 && errno == EINVAL) - { - printf ("Got EINVAL\n"); - printf ("Test PASSED\n"); - exit(PTS_PASS); - } - else - { - printf ("Test FAILED: Expect EINVAL but get: %s\n", strerror(errno)); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/9-1.c deleted file mode 100644 index 816571f105..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/9-1.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The munmap( ) function shall fail if: - * [EINVAL] The len argument is 0. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TNAME "munmap/9-1.c" - -int main() -{ - char tmpfname[256]; - long file_size; - - void *pa = NULL; - void *addr = NULL; - size_t len; - int flag; - int fd; - off_t off = 0; - int prot; - - int page_size; - - page_size = sysconf(_SC_PAGE_SIZE); - file_size = 2 * page_size; - - /* We hope to map 2 pages */ - len = page_size + 1; - - /* Create tmp file */ - snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%ld", - (long)getpid()); - unlink(tmpfname); - fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, - S_IRUSR | S_IWUSR); - if (fd == -1) - { - printf(TNAME " Error at open(): %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - unlink(tmpfname); - - if (ftruncate (fd, file_size) == -1) - { - printf("Error at ftruncate: %s\n", strerror(errno)); - exit(PTS_UNRESOLVED); - } - - flag = MAP_SHARED; - prot = PROT_READ | PROT_WRITE; - pa = mmap(addr, len, prot, flag, fd, off); - if (pa == MAP_FAILED) - { - printf ("Test Unresolved: " TNAME " Error at mmap: %s\n", - strerror(errno)); - exit(PTS_UNRESOLVED); - } - - close (fd); - - /* Set len as 0 */ - if (munmap (pa, 0) == -1 && errno == EINVAL) - { - printf ("Get EINVAL when len=0\n"); - printf ("Test PASSED\n"); - exit(PTS_PASS); - } - else - { - printf ("Test Fail: Expect EINVAL while get %s\n", - strerror(errno)); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/assertions.xml deleted file mode 100644 index 6b465beee5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/assertions.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - The munmap( ) function shall remove any mappings for those entire pages containing any part of - the address space of the process starting at addr and continuing for len bytes. Further - references to these pages shall result in the generation of a SIGSEGV signal to the process. - - - - If there are no mappings in the specified address range, then munmap( ) has no effect. - - - - The implementation shall require that addr be a multiple of the page size {PAGESIZE}. - - - - If a mapping to be removed was private, any modifications made in this address range shall be - discarded. - - - - ML|MLR Any memory locks (see mlock( ) and mlockall ( )) associated with this address range - shall be removed, as if by an appropriate call to munlock( ). - - - - TYM If a mapping removed from a typed memory object causes the corresponding address range of - the memory pool to be inaccessible by any process in the system except through allocatable - mappings (that is, mappings of typed memory objects opened with the - POSIX_TYPED_MEM_MAP_ALLOCATABLE flag), then that range of the memory pool shall - become deallocated and may become available to satisfy future typed memory allocation - requests. - A mapping removed from a typed memory object opened with the - POSIX_TYPED_MEM_MAP_ALLOCATABLE flag shall not affect in any way the availability of - that typed memory for allocation. - - - - Upon successful completion, munmap( ) shall return 0; otherwise, it shall return .1 and set - errno to indicate the error. - - - - The munmap( ) function shall fail if: - [EINVAL] Addresses in the range [addr,addr+len) are outside the valid range for the - address space of a process. - - - - The munmap( ) function shall fail if: - [EINVAL] The len argument is 0. - - - - The munmap( ) function shall fail if: - [EINVAL] The addr argument is not a multiple of the page size as returned by sysconf( ). - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/coverage.txt deleted file mode 100644 index 5b8449dda0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/coverage.txt +++ /dev/null @@ -1,15 +0,0 @@ -This document defines the coverage for the munmap() function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 NO **Not sure how to test whether certain page is locked -6 NO ** Typed Memory object -7 YES -8 NO: ** Typed Memory object -9 YES -10 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/1-1.c deleted file mode 100644 index b5f6c2f23a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/1-1.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that nanosleep() causes the current thread to be suspended - * until the time interval in rqtp passes. - */ -#include -#include -#include "posixtest.h" - -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage, tsbefore, tsafter; - int sleepnsec = 3; - int slepts=0,sleptns=0; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - tssleepfor.tv_sec=0; - tssleepfor.tv_nsec=sleepnsec; - if (nanosleep(&tssleepfor, &tsstorage) != 0) { - printf("nanosleep() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - /* - * Generic alg for calculating slept time. - */ - slepts=tsafter.tv_sec-tsbefore.tv_sec; - sleptns=tsafter.tv_nsec-tsbefore.tv_nsec; - if (sleptns < 0) { - sleptns = sleptns+1000000000; - slepts = slepts-1; - } - - if ((slepts > 0) || (sleptns > sleepnsec)) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("nanosleep() did not sleep long enough\n"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/1-2.c deleted file mode 100644 index e92ed97580..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/1-2.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that nanosleep() causes the current thread to be suspended - * until a signal whose action is to terminate the process is received. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage, tsbefore, tsafter; - int sleepsec = 30; - int pid; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - tssleepfor.tv_sec=sleepsec; - tssleepfor.tv_nsec=0; - nanosleep(&tssleepfor, &tsstorage); - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - if (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - /* - * pass if we slept for less than the (large) sleep time - * allotted - */ - if ( (tsafter.tv_sec-tsbefore.tv_sec) < sleepsec) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Slept for too long: %d >= %d\n", - (int)tsafter.tv_sec-(int)tsbefore.tv_sec, - sleepsec); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/1-3.c deleted file mode 100644 index 6c61878aeb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/1-3.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that nanosleep() causes the current thread to be suspended - * until a signal whose action is to invoke a signal handling function - * is received. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("In handler\n"); -} - - -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage, tsbefore, tsafter; - int sleepsec = 30; - int pid; - struct sigaction act; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - tssleepfor.tv_sec=sleepsec; - tssleepfor.tv_nsec=0; - nanosleep(&tssleepfor, &tsstorage); - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - if (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - /* - * pass if we slept for less than the (large) sleep time - * allotted - */ - if ( (tsafter.tv_sec-tsbefore.tv_sec) < sleepsec) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Slept for too long: %d >= %d\n", - (int)tsafter.tv_sec-(int)tsbefore.tv_sec, - sleepsec); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/10000-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/10000-1.c deleted file mode 100644 index e0b87d1845..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/10000-1.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test nanosleep() on a variety of valid and invalid input parameters. - * - * For valid parameters, if the seconds spent is within OKSECERR, the - * test is considered a pass (Note: This is not too accurate since - * accuracy is at the second level.). - * - * For invalid parameters, nanosleep should fail with -1 exit and - * errno set to EINVAL. - */ -#include -#include -#include -#include "posixtest.h" - -#define NUMVALID 6 -#define NUMINVALID 8 - -#define OKSECERR 1 - -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * input tests - */ -static int sleepvalid[NUMVALID][2] = { {0, 30000000}, {1, 0}, - {1, 30000000}, {2, 0}, - {10, 5000}, {13, 5} }; -static int sleepinvalid[NUMINVALID][2] = { {-1, -1}, {0, -1}, - {1, 1000000000}, {2, 1000000000}, - {-2147483647, -2147483647}, - {1, 2147483647}, - {-1073743192, 0}, - {0, 1075002478} }; - -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage, tsbefore, tsafter; - int i; - int failure = 0; - int slepts=0, sleptns=0; - - for (i=0; i OKSECERR) { - printf("FAIL - slept %ds%dns >> %ds%dns\n", - slepts, sleptns, - (int) tssleepfor.tv_sec, - (int) tssleepfor.tv_nsec); - } else { - printf("PASS - slept %ds%dns ~= %ds%dns\n", - slepts, sleptns, - (int) tssleepfor.tv_sec, - (int) tssleepfor.tv_nsec); - } - } else { - printf("nanosleep() did not return 0 on success\n"); - failure = 1; - } - } - - for (i=0; i -#include -#include "posixtest.h" - -#define NUMINTERVALS 13 -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage, tsbefore, tsafter; - int sleepnsec[NUMINTERVALS] = {1, 2, 10, 100, 1000, 10000, 1000000, - 10000000, 100000000, 200000000, 500000000, 750000000, - 999999900}; - int i; - int failure = 0; - int slepts, sleptns; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - tssleepfor.tv_sec=0; - for (i=0; i= 1) || - (sleptns > sleepnsec[i]) ) { - printf("PASS slept %ds %dns >= %d\n", - slepts, sleptns, sleepnsec[i]); - } else { - printf("FAIL slept %ds %dns < %d\n", - slepts, sleptns, sleepnsec[i]); - failure = 1; - } - } - - if (failure) { - printf("At least one test FAILED\n"); - return PTS_FAIL; - } else { - printf("All tests PASSED\n"); - return PTS_PASS; - } - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/3-1.c deleted file mode 100644 index 106df872ca..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/3-1.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that nanosleep() does not effect the action of a signal. - * - Start nanosleep() in a child process - * - Send a signal to the child process and have the handler exit with - * success; if the handler is not called, return 0 - * - In the parent, if the child exitted success, return success. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define CHILDSUCCESS 1 -#define CHILDFAIL 0 - -void handler(int signo) -{ - printf("Received signal - exit success\n"); - exit(CHILDSUCCESS); -} - - -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage; - int sleepsec = 30; - int pid; - struct sigaction act; - - if ((pid = fork()) == 0) { - /* child here */ - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return CHILDFAIL; - } - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return CHILDFAIL; - } - tssleepfor.tv_sec=sleepsec; - tssleepfor.tv_nsec=0; - nanosleep(&tssleepfor, &tsstorage); - return CHILDFAIL; - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (WIFEXITED(i) && WEXITSTATUS(i)) { - printf("Child exited normally\n"); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Child did not exit normally.\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/3-2.c deleted file mode 100644 index 4511f96517..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/3-2.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Regression test motivated by an LKML discussion. Test that nanosleep() - * can be interrupted and then continue. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SLEEPSEC 5 - -#define CHILDPASS 0 //if interrupted, child will return 0 -#define CHILDFAIL 1 - -int main(int argc, char *argv[]) -{ - int pid, slepts; - struct timespec tsbefore, tsafter; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) { - perror("clock_gettime() did not return success\n"); - return PTS_UNRESOLVED; - } - - - if ((pid = fork()) == 0) { - /* child here */ - struct timespec tssleep; - - tssleep.tv_sec=SLEEPSEC; - tssleep.tv_nsec=0; - if (nanosleep(&tssleep, NULL) == 0) { - printf("nanosleep() returned success\n"); - return CHILDPASS; - } else { - printf("nanosleep() did not return success\n"); - return CHILDFAIL; - } - return CHILDFAIL; - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGSTOP) != 0) { - printf("Could not raise SIGSTOP\n"); - return PTS_UNRESOLVED; - } - - if (kill(pid, SIGCONT) != 0) { - printf("Could not raise SIGCONT\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(i)) { - printf("nanosleep() did not return 0\n"); - return PTS_FAIL; - } - - if (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - slepts=tsafter.tv_sec-tsbefore.tv_sec; - - printf("Start %d sec; End %d sec\n", (int) tsbefore.tv_sec, - (int) tsafter.tv_sec); - if (slepts >= SLEEPSEC) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("nanosleep() did not sleep long enough\n"); - return PTS_FAIL; - } - - } //end fork - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/4-1.sh deleted file mode 100755 index 7a0f63f19a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/4-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test that nanosleep() returns 0 if it is returning because the time -# interval in rqtp has passed. -# This is tested implicitly via assertion #1. See that output for status. - -echo "Tested implicitly via assertion 1. See that output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/5-1.c deleted file mode 100644 index 907112dfc3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/5-1.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that nanosleep() returns -1 on failure. - * Simulate failure condition by sending -1 as the nsec to sleep for. - */ -#include -#include -#include "posixtest.h" - -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage; - int sleepnsec = -1; - - tssleepfor.tv_sec=0; - tssleepfor.tv_nsec=sleepnsec; - if (nanosleep(&tssleepfor, &tsstorage) == -1) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("nanosleep() did not return -1 on failure\n"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/5-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/5-2.c deleted file mode 100644 index e00b634b47..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/5-2.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that nanosleep() returns -1 if interrupted. - * Test by sending a signal to a child doing nanosleep(). If nanosleep - * returns -1, return success from the child. - */ -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define CHILDSUCCESS 1 -#define CHILDFAILURE 0 - -void handler(int signo) -{ - printf("In handler\n"); -} - - -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage; - int sleepsec = 30; - int pid; - struct sigaction act; - - if ((pid = fork()) == 0) { - /* child here */ - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return CHILDFAILURE; - } - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return CHILDFAILURE; - } - tssleepfor.tv_sec=sleepsec; - tssleepfor.tv_nsec=0; - if (nanosleep(&tssleepfor, &tsstorage) == -1) { - return CHILDSUCCESS; - } else { - return CHILDFAILURE; - } - - return CHILDFAILURE; - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (WIFEXITED(i) && WEXITSTATUS(i)) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Child did not exit normally.\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/6-1.c deleted file mode 100644 index 3c37313b97..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/6-1.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that nanosleep() sets errno to EINVAL if rqtp contained a - * nanosecond value < 0 or >= 1,000 million - */ -#include -#include -#include -#include "posixtest.h" - -#define NUMTESTS 7 - -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage; - int sleepnsec[NUMTESTS] = {-1, -5, -1000000000, 1000000000, - 1000000001, 2000000000, 2000000000 }; - int i; - int failure = 0; - - tssleepfor.tv_sec=0; - - for (i=0; i -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define CHILDSUCCESS 1 -#define CHILDFAILURE 0 - -void handler(int signo) -{ - printf("In handler\n"); -} - - -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage; - int sleepsec = 30; - int pid; - struct sigaction act; - - if ((pid = fork()) == 0) { - /* child here */ - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return CHILDFAILURE; - } - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return CHILDFAILURE; - } - tssleepfor.tv_sec=sleepsec; - tssleepfor.tv_nsec=0; - if (nanosleep(&tssleepfor, &tsstorage) == -1) { - if (EINTR == errno) { - printf("errno == EINTR\n"); - return CHILDSUCCESS; - } else { - printf("errno != EINTR\n"); - return CHILDFAILURE; - } - } else { - printf("nanosleep did not return -1\n"); - return CHILDFAILURE; - } - - return CHILDFAILURE; - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (WIFEXITED(i) && WEXITSTATUS(i)) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Child did not exit normally.\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/7-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/7-2.c deleted file mode 100644 index b197f82989..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/7-2.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that nanosleep() sets rmtp to the time remaining if - * it is interrupted by a signal. - * If time remaining is within OKDELTA difference, the test is a pass. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define CHILDSUCCESS 1 -#define CHILDFAILURE 0 - -#define OKDELTA 1 - -void handler(int signo) -{ - printf("In handler\n"); -} - - -int main(int argc, char *argv[]) -{ - struct timespec tssleepfor, tsstorage, tsbefore, tsafter; - int sleepsec = 30; - int pid; - struct sigaction act; - - if (clock_gettime(CLOCK_REALTIME, &tsbefore) == -1) { - perror("Error in clock_gettime()\n"); - return PTS_UNRESOLVED; - } - - if ((pid = fork()) == 0) { - /* child here */ - int sleptplusremaining; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return CHILDFAILURE; - } - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return CHILDFAILURE; - } - tssleepfor.tv_sec=sleepsec; - tssleepfor.tv_nsec=0; - if (nanosleep(&tssleepfor, &tsstorage) != -1) { - printf("nanosleep() was not interrupted\n"); - return CHILDFAILURE; - } - - if (clock_gettime(CLOCK_REALTIME, &tsafter) == -1) { - perror("Error in clock_gettime()\n"); - return CHILDFAILURE; - } - - sleptplusremaining = (tsafter.tv_sec-tsbefore.tv_sec) + - tsstorage.tv_sec; - - if (abs(sleptplusremaining - sleepsec) <= OKDELTA) { - printf("PASS - within %d difference\n", - abs(sleptplusremaining - sleepsec)); - return CHILDSUCCESS; - } else { - printf("FAIL - within %d difference\n", - abs(sleptplusremaining - sleepsec)); - return CHILDFAILURE; - } - - } else { - /* parent here */ - int i; - - sleep(1); - - if (kill(pid, SIGABRT) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_UNRESOLVED; - } - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (WIFEXITED(i) && WEXITSTATUS(i)) { - printf("Child exited normally\n"); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Child did not exit normally.\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/assertions.xml deleted file mode 100644 index 592890e672..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/assertions.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - nanosleep() causes the current thread to be suspended until either: - 1) the time interval in rqtp passes - 2) a signal whose action is to terminate the process or invoke a signal - catching function is delivered to the current thread - - - Unless nanosleep() is interrupted (as in 2) above), nanosleep() must always - suspend the process for _at least_ the time interval in rqtp - as - measured by CLOCK_REALTIME. - [Occasionally, the time could be > rqtp interval because of - scheduling/rounding.] - - - nanosleep() does not effect the action/blockage of a signal - - - nanosleep() returns 0 if it returns because the time interval in rqtp - has elapsed - - - nanosleep() returns -1 on failure or if interrupted - - - nanosleep() sets errno to EINVAL if rqtp contained a nanosecond value - below 0 or above (or equal to) 1,000 million - - - nanosleep() sets errno to EINTR if it is interrupted by a signal. - Also, if rmtp != NULL, rmtp will be set to the time remaining (i.e., - requested time - time slept). Otherwise, time remaining is not - returned. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/coverage.txt deleted file mode 100644 index 78f6891263..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/nanosleep/coverage.txt +++ /dev/null @@ -1,30 +0,0 @@ -This document defines the coverage of testing for all assertions. - -Assertion Tested? -1 YES - Noticing interesting things in the amount of time - actually slept. Maybe should investigate this - further. -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES - Decided not to test when rmtp = NULL. Seems not - relevant. -10000 (bounds) YES - Made tests for a variety of boundary conditions. - - -The algorithm for calculating the amount of time slept is noted below. -[Used in 1-1.c, 2-1.c, 10000-1.c] - -STARTSEC, STARTNSEC = the start time, seconds and nanoseconds, respectively -FINISHSEC, FINISHNSEC = the finish time, seconds and nanoseconds, respectively -slepts, sleptns = amount of seconds and nanoseconds slept, respectively - -slepts=FINISHSEC - STARTSEC; -sleptns=FINISHNSEC - STARTNSEC; -if (sleptns < 0) { - sleptns = sleptns+1000000000; - slepts = slepts-1; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/1-1.c deleted file mode 100644 index 14360ff3a0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/1-1.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * int pthread_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void)) - * - * shall declare fork handlers to be called before and after a fork() command, in the context - * of the thread that called the fork(). The 'prepare' fork handler shall be called before - * fork() processing commences. The 'parent' fork handle shall be called after fork() - * processing completes in the parent process. The 'child' fork shall be called after - * fork() processing completes in the child process. - * - * STEPS: - * 1. Call pthread_atfork() before a fork() call, setting all three fork handlers for - * prepare, parent and child. - * 2. Call fork() - * 3. Verify that all three fork handlers were called - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -# define HANDLER_NOTCALLED 0 -# define HANDLER_CALLED 1 - -int prep_val; -int parent_val; -int child_val; - -static void prepare_handler() -{ - prep_val = HANDLER_CALLED; - return; -} - -static void parent_handler() -{ - parent_val = HANDLER_CALLED; - return; -} - -static void child_handler() -{ - child_val = HANDLER_CALLED; - return; -} - -int main () -{ - pid_t pid; - - /* Initialize values */ - prep_val = HANDLER_NOTCALLED; - parent_val = HANDLER_NOTCALLED; - child_val = HANDLER_NOTCALLED; - - /* Set up the fork handlers */ - if(pthread_atfork(prepare_handler, parent_handler, child_handler) != 0) - { - printf("Error in pthread_atfork\n"); - return PTS_UNRESOLVED; - } - - /* Now call fork() */ - pid = fork(); - - if(pid < 0) - { - perror("Error in fork()\n"); - return PTS_UNRESOLVED; - } - if(pid == 0) - { - /* Child process */ - pthread_exit(0); - } else - { - /* Parent process */ - wait(NULL); - } - - /* Check if fork handlers were called */ - if(prep_val == 1) - { - if(parent_val == 1) - { - if(parent_val == 1) - { - printf("Test PASSED\n"); - return PTS_PASS; - } else - { - printf("Test FAILED: child handler not called\n"); - return PTS_FAIL; - } - } else - { - printf("Test FAILED: parent handler not called\n"); - return PTS_FAIL; - } - } - else - { - printf("Test FAILED: prepare handler not called\n"); - return PTS_FAIL; - } - - /* Should not reach here */ - printf("Error: control should not reach here\n"); - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/1-2.c deleted file mode 100644 index ee994e1f6d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/1-2.c +++ /dev/null @@ -1,244 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* pthread_atfork registers the 'prepare' handler to be called before fork() -* processing in the context of the fork() calling thread. -* -* pthread_atfork registers the 'parent' handler to be called after fork() -* processing in the context of the fork() calling thread in the parent process. -* -* pthread_atfork registers the 'child' handler to be called after fork() -* processing in the context of the fork() calling thread in the child process. - - -* The steps are: -* -> Create a new thread -* -> Call pthread_atfork from the main thread. -* -> Child thread forks. -* -> Check that the handlers have been called, and in the context of the -* calling thread. - -* The test fails if the thread executing the handlers is not the one expected, -* or if the handlers are not executed. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -pthread_t threads[ 3 ]; -pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; -pthread_t ch; - -/* at fork handlers */ -void prepare( void ) -{ - threads[ 0 ] = pthread_self(); -} - -void parent( void ) -{ - threads[ 1 ] = pthread_self(); -} - -void child( void ) -{ - threads[ 2 ] = pthread_self(); -} - - -/* Thread function */ -void * threaded( void * arg ) -{ - int ret, status; - pid_t child, ctl; - - /* Wait main thread has registered the handler */ - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex" ); - } - - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex" ); - } - - /* fork */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - if ( !pthread_equal( ch, threads[ 0 ] ) ) - { - FAILED( "prepare handler was not called in the thread s context" ); - } - - if ( !pthread_equal( pthread_self(), threads[ 2 ] ) ) - { - FAILED( "child handler was not called in the thread s context" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - if ( !pthread_equal( ch, threads[ 0 ] ) ) - { - FAILED( "prepare handler was not called in the thread s context" ); - } - - if ( !pthread_equal( pthread_self(), threads[ 1 ] ) ) - { - FAILED( "parent handler was not called in the thread s context" ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* quit */ - return NULL; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - - /* Initialize output */ - output_init(); - - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex" ); - } - - ret = pthread_create( &ch, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a thread" ); - } - - /* Register the handlers */ - ret = pthread_atfork( prepare, parent, child ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers" ); - } - - /* Let the child go on */ - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex" ); - } - - ret = pthread_join( ch, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/2-1.c deleted file mode 100644 index 095eb5ac73..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/2-1.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * int pthread_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void)) - * - * If no handling is desired at one or more of these three points, the corresponding fork - * handler address(es) may be set to NULL. - * - * STEPS: - * 1. Call pthread_atfork() with all NULL paramters - * 2. Check to make sure the function returns success - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main () -{ - pid_t pid; - int ret; - - /* Set up the fork handlers */ - ret = pthread_atfork(NULL, NULL, NULL); - if(ret != 0) - { - if(ret == ENOMEM) - { - printf("Error: ran out of memory\n"); - return PTS_UNRESOLVED; - } - - printf("Test FAILED: Expected return value success, instead received %d\n", ret); - return PTS_FAIL; - } - - /* Now call fork() to make sure everything goes smoothly */ - pid = fork(); - - if(pid < 0) - { - perror("Error in fork()\n"); - return PTS_UNRESOLVED; - } - if(pid == 0) - { - /* Child process */ - pthread_exit(0); - } else - { - /* Parent process */ - wait(NULL); - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/2-2.c deleted file mode 100644 index bd46fcfd6f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/2-2.c +++ /dev/null @@ -1,314 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* NULL can be passed as any of these handlers when no treatment is required. - -* The steps are: -* -> Create a new thread -* -> Try all NULL / non NULL combinations (7) of pthread_atfork parameters. - -* The test fails if the registered handlers are not executed as expected. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int iPrepare = 0, iParent = 0, iChild = 0; -pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; - -/* pthread_atfork handlers */ -/* 0: NULL NULL NULL (1) - 1: p1 NULL NULL (2) - 2: NULL pa2 NULL (4) - 3: NULL NULL c3 (8) - 4: p4 pa4 NULL (16) - 5: p5 NULL c5 (32) - 6: NULL pa6 c6 (64) - The ultimate combination is already tested in other testcase. - tot: 50 84 104 - */ -void p1( void ) -{ - iPrepare |= 1 << 1; -} - -void p4( void ) -{ - iPrepare |= 1 << 4; -} - -void p5( void ) -{ - iPrepare |= 1 << 5; -} - -void pa2( void ) -{ - iParent |= 1 << 2; -} - -void pa4( void ) -{ - iParent |= 1 << 4; -} - -void pa6( void ) -{ - iParent |= 1 << 6; -} - -void c3( void ) -{ - iChild |= 1 << 3; -} - -void c5( void ) -{ - iChild |= 1 << 5; -} - -void c6( void ) -{ - iChild |= 1 << 6; -} - - -/* Thread function */ -void * threaded( void * arg ) -{ - int ret, status; - pid_t child, ctl; - - /* Wait main thread has registered the handler */ - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex" ); - } - - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex" ); - } - - /* fork */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - if ( iPrepare != 50 ) - { - FAILED( "prepare handler were not called as expected" ); - } - - if ( iChild != 104 ) - { - FAILED( "prepare handler were not called as expected" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - if ( iPrepare != 50 ) - { - FAILED( "prepare handler were not called as expected" ); - } - - if ( iParent != 84 ) - { - FAILED( "prepare handler were not called as expected" ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* quit */ - return NULL; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - pthread_t ch; - - /* Initialize output */ - output_init(); - - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex" ); - } - - ret = pthread_create( &ch, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a thread" ); - } - - /* Register the handlers */ - ret = pthread_atfork( NULL, NULL, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers(N,N,N)" ); - } - - ret = pthread_atfork( p1, NULL, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers(h,N,N)" ); - } - - ret = pthread_atfork( NULL, pa2, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers(N,h,N)" ); - } - - ret = pthread_atfork( NULL, NULL, c3 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers(N,N,h)" ); - } - - ret = pthread_atfork( p4, pa4, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers(h,h,N)" ); - } - - ret = pthread_atfork( p5, NULL, c5 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers(h,N,h)" ); - } - - ret = pthread_atfork( NULL, pa6, c6 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers(N,h,h)" ); - } - - /* Let the child go on */ - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex" ); - } - - ret = pthread_join( ch, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/3-1.sh deleted file mode 100755 index fc7f4a0038..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/3-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test int pthread_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void)) - - -# This is tested implicitly via assertion 1 and 2. - -echo "Tested implicitly via assertions 1 and 2. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/3-2.c deleted file mode 100644 index 59804cda7c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/3-2.c +++ /dev/null @@ -1,246 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* If there is not enough memory to store handler adresses, -* the function returns ENOMEM. - -* The steps are: -* -> Register up to 10000 handlers. -* -> In case of failure, check the error code is ENOMEM. -* -> Otherwise, check the handlers are all executed.. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; - -int controls[ 3 ] = {0, 0, 0}; -/* pthread_atfork handlers */ -void prepare( void ) -{ - controls[ 0 ] ++; -} - -void parent( void ) -{ - controls[ 1 ] ++; -} - -void child( void ) -{ - controls[ 2 ] ++; -} - - -/* Thread function */ -void * threaded( void * arg ) -{ - int ret, status; - pid_t child, ctl; - - /* Wait main thread has registered the handler */ - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex" ); - } - - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex" ); - } - - /* fork */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - if ( controls[ 0 ] != 10000 ) - { - FAILED( "prepare handler skipped some rounds" ); - } - - if ( controls[ 2 ] != 10000 ) - { - FAILED( "child handler skipped some rounds" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - if ( controls[ 0 ] != 10000 ) - { - FAILED( "prepare handler skipped some rounds" ); - } - - if ( controls[ 1 ] != 10000 ) - { - FAILED( "parent handler skipped some rounds" ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - - /* quit */ - return NULL; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, i; - pthread_t ch; - - /* Initialize output */ - output_init(); - - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex" ); - } - - ret = pthread_create( &ch, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a thread" ); - } - - /* Register the handlers */ - for ( i = 0; i < 10000; i++ ) - { - ret = pthread_atfork( prepare, parent, child ); - - if ( ret == ENOMEM ) - { - output( "ENOMEM returned after %i iterations\n", i ); - break; - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers" ); - } - } - - if ( ret == 0 ) - { - - /* Let the child go on */ - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex" ); - } - - ret = pthread_join( ch, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/3-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/3-3.c deleted file mode 100644 index 367a680a66..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/3-3.c +++ /dev/null @@ -1,348 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function does not return EINTR - -* The steps are: -* -> kill a thread which calls pthread_atfork -* -> check that EINTR is never returned - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*********************** standard includes ************************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/******************************************************************************/ -/*********************** Test framework ***********************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/***************************** Configuration **********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - -/******************************************************************************/ -/***************************** Test case *********************************/ -/******************************************************************************/ - -char do_it = 1; -unsigned long count_ope = 0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig = 0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} - -thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig ( void * arg ) -{ - thestruct * thearg = ( thestruct * ) arg; - int ret; - pid_t process; - - process = getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread" ); - } - - while ( do_it ) - { -#ifdef WITH_SYNCHRO - - if ( ( ret = sem_wait( thearg->sem ) ) ) - { - UNRESOLVED( errno, "Sem_wait in sendsig" ); - } - - count_sig++; -#endif - - ret = kill( process, thearg->sig ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Kill in sendsig" ); - } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig1 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 1" ); - } - -#endif -} - -/* This one is registered for signal SIGUSR2 */ -void sighdl2( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig2 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 2" ); - } - -#endif -} - -void prepare( void ) -{ - return ; -} - -void parent( void ) -{ - return ; -} - -void child( void ) -{ - return ; -} - -/* Test function -- calls pthread_setschedparam() and checks that EINTR is never returned. */ -void * test( void * arg ) -{ - int ret = 0; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_UNBLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread" ); - } - - - while ( do_it ) - { - count_ope++; - ret = pthread_atfork( prepare, parent, child ); - - if ( ret == EINTR ) - { - FAILED( "EINTR was returned" ); - } - - } - - return NULL; -} - - -/* Main function */ -int main ( int argc, char * argv[] ) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2, me; - thestruct arg1, arg2; - - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset ( &sa.sa_mask ); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - - if ( ( ret = sigaction ( SIGUSR1, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler1" ); - } - - sa.sa_handler = sighdl2; - - if ( ( ret = sigaction ( SIGUSR2, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler2" ); - } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset( &usersigs ); - - ret = sigaddset( &usersigs, SIGUSR1 ); - - ret |= sigaddset( &usersigs, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to add SIGUSR1 or 2 to a signal set" ); - } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread" ); - } - -#ifdef WITH_SYNCHRO - if ( sem_init( &semsig1, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig1 init" ); - } - - if ( sem_init( &semsig2, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig2 init" ); - } - -#endif - - me = pthread_self(); - - if ( ( ret = pthread_create( &th_work, NULL, test, &me ) ) ) - { - UNRESOLVED( ret, "Worker thread creation failed" ); - } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ( ( ret = pthread_create( &th_sig1, NULL, sendsig, ( void * ) & arg1 ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread creation failed" ); - } - - if ( ( ret = pthread_create( &th_sig2, NULL, sendsig, ( void * ) & arg2 ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread creation failed" ); - } - - - - /* Let's wait for a while now */ - sleep( 1 ); - - - /* Now stop the threads and join them */ - do - { - do_it = 0; - } - while ( do_it ); - - - if ( ( ret = pthread_join( th_sig1, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread join failed" ); - } - - if ( ( ret = pthread_join( th_sig2, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread join failed" ); - } - - - if ( ( ret = pthread_join( th_work, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread join failed" ); - } - - -#if VERBOSE > 0 - output( "Test executed successfully.\n" ); - - output( " %d operations.\n", count_ope ); - -#ifdef WITH_SYNCHRO - output( " %d signals were sent meanwhile.\n", count_sig ); - -#endif -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/4-1.c deleted file mode 100644 index 8c51c77c03..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/4-1.c +++ /dev/null @@ -1,287 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* When pthread_atfork is called several times, the prepare handlers are executed -* in reversed order as they were registered, and child and parent handlers are -* executed in the same order as they were registered. - -* The steps are: -* -> Register some handlers for which call order is traceable. - -* The test fails if the registered handlers are not executed as expected. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; - -int control = 0; -int nerrors = 0; - -/* pthread_atfork handlers */ -void pre3( void ) -{ - control++; - - if ( control != 1 ) nerrors++; -} - -void pre2( void ) -{ - control++; - - if ( control != 2 ) nerrors++; -} - -void pre1( void ) -{ - control++; - - if ( control != 3 ) nerrors++; -} - -void par1( void ) -{ - control++; - - if ( control != 4 ) nerrors++; -} - -void par2( void ) -{ - control++; - - if ( control != 5 ) nerrors++; -} - -void par3( void ) -{ - control++; - - if ( control != 6 ) nerrors++; -} - -void chi1( void ) -{ - control += 2; - - if ( control != 5 ) nerrors++; -} - -void chi2( void ) -{ - control += 2; - - if ( control != 7 ) nerrors++; -} - -void chi3( void ) -{ - control += 2; - - if ( control != 9 ) nerrors++; -} - -/* Thread function */ -void * threaded( void * arg ) -{ - int ret, status; - pid_t child, ctl; - - /* Wait main thread has registered the handler */ - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex" ); - } - - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex" ); - } - - /* fork */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - if ( nerrors ) - { - FAILED( "Errors occured in the child" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - if ( nerrors ) - { - FAILED( "Errors occured in the parent (only)" ); - } - - /* quit */ - return NULL; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - pthread_t ch; - - /* Initialize output */ - output_init(); - - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex" ); - } - - ret = pthread_create( &ch, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a thread" ); - } - - /* Register the handlers */ - ret = pthread_atfork( pre1, par1, chi1 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers" ); - } - - ret = pthread_atfork( pre2, par2, chi2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers" ); - } - - ret = pthread_atfork( pre3, par3, chi3 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to register the atfork handlers" ); - } - - - /* Let the child go on */ - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex" ); - } - - ret = pthread_join( ch, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/assertions.xml deleted file mode 100644 index c777a483bb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/assertions.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - The function - - int pthread_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void)) - - shall declare fork handlers to be called before and after a fork() command, in the context - of the thread that called the fork(). The 'prepare' fork handler shall be called before - fork() processing commences. The 'parent' fork handle shall be called after fork() - processing completes in the parent process. The 'child' fork shall be called after - fork() processing completes in the child process. - - - - If no handling is desired at one or more of these three points, the corresponding fork - handler address(es) may be set to NULL. - - - - Upon successful completion, pthread_atfork() shall return a value of zero; otherwise an - error number shall be returned to indicate the error: - - [ENOMEM] - insufficient table space exists to record the fork handler addresses. - - The function shall not return an error code of [EINTR] - - - When pthread_atfork is called several times, the prepare handlers are -executed in reversed order as they were registered, and child and parent -handlers are executed in the same order as they were registered. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/coverage.txt deleted file mode 100644 index fd4000f252..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_atfork() function: - -Assertion Tested? -1 YES -2 YES -3 YES - *Note: will not test ENOMEM - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_atfork/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/1-1.c deleted file mode 100644 index 49e7ea50f3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/1-1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_attr_destroy() - * shall destory a thread attributes object. An implementation may cause - * pthread_attr_destroy() to set 'attr' to an implementation-defined invalid - * value. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Destroy that initialized attribute using pthread_attr_destroy() - * 3. Using pthread_attr_create(), pass to it the destroyed attribute. It - * should return the error EINVAL, the value specified by 'attr' is - * is invalid. - * - */ - -#include -#include -#include -#include "posixtest.h" - - -void *a_thread_func() -{ - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - pthread_attr_t new_attr; - int ret; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy attribute */ - if(pthread_attr_destroy(&new_attr) != 0) - { - perror("Cannot destroy the attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Creating a thread, passing to it the destroyed attribute, should - * result in an error value of EINVAL (invalid 'attr' value). */ - ret=pthread_create(&new_th, &new_attr, a_thread_func, NULL); - - if(ret==EINVAL) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else if((ret != 0) && ((ret == EPERM) || (ret == EAGAIN))) - { - perror("Error created a new thread\n"); - return PTS_UNRESOLVED; - } - else if(ret==0) - { - printf("Test PASSED: NOTE*: Though returned 0 when creating a thread with a destroyed attribute, this behavior is compliant with garbage-in-garbage-out. \n"); - return PTS_PASS; - } else - { - printf("Test FAILED: (1) Incorrect return code from pthread_create(); %d not EINVAL or (2) Error in pthread_create()'s behavior in returning error codes \n", ret); - return PTS_FAIL; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/2-1.c deleted file mode 100644 index 5731020d7d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/2-1.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * A destroyed 'attr' attributes object can be reinitialized using - * pthread_attr_init(); the results of otherwise referencing the object - * after it has been destroyed are undefined. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Destroy that initialized attribute using pthread_attr_destroy() - * 3. Initialize the pthread_attr_t object again. This should not result - * in an error. - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_attr_t new_attr; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy attribute */ - if(pthread_attr_destroy(&new_attr) != 0) - { - perror("Cannot destroy the attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Initialize attribute. This shouldn't result in an error. */ - if(pthread_attr_init(&new_attr) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/3-1.c deleted file mode 100644 index 794ab2d8c8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/3-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Upon successful completion, pthread_attr_destroy() shall return a value of 0. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Destroy that initialized attribute using pthread_attr_destroy(). - * This should return 0; - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_attr_t new_attr; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy attribute */ - if(pthread_attr_destroy(&new_attr) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/assertions.xml deleted file mode 100644 index 9a1a99056f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/assertions.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - The function - - int pthread_attr_destroy(pthread_attr_t *attr) - - destorys a thread attributes object. An implementation may cause - pthread_attr_destroy() to set 'attr' to an implementation-defined invalid - value. - - - A destroyed 'attr' attributes object can be reinitialized using - pthread_attr_init(); undefined results referencing the object - after it has been destroyed. - - - If success, pthread_attr_destroy() shall return a 0. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/coverage.txt deleted file mode 100644 index 561458ea53..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_attr_destroy function: - -Assertion Tested? -1 YES *Fails on the implementation of threads that I'm working - on. -2 YES -3 YES - -Note: pthread_attr_destroy leaves a lot up to the implementation of threads -that you are testing on. For instance, on the implementation that I'm working -on, pthread_attr_destroy() does nothing. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/1-1.c deleted file mode 100644 index c7f3421621..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/1-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_attr_getdetachstate() - * shall get the detachstate attribute in the 'attr' object. The detach state - * is either PTHREAD_CREATE_DETACHED or PTHEAD_CREATE_JOINABLE. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Using pthread_attr_getdetachstate(), get the detachstate of the - * attribute object. It should be PTHREAD_CREATE_JOINABLE. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_attr_t new_attr; - int detach_state; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* The test passes if pthread_attr_getdetachstate gets the attribute - * of PTHREAD_CREATE_JOINABLE from the attribute object. */ - if(pthread_attr_getdetachstate(&new_attr, &detach_state) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if(detach_state == PTHREAD_CREATE_JOINABLE) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/1-2.c deleted file mode 100644 index 78b27b6047..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/1-2.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_attr_getdetachstate() - * shall get the detachstate attribute in the 'attr' object. The detach state - * is either PTHREAD_CREATE_DETACHED or PTHEAD_CREATE_JOINABLE. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init(), this will - * make detachstate be PTHREAD_CREATE_JOINABLE. - * 2. Use pthread_attr_setdetachstate() to set the attribute to - * PTHREAD_CREATE_DETACHED. - * 3. Using pthread_attr_getdetachstate(), get the detachstate of the - * attribute object, is should be PTHREAD_CREATE_DETACHED. - * - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_attr_t new_attr; - int detach_state; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the detachstate to PTHREAD_CREATE_DETACHED. */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_DETACHED) != 0) - { - perror("Error in pthread_attr_setdetachstate()\n"); - return PTS_UNRESOLVED; - } - - /* The test passes if pthread_attr_getdetachstate gets the attribute - * of PTHREAD_CREATE_DETACHED from the attribute object. */ - if(pthread_attr_getdetachstate(&new_attr, &detach_state) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if(detach_state == PTHREAD_CREATE_DETACHED) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/2-1.sh deleted file mode 100755 index 4b074af3a6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/2-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_getdetachstate returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/assertions.xml deleted file mode 100644 index 22c5fa3804..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/assertions.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - The function - - int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate) - - will get the detachstate attribute in the 'attr' object. The detach state - can be either PTHREAD_CREATE_DETACHED or PTHEAD_CREATE_JOINABLE. - - - If success, it returns 0. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/coverage.txt deleted file mode 100644 index 3508b792f5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getdetachstate/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -This document defines the coverage for the pthread_attr_getdetachstate function: - -Assertion Tested? -1 YES -2 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/1-1.c deleted file mode 100644 index 0796e5dd60..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/1-1.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_getinheritsched() - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setinheritsched with inheritsched parameter - * 3. Call pthread_attr_getinheritsched to get the inheritsched - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_getinheritsched" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define EXPLICIT PTHREAD_EXPLICIT_SCHED -#define INHERIT PTHREAD_INHERIT_SCHED - -int verify_inheritsched(pthread_attr_t *attr, int schedtype) { - int rc; - int inheritsched; - - rc = pthread_attr_getinheritsched(attr, &inheritsched); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_getinheritsched"); - exit(PTS_UNRESOLVED); - } - switch(schedtype) { - case INHERIT: - if (inheritsched != INHERIT) { - perror(ERROR_PREFIX "got wrong inheritsched param"); - exit(PTS_FAIL); - } - break; - case EXPLICIT: - if (inheritsched != EXPLICIT) { - perror(ERROR_PREFIX "got wrong inheritsched param"); - exit(PTS_FAIL); - } - break; - } - return 0; -} - -int main() -{ - int rc=0; - pthread_attr_t attr; - - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setinheritsched(&attr, INHERIT); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_setinheritsched"); - exit(PTS_UNRESOLVED); - } - verify_inheritsched(&attr, INHERIT); - - rc = pthread_attr_setinheritsched(&attr, EXPLICIT); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_setinheritsched"); - exit(PTS_UNRESOLVED); - } - verify_inheritsched(&attr, EXPLICIT); - - rc = pthread_attr_destroy(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - printf("Test PASS\n"); - return PTS_PASS; -} - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/2-1.sh deleted file mode 100755 index ce6aaa8671..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_getinheritsched returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/assertions.xml deleted file mode 100644 index 9b2c147171..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/assertions.xml +++ /dev/null @@ -1,12 +0,0 @@ - - -pthread_attr_getinheritsched shall get the inheritsched attribute in the attr argument. -PTHREAD_INHERIT_SCHED and PTHREAD_EXPLICIT_SCHED are valid value. - - -If succesful, the pthread_attr_getinheritsched shall return zero. - - -If fail, the pthread_attr_getinheritsched shall return an error number. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/coverage.txt deleted file mode 100644 index 1dad85925f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getinheritsched/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_attr_getinheritsched function: - -Assertion Tested? -1 YES -2 YES -3 won't test - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/1-1.c deleted file mode 100644 index e6f3531ea6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/1-1.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_getschedparam() - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setschedpolicy with policy parameter - * 3. Call pthread_attr_setschedparam with a sched param parameter - * 4. Call pthread_attr_getschedparam to get the sched param - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_getschedparam" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define FIFOPOLICY SCHED_FIFO -#define RRPOLICY SCHED_RR -#define OTHERPOLICY SCHED_OTHER - -int verify_param(pthread_attr_t *attr, int priority) { - int rc; - struct sched_param param; - - rc = pthread_attr_getschedparam(attr, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_getschedparam\n"); - exit(PTS_UNRESOLVED); - } - if(priority != param.sched_priority) { - printf(ERROR_PREFIX "got wrong sched param\n"); - exit(PTS_FAIL); - } - return 0; -} - -int main() -{ - int rc=0; - pthread_attr_t attr; - struct sched_param param; - int priority; - - rc = pthread_attr_init(&attr); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setschedpolicy(&attr, FIFOPOLICY); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy\n"); - exit(PTS_UNRESOLVED); - } - priority = sched_get_priority_max(FIFOPOLICY); - if(priority == -1) { - printf(ERROR_PREFIX "sched_get_priority_max\n"); - exit(PTS_UNRESOLVED); - } - param.sched_priority = priority; - rc = pthread_attr_setschedparam(&attr, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedparam\n"); - exit(PTS_UNRESOLVED); - } - verify_param(&attr, priority); - - rc = pthread_attr_setschedpolicy(&attr, RRPOLICY); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy\n"); - exit(PTS_UNRESOLVED); - } - priority = sched_get_priority_max(RRPOLICY); - if(priority == -1) { - printf(ERROR_PREFIX "sched_get_priority_max\n"); - exit(PTS_UNRESOLVED); - } - param.sched_priority = priority; - rc = pthread_attr_setschedparam(&attr, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedparam\n"); - exit(PTS_UNRESOLVED); - } - verify_param(&attr, priority); - - rc = pthread_attr_destroy(&attr); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_destroy\n"); - exit(PTS_UNRESOLVED); - } - printf("Test PASS\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/2-1.sh deleted file mode 100755 index 1ee5075382..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, QUALCOMM Inc. All rights reserved. -# Created by: abisain REMOVE-THIS AT qualcomm DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_getschedparam returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/assertions.xml deleted file mode 100644 index 640abd947e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/assertions.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - The function - - int pthread_attr_getschedparam(const pthread_attr_t *restrict attr, - contst struct sched_param *restrict param); - - gets the scheduling parameter attributes in the 'attr' argument. - The contents of the 'param' structure are defined in sched.h. - For the SCHED_FIFO and SCHED_RR policies, the only required member of - 'param' is 'sched_priority'. - - - If success, it returns 0; - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/coverage.txt deleted file mode 100644 index e31ebd6f28..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedparam/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -This document defines the coverage for the pthread_attr_getschedparam function: - -Assertion Tested? -1 YES -2 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/1-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/1-1.sh deleted file mode 100755 index 452c3e9c4c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/1-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_getschedpolicy set policy to attr parameter. - -# This is tested implicitly via assertion 2. - -echo "Tested implicitly via assertion 2. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/2-1.c deleted file mode 100644 index 65b12e19a9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/2-1.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_getschedpolicy() - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setschedpolicy with policy parameter - * 3. Call pthread_attr_getschedpolicy to get the policy - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_getschedpolicy" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define FIFOPOLICY SCHED_FIFO -#define RRPOLICY SCHED_RR -#define OTHERPOLICY SCHED_OTHER - -int verify_policy(pthread_attr_t *attr, int policytype) { - int rc; - int policy; - - rc = pthread_attr_getschedpolicy(attr, &policy); - if( rc != 0) { - printf(ERROR_PREFIX "pthread_attr_getschedpolicy\n"); - exit(PTS_UNRESOLVED); - } - switch(policytype) { - case SCHED_FIFO: - if (policy != FIFOPOLICY) { - printf(ERROR_PREFIX "got wrong policy param\n"); - exit(PTS_FAIL); - } - break; - case SCHED_RR: - if (policy != RRPOLICY) { - printf(ERROR_PREFIX "got wrong policy param\n"); - exit(PTS_FAIL); - } - break; - case SCHED_OTHER: - if (policy != OTHERPOLICY) { - printf(ERROR_PREFIX "got wrong policy param\n"); - exit(PTS_FAIL); - } - break; - } - return 0; -} - -int main() -{ - int rc=0; - pthread_attr_t attr; - - rc = pthread_attr_init(&attr); - if( rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setschedpolicy(&attr, FIFOPOLICY); - if( rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy\n"); - exit(PTS_UNRESOLVED); - } - verify_policy(&attr, FIFOPOLICY); - - rc = pthread_attr_setschedpolicy(&attr, RRPOLICY); - if( rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy\n"); - exit(PTS_UNRESOLVED); - } - verify_policy(&attr, RRPOLICY); - - rc = pthread_attr_setschedpolicy(&attr, OTHERPOLICY); - if( rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy\n"); - exit(PTS_UNRESOLVED); - } - verify_policy(&attr, OTHERPOLICY); - - rc = pthread_attr_destroy(&attr); - if( rc != 0) { - printf(ERROR_PREFIX "pthread_attr_destroy\n"); - exit(PTS_UNRESOLVED); - } - printf("Test PASS\n"); - return PTS_PASS; -} - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/3-1.sh deleted file mode 100755 index 593bceccd8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_getschedpolicy returns 0 on success. - -# This is tested implicitly via assertion 2. - -echo "Tested implicitly via assertion 2. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/assertions.xml deleted file mode 100644 index 47c02d850e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/assertions.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - The function - int pthread_attr_getschedpolicy(const pthread_attr_t *restrict attr, - int *restrict policy); - - gets the schedpolicy attribute in the 'attr' argument. - - - - The supported values of policy will include SCHED_FIFO, SCHED_RR, - and SCHED_OTHER. - - - - If success, the function returns zero; - otherwise, an error number shall be returned indicating the error. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/coverage.txt deleted file mode 100644 index 6986bbbfd9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getschedpolicy/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_attr_getschedpolicy function: - -Assertion Tested? -1 YES -2 YES -3 YES - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/1-1.c deleted file mode 100644 index 56ccbf6f02..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/1-1.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_getscope() - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setscope with contentionscope parameter - * 3. Call pthread_attr_getscope to get the contentionscope - - * NOTE: The contension scope value is a may requirement. - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_getscope" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define SYSTEMSCOPE PTHREAD_SCOPE_SYSTEM -#define PROCESSSCOPE PTHREAD_SCOPE_PROCESS - -int verify_scope(pthread_attr_t *attr, int scopetype) { - int rc; - int scope; - - rc = pthread_attr_getscope(attr, &scope); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_getscope"); - exit(PTS_UNRESOLVED); - } - switch(scopetype) { - case SYSTEMSCOPE: - if (scope != SYSTEMSCOPE) { - perror(ERROR_PREFIX "got wrong scope param"); - exit(PTS_FAIL); - } - break; - case PROCESSSCOPE: - if (scope != PROCESSSCOPE) { - perror(ERROR_PREFIX "got wrong scope param"); - exit(PTS_FAIL); - } - break; - } - return 0; -} - -int main() -{ - int rc=0; - pthread_attr_t attr; - - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setscope(&attr, SYSTEMSCOPE); - if( rc != 0) { - perror(ERROR_PREFIX "PTHREAD_SCOPE_SYSTEM is not supported"); - } else { - verify_scope(&attr, SYSTEMSCOPE); - } - rc = pthread_attr_setscope(&attr, PROCESSSCOPE); - if( rc != 0) { - perror(ERROR_PREFIX "PTHREAD_SCOPE_SYSTEM is not supported"); - } else { - verify_scope(&attr, PROCESSSCOPE); - } - - rc = pthread_attr_destroy(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - printf("Test PASS\n"); - return PTS_PASS; -} - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/2-1.sh deleted file mode 100755 index 33a4cf7e23..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_getscope returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/assertions.xml deleted file mode 100644 index 0f1a26361d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/assertions.xml +++ /dev/null @@ -1,12 +0,0 @@ - - -pthread_attr_getscope shall get the inheritsched attribute in the attr argument -The contentionscope attribute may have the values PTHREAD_SCOPE_SYSTEM, signifying system scheduling contention scope, or PTHREAD_SCOPE_PROCESS, signifying process scheduling contention scope. - - -If succesful, the pthread_attr_getscope shall return zero. - - -If fail, the pthread_attr_getscope shall return an error number. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/coverage.txt deleted file mode 100644 index 3292fe534c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getscope/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_attr_getscope function: - -Assertion Tested? -1 YES -2 YES -3 won't test - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/1-1.c deleted file mode 100644 index b9ac038318..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/1-1.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_getstack() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. set the stackaddr and stacksize to attr - * 3. get the stackaddr and stacksize - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_getstack" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -int main() -{ - pthread_attr_t attr; - void *stack_addr; - size_t stack_size; - size_t ssize; - void *saddr; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - /* Get the default stack_addr and stack_size value */ - rc = pthread_attr_getstack(&attr, &stack_addr, &stack_size); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_getstack"); - exit(PTS_UNRESOLVED); - } - printf("stack_addr = %p, stack_size = %zu\n", stack_addr, stack_size); - - stack_size = PTHREAD_STACK_MIN; - - if (posix_memalign (&stack_addr, sysconf(_SC_PAGE_SIZE), - stack_size) != 0) - { - perror (ERROR_PREFIX "out of memory while " - "allocating the stack memory"); - exit(PTS_UNRESOLVED); - } - printf("stack_addr = %p, stack_size = %zu\n", stack_addr, stack_size); - - rc = pthread_attr_setstack(&attr, stack_addr, stack_size); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_setstack"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_getstack(&attr, &saddr, &ssize); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_getstack"); - exit(PTS_UNRESOLVED); - } - printf("saddr = %p, ssize = %zu\n", saddr, ssize); - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/2-1.sh deleted file mode 100755 index ef0b5f748c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_getstack returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/assertions.xml deleted file mode 100644 index f3e49d6f69..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/assertions.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - The pthread_attr_getstack() shall get the thread creation stack attributes - stackaddr and stacksize in the attr ojbect. - - - - If success, it returns zero. - - - - Shall not return an error code of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/coverage.txt deleted file mode 100644 index 3cdaa1d586..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstack/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_attr_getstack function: - -Assertion Tested? -1 YES -2 YES -3 won't test - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstackaddr/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstackaddr/assertions.xml deleted file mode 100644 index 5bcbaa1af3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstackaddr/assertions.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstackaddr/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstackaddr/coverage.txt deleted file mode 100644 index 66d53df79c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstackaddr/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_attr_getstackaddr function: - -Assertion Tested? -1 YES -2 YES -3 won't test - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/1-1.c deleted file mode 100644 index 9caf862d9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/1-1.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_getstacksize() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. set the stacksize to attr - * 3. get the stacksize - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_getstacksize" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -int main() -{ - pthread_attr_t attr; - size_t stack_size; - size_t ssize; - void *saddr; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - /* Get the default stack_addr and stack_size value */ - rc = pthread_attr_getstacksize(&attr, &stack_size); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_getstacksize"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_size = %lu\n", stack_size); */ - - stack_size = PTHREAD_STACK_MIN; - - if (posix_memalign (&saddr, sysconf(_SC_PAGE_SIZE), - stack_size) != 0) - { - perror (ERROR_PREFIX "out of memory while " - "allocating the stack memory"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_size = %lu\n", stack_size); */ - - rc = pthread_attr_setstacksize(&attr, stack_size); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_setstacksize"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_getstacksize(&attr, &ssize); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_getstacksize"); - exit(PTS_UNRESOLVED); - } - /* printf("ssize = %lu\n", ssize); */ - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/2-1.sh deleted file mode 100755 index ef0b5f748c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_getstack returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/assertions.xml deleted file mode 100644 index e00a566710..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/assertions.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - The pthread_attr_getstacksize() shall get the thread creation stacksize - attributes stacksize in the attr ojbect. - - - - If success, it returns zero. - - - - Shall not return an error code of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/coverage.txt deleted file mode 100644 index 8688d403d5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_getstacksize/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_attr_getstacksize function: - -Assertion Tested? -1 YES -2 YES -3 won't test - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/1-1.c deleted file mode 100644 index daab047b0b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/1-1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_attr_init() - * shall initialize a thread attributes object 'attr' with the default value - * for all the individual attributes used by a given implementation. - - * NOTE: Since most default values are implementation specific, only the - * attribute of the detachstate will be tested since the default value - * is defined in the spec. (default value: PTHREAD_CREATE_JOINABLE) - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Using pthread_attr_getdetachstate(), test that the default value - * of the detachstate is PTHREAD_CREATE_JOINABLE (the default). - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_attr_t new_attr; - int detach_state; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* The test passes if the attribute object has a detachstate of - * PTHREAD_CREATE_JOINABLE, which is the default value for this - * attribute. */ - if(pthread_attr_getdetachstate(&new_attr, &detach_state) != 0) - { - perror("Error obtaining the detachstate of the attribute\n"); - return PTS_UNRESOLVED; - } - - if(detach_state == PTHREAD_CREATE_JOINABLE) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/2-1.c deleted file mode 100644 index 78296dfbcb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/2-1.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test the resulting attributes object (possibly modified by setting individual - * attribute values) when used by pthread_create() defines the attributes of - * the thread created. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Pass the newly created attribute object to pthread_create() - * 3. Test that thread is joinable, since using pthread_attr_init() will - * set the default detachstate to PTHREAD_CREATE_JOINABLE. - * 4. Pthread_detach() to test this. It should - * not return errors since the thread should be joinable (non-detached). If it - * returns an error, that means that the thread is not joinable, but rather - * in a detached state, and the test fails. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define TIMEOUT 5 /* Timeout value of 5 seconds. */ -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ - -void *a_thread_func() -{ - - /* Indicate to main() that the thread was created. */ - sem1=INTHREAD; - - /* Wait for main to detach change the attribute object and try and detach this thread. - * Wait for a timeout value of 10 seconds before timing out if the thread was not able - * to be detached. */ - sleep(TIMEOUT); - - printf("Test FAILED: Did not detach the thread, main still waiting for it to end execution.\n"); - pthread_exit((void*)PTS_FAIL); - return NULL; -} - -int main() -{ - pthread_t new_th; - pthread_attr_t new_attr; - int ret_val; - - /* Initializing */ - sem1 = INMAIN; - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Create a new thread passing it the new attribute object */ - if(pthread_create(&new_th, &new_attr, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to indicate that the start routine for the thread has started. */ - while(sem1==INMAIN) - sleep(1); - - /* If pthread_detach fails, that means that the test fails as well. */ - ret_val=pthread_detach(new_th); - - if(ret_val != 0) - { - /* Thread is already detached. */ - if(ret_val == EINVAL) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - /* pthread_detach() failed for another reason. */ - else - { - printf("Error in pthread_detach(), error: %d\n", ret_val); - return PTS_UNRESOLVED; - } - } - - printf("Test PASSED\n"); - return PTS_PASS; - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/3-1.c deleted file mode 100644 index 1879cb2d6e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/3-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * A single attributes object can be used in multiple simultaneous calls to - * pthread_create(). - * NOTE: Results are undefined if pthread_attr_init() is called specifying an - * already initialized 'attr' attributes object. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Create many threads using the same attribute object. - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define NUM_THREADS 5 - -void *a_thread_func(void *attr) -{ - pthread_exit(NULL); - return NULL; -} - -int main() -{ - pthread_t new_threads[NUM_THREADS]; - pthread_attr_t new_attr; - int i, ret; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Create [NUM_THREADS] number of threads with the same attribute - * object. */ - for(i=0;i -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_attr_t new_attr; - int ret; - - /* Initialize attribute */ - ret=pthread_attr_init(&new_attr); - if(ret == 0) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - /* There's insufficient memory, can't run test */ - else if(ret == ENOMEM) - { - perror("Error in pthread_attr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Any other return value other than 0 or ENOMEM, means the test - * failed, because those are the only 2 return values for this - * function. */ - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/assertions.xml deleted file mode 100644 index 09a95c7773..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/assertions.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - The function - - int pthread_attr_init(pthread_attr_t *attr) - - initializes a thread attributes object 'attr' with the default value - for all the individual attributes accorinding to a given implementation. - - NOTE: Since most default values are implementation specific, only the - attribute of the detachstate will be tested since the default value - is defined in the spec. (default value: PTHREAD_CREATE_JOINABLE) - - - The resulting attributes object (that can also be modified by setting - individual attribute values) when used by pthread_create() defines the - attributes of the thread created. - - - A single attributes object can be used in multiple simultaneous calls to - pthread_create(). - NOTE: Undefined results occur if pthread_attr_init() is called specifying an - already initialized 'attr' attributes object. - - - If success, pthread_attr_init() returns 0. - - - If it fails, an error number will be returned to indicate the error: - [ENOMEM] - Not enough memory to initialize the thread attributes - object. - - It will not return [EINTR]. - - NOTE: WON'T test here since it is more of a stress test, not a conformance - test. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/coverage.txt deleted file mode 100644 index 8f79ebe1f8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_init/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_attr_init function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 NO ** WON'T test since it is more of a stress test rather than - conformance. - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/1-1.c deleted file mode 100644 index d2dc92311b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/1-1.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_attr_setdetachstate() - * - * shall set the detachstate attribute in the 'attr' object. - * The detach state is either PTHREAD_CREATE_DETACHED or - * PTHEAD_CREATE_JOINABLE. - - * A value of PTHREAD_CREATE_DETACHED shall cause all threads created with - * 'attr' to be in the detached state, wheras using a value of - * PTHREAD_CREATE_JOINABLE shall cause threads created with 'attr' to be in - * the joinable state. - * The default value of the detachstate attribute shall be - * PTHREAD_CREATE_JOINABLE. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Using pthread_attr_setdetachstate(), set the detachstate to - * PTHREAD_CREATE_JOINABLE. - * 3. Get the detachedstate and make sure that it is really set to - * PTHREAD_CREATE_JOINABLE. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_attr_t new_attr; - int detach_state; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute object to PTHREAD_CREATE_JOINABLE. */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_JOINABLE) != 0) - { - perror("Error in pthread_attr_setdetachstate()\n"); - return PTS_UNRESOLVED; - } - - /* Check to see if the detachstate is truly PTHREAD_CREATE_JOINABLE. */ - if(pthread_attr_getdetachstate(&new_attr, &detach_state) != 0) - { - perror("Error in pthread_attr_getdetachstate.\n"); - return PTS_UNRESOLVED; - } - - if(detach_state == PTHREAD_CREATE_JOINABLE) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/1-2.c deleted file mode 100644 index 17174c25aa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/1-2.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_attr_setdetachstate() - * - * shall set the detachstate attribute in the 'attr' object. - * The detach state is either PTHREAD_CREATE_DETACHED or - * PTHEAD_CREATE_JOINABLE. - - * A value of PTHREAD_CREATE_DETACHED shall cause all threads created with - * 'attr' to be in the detached state, wheras using a value of - * PTHREAD_CREATE_JOINABLE shall cause threads created with 'attr' to be in - * the joinable state. - * The default value of the detachstate attribute shall be - * PTHREAD_CREATE_JOINABLE. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Using pthread_attr_setdetachstate(), set the detachstate to - * PTHREAD_CREATE_DETACHED. - * 3. Get the detachedstate and make sure that it is really set to - * PTHREAD_CREATE_DETACHED. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_attr_t new_attr; - int detach_state; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute object to PTHREAD_CREATE_DETACHED. */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_DETACHED) != 0) - { - perror("Error in pthread_attr_setdetachstate()\n"); - return PTS_UNRESOLVED; - } - - /* Check to see if the detachstate is truly PTHREAD_CREATE_DETACHED. */ - if(pthread_attr_getdetachstate(&new_attr, &detach_state) != 0) - { - perror("Error in pthread_attr_getdetachstate.\n"); - return PTS_UNRESOLVED; - } - - if(detach_state == PTHREAD_CREATE_DETACHED) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/3-1.sh deleted file mode 100755 index 30a8c555bd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/3-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_getdetachstate returns 0 on success. - -# This is tested implicitly via assertion 1 and 2. - -echo "Tested implicitly via assertions 1 and 2. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/4-1.c deleted file mode 100644 index 7a6a400179..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/4-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_attr_setdetachstate() - * - * shall fail if: - * -[EINVAL] The value of detachstate was not valid - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setdetachstate() using an invalid value of 0 - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_attr_t new_attr; - int ret_val, invalid_val; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute object to an invalid value of 1000000. */ - invalid_val=1000000; - ret_val=pthread_attr_setdetachstate(&new_attr, invalid_val); - - if(ret_val != EINVAL) - { - printf("Test FAILED: Returned %d instead of EINVAL\n", ret_val); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/assertions.xml deleted file mode 100644 index 183ad81eac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/assertions.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - The function - - int pthread_attr_setdetachstate(const pthread_attr_t *attr, int *detachstate) - - sets the detachstate attribute in the 'attr' object. - The detach state can be either PTHREAD_CREATE_DETACHED or - PTHEAD_CREATE_JOINABLE. - - A value of PTHREAD_CREATE_DETACHED causes all threads created with 'attr' - to be in a detached state, and using a value of PTHREAD_CREATE_JOINABLE - causes threads created with 'attr' to be in the joinable state. - The default value of the detachstate attribute is - PTHREAD_CREATE_JOINABLE. - - - If the thread is created detached, then use of the ID of the newly created - thread by the pthread_detach() or pthread_join() function will producer an - error. - - - If success, it returns 0. - - - It shall fail if: - -[EINVAL] The value of detachstate was invalid - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/coverage.txt deleted file mode 100644 index 1c8dfa974f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setdetachstate/coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -This document defines the coverage for the pthread_attr_getdetachstate function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/1-1.c deleted file mode 100644 index 43d21988c3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/1-1.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setinheritsched() - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setinheritsched with inheritsched parameter - * 3. Call pthread_attr_getinheritsched to get the inheritsched - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_setinheritsched" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define EXPLICIT PTHREAD_EXPLICIT_SCHED -#define INHERIT PTHREAD_INHERIT_SCHED - -int verify_inheritsched(pthread_attr_t *attr, int schedtype) { - int rc; - int inheritsched; - - rc = pthread_attr_getinheritsched(attr, &inheritsched); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_getinheritsched"); - exit(PTS_UNRESOLVED); - } - switch(schedtype) { - case INHERIT: - if (inheritsched != INHERIT) { - perror(ERROR_PREFIX "got wrong inheritsched param"); - exit(PTS_FAIL); - } - break; - case EXPLICIT: - if (inheritsched != EXPLICIT) { - perror(ERROR_PREFIX "got wrong inheritsched param"); - exit(PTS_FAIL); - } - break; - } - return 0; -} - -int main() -{ - int rc=0; - pthread_attr_t attr; - - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setinheritsched(&attr, INHERIT); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_setinheritsched"); - exit(PTS_UNRESOLVED); - } - verify_inheritsched(&attr, INHERIT); - - rc = pthread_attr_setinheritsched(&attr, EXPLICIT); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_setinheritsched"); - exit(PTS_UNRESOLVED); - } - verify_inheritsched(&attr, EXPLICIT); - - rc = pthread_attr_destroy(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - printf("Test PASS\n"); - return PTS_PASS; -} - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-1.c deleted file mode 100644 index e3de55f95a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-1.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setinheritsched() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. Set schedule policy (policy) in attr to SCHED_FIFO - * 3. Set inheritsched to PTHREAD_INHERIT_SCHED in attr - * 4. Call pthread_create with attr - * 5. Call pthread_getschedparam in the created thread and get the - * policy value(new_policy) - * 6. Compare new_policy with SCHED_OTHER. SCHED_OTHER is the - * default policy value in the creating thread. if new_policy is - * equal to SCHED_OTHER, the case pass. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "pthread_attr_setinheritsched" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -const long int policy = SCHED_FIFO; -void *thread_func() -{ - int rc; - int new_policy; - pthread_t self = pthread_self(); - - struct sched_param param; - memset(¶m, 0, sizeof(param)); - - rc = pthread_getschedparam(self, &new_policy, ¶m); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_getschedparam"); - exit(PTS_UNRESOLVED); - } - if (new_policy == policy) { - fprintf(stderr, ERROR_PREFIX "The scheduling attribute is not " - "inherited from creating thread \n"); - exit(PTS_FAIL); - } - pthread_exit(0); - return NULL; -} -int main() -{ - pthread_t new_th; - pthread_attr_t attr; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setschedpolicy(&attr, policy); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_setschedpolicy"); - exit(PTS_UNRESOLVED); - } - - int insched = PTHREAD_INHERIT_SCHED; - rc = pthread_attr_setinheritsched(&attr, insched); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_setinheritsched"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_create(&new_th, &attr, thread_func, NULL); - if (rc !=0 ) { - perror(ERROR_PREFIX "pthread_create"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_join(new_th, NULL); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_join"); - exit(PTS_UNRESOLVED); - } - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-2.c deleted file mode 100644 index b41179ee1e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-2.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setinheritsched() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. Set schedule policy (policy) in attr to SCHED_FIFO - * 3. Set inheritsched to PTHREAD_EXPLICIT_SCHED in attr - * 4. Call pthread_create with attr - * 5. Call pthread_getschedparam in the created thread and get the - * policy value(new_policy) - * 6. Compare new_policy with SCHED_OTHER. SCHED_OTHER is the - * default policy value in the creating thread. if new_policy is - * equal to SCHED_OTHER, the case fails. - * - * - adam.li@intel.com: 2004-04-30 - * add code pthread_attr_setschedparam(). Otherwise pthread_create() - * will fail with EINVAL. And, the perror() thing is not correct. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-2" -#define FUNCTION "pthread_attr_setinheritsched" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -const long int policy = SCHED_FIFO; -const long int old_policy = SCHED_OTHER; -void *thread_func(void* arg) -{ - int rc; - int new_policy; - pthread_t self = pthread_self(); - - struct sched_param param; - memset(¶m, 0, sizeof(param)); - - rc = pthread_getschedparam(self, &new_policy, ¶m); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_getschedparam"); - exit(PTS_UNRESOLVED); - } - if (new_policy == old_policy) { - fprintf(stderr, ERROR_PREFIX "The scheduling attribute should " - "not be inherited from creating thread \n"); - exit(PTS_FAIL); - } - pthread_exit(0); - return NULL; -} -int main() -{ - pthread_t new_th; - pthread_attr_t attr; - int rc; - struct sched_param sp; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setschedpolicy(&attr, policy); - if (rc != 0 ) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy"); - exit(PTS_UNRESOLVED); - } - - sp.sched_priority = 1; - rc = pthread_attr_setschedparam(&attr, &sp); - if (rc != 0 ) { - printf(ERROR_PREFIX "pthread_attr_setschedparam"); - exit(PTS_UNRESOLVED); - } - - int insched = PTHREAD_EXPLICIT_SCHED; - rc = pthread_attr_setinheritsched(&attr, insched); - if (rc != 0 ) { - printf(ERROR_PREFIX "pthread_attr_setinheritsched"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_create(&new_th, &attr, thread_func, NULL); - if (rc !=0 ) { - printf("Error at pthread_create(): %s\n", strerror(rc)); - exit(PTS_UNRESOLVED); - } - - rc = pthread_join(new_th, NULL); - if(rc != 0) - { - printf(ERROR_PREFIX "pthread_join"); - exit(PTS_UNRESOLVED); - } - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - printf(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-3.c deleted file mode 100644 index 1cfccec013..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-3.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_attr_setinheritsched() sets the inheritance of - * policy and priority. - - * Steps: - * 1. Create a pthread_attr struct using pthread_attr_init - * 2. Set the inherit sched in it by calling pthread_attr_setinheritsched - * 3. Change main's priority and policy - * 4. Create a new thread. - * 5. Check that it has correct priority and policy - */ - -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define AREA "scheduler" -#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": " - -#define PRIORITY 20 -#define POLICY SCHED_FIFO - -/* Flags that the threads use to indicate events */ -int policy_correct = -1; -int priority_correct = -1; - -void *thread(void *tmp) -{ - struct sched_param param; - int policy; - int rc = 0; - - rc = pthread_getschedparam(pthread_self(), &policy, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_getschedparam\n"); - exit(PTS_UNRESOLVED); - } - if(policy == POLICY) { - policy_correct = 1; - } - if(param.sched_priority == PRIORITY) { - priority_correct = 1; - } - - return NULL; -} - -int main() -{ - pthread_attr_t attr; - pthread_t thread_id; - struct sched_param param; - int rc = 0; - - param.sched_priority = PRIORITY; - - rc = pthread_attr_init(&attr); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setinheritsched\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_setschedparam(pthread_self(), POLICY, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_setschedparam\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_create(&thread_id, &attr, thread, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_create\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_join(thread_id, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_join\n"); - exit(PTS_UNRESOLVED); - } - - if((priority_correct != 1) || (policy_correct != 1)) { - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-4.c deleted file mode 100644 index 660bc6b6ba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/2-4.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_attr_setinheritsched() sets the inheritance of - * policy and priority. - - * Steps: - * 1. Create a pthread_attr struct using pthread_attr_init - * 2. Change main's priority and policy - * 3. Set the inherit sched in it by calling pthread_attr_setinheritsched - * 4. Create a new thread. - * 5. Check that it has correct priority and policy - */ - -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-2" -#define AREA "scheduler" -#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": " - -#define PRIORITY 20 -#define POLICY SCHED_RR - -/* Flags that the threads use to indicate events */ -int policy_correct = -1; -int priority_correct = -1; - -void *thread(void *tmp) -{ - struct sched_param param; - int policy; - int rc = 0; - - rc = pthread_getschedparam(pthread_self(), &policy, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_getschedparam\n"); - exit(PTS_UNRESOLVED); - } - if(policy == POLICY) { - policy_correct = 1; - } - if(param.sched_priority == PRIORITY) { - priority_correct = 1; - } - - return NULL; -} - -int main() -{ - pthread_attr_t attr; - pthread_t thread_id; - struct sched_param param; - int rc = 0; - - param.sched_priority = PRIORITY; - - rc = pthread_setschedparam(pthread_self(), POLICY, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_setschedparam\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_init(&attr); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setinheritsched\n"); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - - rc = pthread_create(&thread_id, &attr, thread, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_create\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_join(thread_id, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_join\n"); - exit(PTS_UNRESOLVED); - } - - if((priority_correct != 1) || (policy_correct != 1)) { - printf("Test FAIL\n"); - exit(PTS_FAIL); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/3-1.sh deleted file mode 100755 index e3bbc03efa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_setinheritsched returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/4-1.c deleted file mode 100644 index ba733dddb3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/4-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setinheritsched() - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setinheritsched with unsupported inheritsched - * parameter - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "pthread_attr_setinheritsched" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define INVALIDSCHED 999 - -int main() -{ - int rc=0; - pthread_attr_t attr; - - rc = pthread_attr_init(&attr); - if (rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setinheritsched(&attr, INVALIDSCHED); - if ((rc != EINVAL)) { - perror(ERROR_PREFIX "pthread_attr_setinheritsched"); - exit(PTS_FAIL); - } - rc = pthread_attr_destroy(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - printf("Test PASS\n"); - return PTS_PASS; -} - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/assertions.xml deleted file mode 100644 index ebdc46ec5d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/assertions.xml +++ /dev/null @@ -1,27 +0,0 @@ - - -pthread_attr_setinheritsched shall set the inheritsched attribute in the attr argument. - - -When pthread_create uses the attributes objects, the inheritsched attribute determines how the other scheduling attributes of the created thread shall be set. -PTHREAD_INHERIT_SCHED - specifies that the thread scheduling attributes shall be inherited from the creating thread, and the scheduling attributes in this attr argument shall be ignored. -PTHREAD_EXPLICIT_SCHED - specifies that the thread scheduling attributes shall be set to the corresponding values from this attributes object. -The schedpolicy, schedparam, cotentionscope are affected by the inherisched attribute. - - -If successful, pthread_attr_setinheritsched functions return zero. - - -If fail, an error number shall be returned to indicate the error. -[EINVAL] The value of inheritsched is not valid. - - -If fail, an error number shall be returned to indicate the error. -[ENOTSUP] An attempt was made to set the attribute to an unsupported value. - - -Shall not return an error code of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/coverage.txt deleted file mode 100644 index d07d5ebd14..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setinheritsched/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_attr_setinheritsched function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 NO Incorrect test -- What's the unsupported value? -6 Won't test - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-1.c deleted file mode 100644 index ca0b60edab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-1.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * pthread_attr_setschedparam() - - * 1. Create a pthread_attr object and initialize it - * 2. Set the policy and priority in that object - * 3. Create a thread with this object - * Test SCHED_FIFO - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_setschedparam" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define FIFOPOLICY SCHED_FIFO - -volatile int thread_created = 0; - -void *thread_func() -{ - thread_created = 1; - pthread_exit(0); - return (void*)(0); -} - -int main() -{ - pthread_t thread; - pthread_attr_t attr; - void *status; - int rc=0; - int policy = FIFOPOLICY; - struct sched_param param; - int priority; - - rc = pthread_attr_init(&attr); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setschedpolicy(&attr, policy); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy\n"); - exit(PTS_FAIL); - } - - priority = sched_get_priority_max(policy); - if(priority == -1) { - printf(ERROR_PREFIX "sched_priority_get_max\n"); - exit(PTS_FAIL); - } - param.sched_priority = priority; - rc = pthread_attr_setschedparam(&attr, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedparam\n"); - exit(PTS_FAIL); - } - - rc = pthread_create(&thread, &attr, thread_func, NULL); - if(rc != 0) { - if (rc == EPERM) { - printf(ERROR_PREFIX "Permission Denied when creating thread with policy %d\n", policy); - exit(PTS_UNRESOLVED); - } else { - printf(ERROR_PREFIX "pthread_create()\n"); - exit(PTS_FAIL); - } - } - - pthread_join(thread, &status); - pthread_attr_destroy(&attr); - - if(thread_created == 0 ) { - printf(ERROR_PREFIX "Thread was not created\n"); - exit(PTS_FAIL); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-2.c deleted file mode 100644 index 7875c81de5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-2.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * pthread_attr_setschedparam() - - * 1. Create a pthread_attr object and initialize it - * 2. Set the policy and priority in that object - * 3. Create a thread with this object - - * Test SCHED_RR - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-2" -#define FUNCTION "pthread_attr_setschedparam" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define RRPOLICY SCHED_RR - -volatile int thread_created = 0; - -void *thread_func() -{ - thread_created = 1; - pthread_exit(0); - return (void*)(0); -} - -int main() -{ - pthread_t thread; - pthread_attr_t attr; - void *status; - int rc=0; - int policy = RRPOLICY; - struct sched_param param; - int priority; - - rc = pthread_attr_init(&attr); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setschedpolicy(&attr, policy); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy\n"); - exit(PTS_FAIL); - } - - priority = sched_get_priority_max(policy); - if(priority == -1) { - printf(ERROR_PREFIX "sched_priority_get_max\n"); - exit(PTS_FAIL); - } - - param.sched_priority = priority; - rc = pthread_attr_setschedparam(&attr, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedparam\n"); - exit(PTS_FAIL); - } - - rc = pthread_create(&thread, &attr, thread_func, NULL); - if(rc != 0) { - if (rc == EPERM) { - printf(ERROR_PREFIX "Permission Denied when creating thread with policy %d\n", policy); - exit(PTS_UNRESOLVED); - } else { - printf(ERROR_PREFIX "pthread_create()\n"); - exit(PTS_FAIL); - } - } - - pthread_join(thread, &status); - pthread_attr_destroy(&attr); - - if(thread_created == 0) { - printf(ERROR_PREFIX "Thread was not created\n"); - exit(PTS_FAIL); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-3.c deleted file mode 100755 index 1d534590b8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-3.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_create(pthread_attr) - * shall create a thread with the pthread_attr settings passed to it - - * Steps: - * 1. Create a pthread_attr structure and set policy and priority in it - * 2. Create a thread using this attr - * 3. In the thread, check these settings. - - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-1" -#define AREA "scheduler" -#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": " - -#define PRIORITY 20 -#define POLICY SCHED_FIFO - -/* the thread uses this to indicate to main or success */ -int policy_correct = -1; -/* the thread uses this to indicate to main or success */ -int priority_correct = -1; - - -/* Thread function which checks the scheduler settings for itself */ -void * thread(void *tmp) -{ - struct sched_param param; - int policy; - if(pthread_getschedparam(pthread_self(), &policy, ¶m) != 0) { - printf(ERROR_PREFIX "pthread_getschedparam\n"); - exit(PTS_UNRESOLVED); - } - if(policy == POLICY) { - policy_correct = 1; - } - if(param.sched_priority == PRIORITY) { - priority_correct = 1; - } - return NULL; -} - -int main() -{ - pthread_t thread_id; - pthread_attr_t attr; - struct sched_param param; - int rc = 0; - - /* initialze the attribute and set policy and priority in it*/ - rc = pthread_attr_init(&attr); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - rc = pthread_attr_setschedpolicy(&attr, POLICY); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy\n"); - exit(PTS_UNRESOLVED); - } - param.sched_priority = PRIORITY; - rc = pthread_attr_setschedparam(&attr, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedparam\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setinheritsched\n"); - exit(PTS_UNRESOLVED); - } - - /* Create the thread with the attr */ - rc = pthread_create(&thread_id, &attr, thread, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_create\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_join(thread_id, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_join\n"); - exit(PTS_UNRESOLVED); - } - - /* test the result */ - if(priority_correct != 1) { - printf("Test FAILED. Priority set incorrectly\n"); - exit(PTS_FAIL); - } - if(policy_correct != 1) { - printf("Test FAILED. Policy set incorrectly\n"); - exit(PTS_FAIL); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-4.c deleted file mode 100755 index c03e35c184..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/1-4.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_create(pthread_attr) - * shall create a thread with the pthread_attr settings passed to it - * - * Steps: - * 1. Create a pthread_attr structure and set policy and priority in it - * 2. Create a thread using this attr - * 3. In the thread, check these settings. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-2" -#define AREA "scheduler" -#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": " - -#define PRIORITY 20 -#define POLICY SCHED_RR - -/* the thread uses this to indicate to main or success */ -int policy_correct = -1; -/* the thread uses this to indicate to main or success */ -int priority_correct = -1; - - -/* Thread function which checks the scheduler settings for itself */ -void * thread(void *tmp) -{ - struct sched_param param; - int policy; - int rc = 0; - - rc = pthread_getschedparam(pthread_self(), &policy, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_getschedparam\n"); - exit(PTS_UNRESOLVED); - } - if(policy == POLICY) { - policy_correct = 1; - } - if(param.sched_priority == PRIORITY) { - priority_correct = 1; - } - return NULL; -} - -int main() -{ - pthread_t thread_id; - pthread_attr_t attr; - struct sched_param param; - int rc = 0; - - /* Initialze the attribute struct and set policy and priority in it*/ - rc = pthread_attr_init(&attr); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - rc = pthread_attr_setschedpolicy( &attr, POLICY); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy\n"); - exit(PTS_UNRESOLVED); - } - param.sched_priority = PRIORITY; - rc = pthread_attr_setschedparam(&attr, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedparam\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setinheritsched\n"); - exit(PTS_UNRESOLVED); - } - - - /* Create the thread with the attr */ - rc = pthread_create(&thread_id, &attr, thread, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_create\n"); - exit(PTS_UNRESOLVED); - } - - /* Wait for that thread to finish */ - rc = pthread_join(thread_id, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_join\nn"); - exit(PTS_PASS); - } - - /* test the result */ - if(priority_correct != 1) { - printf("Test FAILED. Priority set incorrectly\n"); - exit(PTS_FAIL); - } - if(policy_correct != 1) { - printf("Test FAILED. Policy set incorrectly\n"); - exit(PTS_FAIL); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/2-1.sh deleted file mode 100755 index d59723953c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, QUALCOMM Inc. All rights reserved. -# Created by: abisain REMOVE-THIS AT qualcomm DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_setschedparam returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/assertions.xml deleted file mode 100644 index dd73620e60..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/assertions.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - The function - - int pthread_attr_setschedparam(pthread_attr_t *restrict attr, - contst struct sched_param *restrict param); - - sets the scheduling parameter attributes in the 'attr' argument. - The contents of the 'param' structure are defined in sched.h. - For the SCHED_FIFO and SCHED_RR policies, the only required member of - 'param' is 'sched_priority'. - - - If success, it returns 0; - - - It may return an error number of: - - -[EINVAL] The value of 'param' is invalid - -[ENOTSUP] An attempt to set the attribute to an unsupported value - - The function will not return [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/coverage.txt deleted file mode 100644 index e5cb033e30..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/coverage.txt +++ /dev/null @@ -1,10 +0,0 @@ -This document defines the coverage for the pthread_attr_setschedparam function: - -Assertion Tested? -1 YES -2 YES -3 YES ** Keeping in mind it 'may' fail and not 'shall' fail, - so it will always return PASS, but will return a - PASS and print out a warning if it fails. - ** EINTR NOT tested -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-1.c deleted file mode 100644 index facdf393b8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * pthread_attr_setschedparam() - - * 1. Create a pthread_attr object and initialize it - * 2. Set the policy and an invalid priority in that object - - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-1" -#define FUNCTION "pthread_attr_setschedparam" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define FIFOPOLICY SCHED_FIFO -#define PRIORITY_OFFSET 1000 - -int main() -{ - pthread_attr_t attr; - int rc=0; - int policy = FIFOPOLICY; - struct sched_param param; - int priority; - - rc = pthread_attr_init(&attr); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setschedpolicy(&attr, policy); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy\n"); - exit(PTS_FAIL); - } - - priority = sched_get_priority_max(policy); - if(priority == -1) { - printf(ERROR_PREFIX "sched_priority_get_max\n"); - exit(PTS_FAIL); - } - - param.sched_priority = priority + PRIORITY_OFFSET; - rc = pthread_attr_setschedparam(&attr, ¶m); - if((rc != EINVAL) && (rc != ENOTSUP)) { - printf(ERROR_PREFIX "pthread_attr_setschedparam did not fail\n"); - exit(PTS_FAIL); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-2.c deleted file mode 100644 index 500ec99c3e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-2.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * pthread_attr_setschedparam() - - * 1. Create a pthread_attr object and initialize it - * 2. Set the policy and an invalid priority in that object - - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-2" -#define FUNCTION "pthread_attr_setschedpaarm" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define RRPOLICY SCHED_RR -#define PRIORITY_OFFSET 1000 - -int main() -{ - pthread_attr_t attr; - int rc=0; - int policy = RRPOLICY; - struct sched_param param; - int priority; - - rc = pthread_attr_init(&attr); - if(rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setschedpolicy(&attr, policy); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_attr_setschedpolicy"); - exit(PTS_FAIL); - } - - priority = sched_get_priority_max(policy); - if(priority == -1) { - perror(ERROR_PREFIX "sched_priority_get_max"); - exit(PTS_FAIL); - } - - param.sched_priority = priority + PRIORITY_OFFSET; - rc = pthread_attr_setschedparam(&attr, ¶m); - if((rc != EINVAL) && (rc != ENOTSUP)) { - printf(ERROR_PREFIX "pthread_attr_setschedparam did not fail\n"); - exit(PTS_FAIL); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/1-1.c deleted file mode 100644 index efd9f0a99c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/1-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * This test case initializes an attr and sets its schedpolicy, - * then create a thread with the attr. - - */ - -#include -#include -#include -#include "posixtest.h" - -void *thread_func() -{ - pthread_exit(0); - return (void*)(0); -} - -int main() -{ - pthread_t thread; - pthread_attr_t attr; - void *status; - int rc; - int policy = SCHED_FIFO; - - if(pthread_attr_init(&attr) != 0) { - printf("Error on pthread_attr_init()\n"); - return PTS_UNRESOLVED; - } - - if((rc=pthread_attr_setschedpolicy(&attr,policy)) != 0) { - printf("Error on pthread_attr_setschedpolicy()\t rc=%d\n", rc); - return PTS_FAIL; - } - - if((rc=pthread_create(&thread,&attr,thread_func,NULL)) != 0) { - if (rc == EPERM) { - printf("Permission Denied when creating thread with policy %d\n", policy); - return PTS_UNRESOLVED; - } else { - printf("Error on pthread_create()\t rc=%d\n", rc); - return PTS_FAIL; - } - } - - pthread_join(thread, &status); - pthread_attr_destroy(&attr); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/3-1.sh deleted file mode 100755 index 692f48779a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_setschedpolicy returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/4-1.c deleted file mode 100644 index 7a6501d7f8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/4-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setschedpolicy() - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setschedpolicy with invalid policy - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "pthread_attr_setschedpolicy" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define INVALIDPOLICY 999 - -int main() -{ - int rc=0; - pthread_attr_t attr; - - rc = pthread_attr_init(&attr); - if (rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setschedpolicy(&attr, INVALIDPOLICY); - if ((rc != EINVAL)) { - printf(ERROR_PREFIX "pthread_attr_setinheritsched\n"); - exit(PTS_FAIL); - } - rc = pthread_attr_destroy(&attr); - if( rc != 0) { - printf(ERROR_PREFIX "pthread_attr_destroy\n"); - exit(PTS_UNRESOLVED); - } - printf("Test PASS\n"); - return PTS_PASS; -} - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/assertions.xml deleted file mode 100644 index 26341387c4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/assertions.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - The function - int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy); - - sets the schedpolicy attribute in the 'attr' argument. - - - - The supported values of 'policy' include SCHED_FIFO, SCHED_RR, - and SCHED_OTHER. When threads executing with the scheduling policy - are waiting on a mutex, they shall acquire the mutex in priority order - when the mutex is unlocked. - - - - If success, it returns zero. - - - - if fail, an error number shall be returned to indicate the error. - The pthread_attr_setschedpolicy() function may fail if: - [EINVAL] The value of policy is invalid. - - - - [ENOTSUP] An attempt to set the attribute to an unsupported value. - - - - Shall not return an error code of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/coverage.txt deleted file mode 100644 index 052fc837f2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_attr_setschedpolicy function: - -Assertion Tested? -1 YES -2 NO -3 YES -4 YES -5 Incorrect test -- What's the unsupported value? -6 won't test - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/speculative/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/speculative/5-1.c deleted file mode 100644 index 2782828e96..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setschedpolicy/speculative/5-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setschedpolicy() - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setschedpolicy with unsupported policy - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-1" -#define FUNCTION "pthread_attr_setschedpolicy" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define UNSUPPOLICY -1 - -int main() -{ - int rc=0; - pthread_attr_t attr; - - rc = pthread_attr_init(&attr); - if (rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setschedpolicy(&attr, UNSUPPOLICY); - if ((rc != ENOTSUP)) { - printf(ERROR_PREFIX "pthread_attr_setinheritsched\n"); - exit(PTS_UNRESOLVED); - } - rc = pthread_attr_destroy(&attr); - if( rc != 0) { - printf(ERROR_PREFIX "pthread_attr_destroy\n"); - exit(PTS_UNRESOLVED); - } - printf("Test PASS\n"); - return PTS_PASS; -} - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/1-1.c deleted file mode 100644 index faede65264..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/1-1.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setscope() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. sets the contentionscope to attr - * 3. create a thread with the attr - * 4. Get the contentionscope value in the created thread - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_setscope" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define CONSCOPE PTHREAD_SCOPE_SYSTEM - -void *thread_func() -{ - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - pthread_attr_t attr; - int cscope; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setscope(&attr, CONSCOPE); - if (rc != 0 ) { - perror(ERROR_PREFIX "PTHREAD_SCOPE_SYSTEM is not supported"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_create(&new_th, &attr, thread_func, NULL); - if (rc !=0 ) { - perror(ERROR_PREFIX "pthread_create"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_getscope(&attr, &cscope); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_getscope"); - exit(PTS_UNRESOLVED); - } - - if (cscope != CONSCOPE) { - fprintf(stderr, ERROR_PREFIX "The contentionscope is not " - "correct \n"); - exit(PTS_FAIL); - } - - rc = pthread_join(new_th, NULL); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_join"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/3-1.sh deleted file mode 100755 index ade19e90b0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_setscope returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/4-1.c deleted file mode 100644 index 785bcb1ea4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/4-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setscope() - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setscope with unsupported scope - * parameter - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "pthread_attr_setscope" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define INVALIDSCOPE 999 - -int main() -{ - int rc=0; - pthread_attr_t attr; - - rc = pthread_attr_init(&attr); - if (rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setscope(&attr, INVALIDSCOPE); - if ((rc != EINVAL)) { - perror(ERROR_PREFIX "pthread_attr_setscope"); - exit(PTS_FAIL); - } - rc = pthread_attr_destroy(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - printf("Test PASS\n"); - return PTS_PASS; -} - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/5-1.c deleted file mode 100644 index 62a49ac7cf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/5-1.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setscope() - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Call pthread_attr_setscope with unsupported scope - * parameter - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-1" -#define FUNCTION "pthread_attr_setscope" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -/* What is the unsupported value of scope paramter? */ -#define UNSUPSCOPE -1 - -int main() -{ - if (1) { - printf("Untested for now, cannot find a unsupported inheritsched value\n"); - return PTS_UNTESTED; - } - int rc=0; - pthread_attr_t attr; - - rc = pthread_attr_init(&attr); - if (rc != 0) { - printf(ERROR_PREFIX "pthread_attr_init\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setscope(&attr, UNSUPSCOPE); - if ((rc != ENOTSUP)) { - printf(ERROR_PREFIX "pthread_attr_setscope\n"); - exit(PTS_UNRESOLVED); - } - rc = pthread_attr_destroy(&attr); - if( rc != 0) { - printf(ERROR_PREFIX "pthread_attr_destroy\n"); - exit(PTS_UNRESOLVED); - } - printf("Test PASS\n"); - return PTS_PASS; -} - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/assertions.xml deleted file mode 100644 index 2354e04b88..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/assertions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - -pthread_attr_setscope shall set the contentionscope attribute in the attr object. - - -The contentionscope attribute may have the values PTHREAD_SCOPE_SYSTEM, signifying system scheduling contention scope, or PTHREAD_SCOPE_PROCESS, signifying process scheduling contention scope. - - -If successful, pthread_attr_setscope functions return zero. - - -If fail, an error number shall be returned to indicate the error. -[EINVAL] The value of contentionscope is not valid. - - -If fail, an error number shall be returned to indicate the error. -[ENOTSUP] An attempt was made to set the attribute to an unsupported value. - - -Shall not return an error code of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/coverage.txt deleted file mode 100644 index deb46cf507..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setscope/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_attr_setscope function: - -Assertion Tested? -1 YES -2 NO -3 YES -4 YES -5 NO. Incorrect test -- What's the unsupported value? -6 Won't test - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/1-1.c deleted file mode 100644 index 5d3a88b4bd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/1-1.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setstack() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. set the stackaddr and stacksize to attr - * 3. create a thread with the attr - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_setstack" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define STACKADDROFFSET 0x8000000 - -static void *stack_addr; -size_t stack_size; - -void *thread_func() -{ - pthread_exit(0); - return NULL; -} -int main() -{ - pthread_t new_th; - pthread_attr_t attr; - size_t ssize; - void *saddr; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - /* Get the default stack_addr and stack_size value */ - rc = pthread_attr_getstack(&attr, &stack_addr, &stack_size); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_getstack"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ - - stack_size = PTHREAD_STACK_MIN; - - if (posix_memalign (&stack_addr, sysconf(_SC_PAGE_SIZE), - stack_size) != 0) - { - perror (ERROR_PREFIX "out of memory while " - "allocating the stack memory"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size);*/ - - rc = pthread_attr_setstack(&attr, stack_addr, stack_size); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_setstack"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_getstack(&attr, &saddr, &ssize); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_getstack"); - exit(PTS_UNRESOLVED); - } - /* printf("saddr = %p, ssize = %u\n", saddr, ssize); */ - - rc = pthread_create(&new_th, &attr, thread_func, NULL); - if (rc !=0 ) { - perror(ERROR_PREFIX "failed to create a thread"); - exit(PTS_FAIL); - } - - rc = pthread_join(new_th, NULL); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_join"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/2-1.c deleted file mode 100644 index f9ddc16bc2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/2-1.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setstack() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. set the stackaddr and stacksize to attr - * 3. create a thread with the attr - * 4. In the created thread, read the stacksize and stackaddr - * - * NOTE: pthread_getattr_np is not a POSIX compliant API. It is - * provided by nptl, which is developed by Ulrich Drepper. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "pthread_attr_setstack" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -static void *stack_addr; -size_t stack_size; - -void *thread_func() -{ - pthread_attr_t attr; - void *saddr; - size_t ssize; - int rc; - - /* pthread_getattr_np is not POSIX Compliant API*/ - rc = pthread_getattr_np(pthread_self(), &attr); - if (rc != 0) - { - perror(ERROR_PREFIX "pthread_getattr_np"); - exit(PTS_UNRESOLVED); - } - - pthread_attr_getstack(&attr, &saddr, &ssize); - if (ssize != stack_size || saddr != stack_addr) - { - perror(ERROR_PREFIX "got the wrong stacksize or stackaddr"); - exit(PTS_FAIL); - } - /* printf("saddr = %p, ssize = %u\n", saddr, ssize); */ - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - pthread_attr_t attr; - size_t ssize; - void *saddr; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - /* Get the default stack_addr and stack_size value */ - rc = pthread_attr_getstack(&attr, &stack_addr, &stack_size); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_getstack"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ - - stack_size = PTHREAD_STACK_MIN; - - if (posix_memalign (&stack_addr, sysconf(_SC_PAGE_SIZE), - stack_size) != 0) - { - perror (ERROR_PREFIX "out of memory while " - "allocating the stack memory"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ - - rc = pthread_attr_setstack(&attr, stack_addr, stack_size); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_setstack"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_getstack(&attr, &saddr, &ssize); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_getstack"); - exit(PTS_UNRESOLVED); - } - /* printf("saddr = %p, ssize = %u\n", saddr, ssize); */ - - rc = pthread_create(&new_th, &attr, thread_func, NULL); - if (rc !=0 ) { - perror(ERROR_PREFIX "failed to create a thread"); - exit(PTS_FAIL); - } - - rc = pthread_join(new_th, NULL); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_join"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/3-1.sh deleted file mode 100755 index a680acc14d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_setstack returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/4-1.c deleted file mode 100644 index c04e1b6850..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/4-1.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setstack() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. set the stackaddr and stacksize to attr - * 3. create a thread with the attr - * 4. Call a function in the created thread, - * which can be treated as reading and writing the stack - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "pthread_attr_setstack" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define STACKADDROFFSET 0x8000000 - -static void *stack_addr; -size_t stack_size; - -int teststack() { - return 0; -} -void *thread_func() -{ - /* execute a function to test the read/right of the stack*/ - if (teststack() != 0) { - perror(ERROR_PREFIX "stack wrong"); - exit(PTS_FAIL); - } - pthread_exit(0); - return NULL; -} -int main() -{ - pthread_t new_th; - pthread_attr_t attr; - size_t ssize; - void *saddr; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - /* Get the default stack_addr and stack_size value */ - rc = pthread_attr_getstack(&attr, &stack_addr, &stack_size); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_getstack"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ - - stack_size = PTHREAD_STACK_MIN; - - if (posix_memalign (&stack_addr, sysconf(_SC_PAGE_SIZE), - stack_size) != 0) - { - perror (ERROR_PREFIX "out of memory while " - "allocating the stack memory"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ - - rc = pthread_attr_setstack(&attr, stack_addr, stack_size); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_setstack"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_getstack(&attr, &saddr, &ssize); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_getstack"); - exit(PTS_UNRESOLVED); - } - /* printf("saddr = %p, ssize = %u\n", saddr, ssize); */ - - if (ssize != stack_size || saddr != stack_addr) - { - perror(ERROR_PREFIX "got the wrong stacksize or stackaddr"); - exit(PTS_FAIL); - } - - rc = pthread_create(&new_th, &attr, thread_func, NULL); - if (rc !=0 ) { - perror(ERROR_PREFIX "failed to create a thread"); - exit(PTS_FAIL); - } - - rc = pthread_join(new_th, NULL); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_join"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/5-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/5-1.sh deleted file mode 100755 index a680acc14d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/5-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_setstack returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/6-1.c deleted file mode 100644 index a0da7747e4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/6-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setstack() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. set the stacksize less tha PTHREAD_STACK_MIN - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "6-1" -#define FUNCTION "pthread_attr_setstack" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define STACKSIZE PTHREAD_STACK_MIN - sysconf(_SC_PAGE_SIZE) - -static void *stack_addr; -size_t stack_size; - -void *thread_func() -{ - pthread_exit(0); - return NULL; -} -int main() -{ - pthread_attr_t attr; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - /* Get the default stack_addr and stack_size value */ - rc = pthread_attr_getstack(&attr, &stack_addr, &stack_size); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_getstack"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ - - stack_size = STACKSIZE; - - if (posix_memalign (&stack_addr, sysconf(_SC_PAGE_SIZE), - stack_size) != 0) - { - perror (ERROR_PREFIX "out of memory while " - "allocating the stack memory"); - exit(PTS_UNRESOLVED); - } - - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ - rc = pthread_attr_setstack(&attr, stack_addr, stack_size); - if (rc != EINVAL ) { - perror(ERROR_PREFIX "Got the wrong return value"); - exit(PTS_FAIL); - } - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/7-1.c deleted file mode 100644 index c5fd04f1a7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/7-1.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setstack() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. Make the stackaddr not be aligned to be used as a stack - * 3. Make stackaddr+stacksize to be lack of alignment - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "7-1" -#define FUNCTION "pthread_attr_setstack" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define OFFSET 0x7 - -static void *stack_addr; -size_t stack_size; - -void *thread_func() -{ - pthread_exit(0); - return NULL; -} -int main() -{ - pthread_attr_t attr; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - /* Get the default stack_addr and stack_size value */ - rc = pthread_attr_getstack(&attr, &stack_addr, &stack_size); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_getstack"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ - - stack_size = PTHREAD_STACK_MIN; - - if (posix_memalign (&stack_addr, sysconf(_SC_PAGE_SIZE), - stack_size) != 0) - { - perror (ERROR_PREFIX "out of memory while " - "allocating the stack memory"); - exit(PTS_UNRESOLVED); - } - - stack_addr = stack_addr + OFFSET; - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ - rc = pthread_attr_setstack(&attr, stack_addr, stack_size); - if (rc != EINVAL ) { - printf("The function didn't fail when stackaddr " - "lacks proper alignment\n"); - } - - stack_addr = stack_addr + OFFSET; - stack_size = PTHREAD_STACK_MIN + OFFSET; - /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ - rc = pthread_attr_setstack(&attr, stack_addr, stack_size); - if (rc != EINVAL ) { - printf("The function didn't fail when (stackaddr + stacksize) " - "lacks proper alignment\n"); - } - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/assertions.xml deleted file mode 100644 index fb7fd58ca5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/assertions.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - The pthread_attr_setstack() shall set the thread creation stack attributes - stackaddr and stacksize in the attr ojbect. - The stack attributes specify the area of storage to be used for the created - thread's stack. - - - - The stack attributes specify the area of storage to be used for the created - thread's stack. - - - - The base of the storage shall be stackaddr, and the size of the storage - shall be stacksize bytes. The stacksize shall be at least - {PTHREAD_STACK_MIN}. The stackaddr shall be aligned appropriately to be - used as a stack. - - - - All pages within the stack described by stackaddr and stacksize shall be - both readable and writable by the thread. - - - - If success, it returns zero. - - - - if fail, an error number shall be returned to indicate the error. - The pthread_attr_setstack() function shall fail if: - [EINVAL] The value of stacksize is less than {PTHREAD_STACK_MIN} - or exceeds an implementation-defined limit. - - - - The function may fail if: - [EINVAL] The value of stackaddr does not have proper alignment to - be used as a stack or if (stackaddr + stacksize) lacks proper alignment. - - - - The function may fail if: - [EACCES] The stack page(s) described by stackaddr and stacksize are not - both readable and writable by the thread. - - - - Shall not return an error code of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/coverage.txt deleted file mode 100644 index 3c82b2e00e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstack/coverage.txt +++ /dev/null @@ -1,15 +0,0 @@ -This document defines the coverage for the pthread_attr_setstack function: - -Assertion Tested? -1 YES -2 YES (The test uses a Non-POSIX-Compliant API - pthread_getattr_np to get attr in a created thread) -3 YES -4 YES -5 YES -6 YES -7 YES -8 NO -9 won't test - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstackaddr/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstackaddr/assertions.xml deleted file mode 100644 index 5bcbaa1af3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstackaddr/assertions.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstackaddr/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstackaddr/coverage.txt deleted file mode 100644 index 600dd93010..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstackaddr/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_attr_setstackaddr function: - -Assertion Tested? -1 YES -2 YES (The test uses a Non-POSIX-Compliant API - pthread_getattr_np to get attr in a created thread) -3 YES -4 won't test - -Note: pthread_attr_setstackaddr is marked with __attribute_deprecated__ - in glibc implementation, it will got compile warning. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/1-1.c deleted file mode 100644 index e41546af1d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/1-1.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setstacksizesize() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. set stacksize to attr - * 3. create a thread with the attr - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_attr_setstacksize" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define STACKADDROFFSET 0x8000000 - -void *thread_func() -{ - pthread_exit(0); - return NULL; -} -int main() -{ - pthread_t new_th; - pthread_attr_t attr; - size_t stack_size = PTHREAD_STACK_MIN; - size_t ssize; - void *saddr; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - /* printf("stack_size = %lu\n", stack_size); */ - - if (posix_memalign (&saddr, sysconf(_SC_PAGE_SIZE), - stack_size) != 0) - { - perror (ERROR_PREFIX "out of memory while " - "allocating the stack memory"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setstacksize(&attr, stack_size); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_setstacksize"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_getstacksize(&attr, &ssize); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_getstacksize"); - exit(PTS_UNRESOLVED); - } - /* printf("stack_size = %lu\n", ssize); */ - - rc = pthread_create(&new_th, &attr, thread_func, NULL); - if (rc !=0 ) { - perror(ERROR_PREFIX "failed to create a thread"); - exit(PTS_FAIL); - } - - rc = pthread_join(new_th, NULL); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_join"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c deleted file mode 100644 index 8cd3ec3bc0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setstacksize() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. set stacksize to attr - * 3. create a thread with the attr - * 4. In the created thread, read stackaddr - * - * NOTE: pthread_getattr_np is not a POSIX compliant API. It is - * provided by nptl, which is developed by Ulrich Drepper. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "pthread_attr_setstacksize" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -size_t stack_size; - -void *thread_func() -{ - pthread_attr_t attr; - size_t ssize; - int rc; - - /* pthread_getattr_np is not POSIX Compliant API*/ - rc = pthread_getattr_np(pthread_self(), &attr); - if (rc != 0) - { - perror(ERROR_PREFIX "pthread_getattr_np"); - exit(PTS_UNRESOLVED); - } - - pthread_attr_getstacksize(&attr, &ssize); - if (ssize != stack_size) - { - perror(ERROR_PREFIX "got the wrong stacksize or stackaddr"); - exit(PTS_FAIL); - } - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - pthread_attr_t attr; - size_t ssize; - void *saddr; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - stack_size = PTHREAD_STACK_MIN; - - if (posix_memalign (&saddr, sysconf(_SC_PAGE_SIZE), - stack_size) != 0) - { - perror (ERROR_PREFIX "out of memory while " - "allocating the stack memory"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setstacksize(&attr, stack_size); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_setstacksize"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_getstacksize(&attr, &ssize); - if (rc != 0 ) { - perror(ERROR_PREFIX "pthread_attr_getstacksize"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_create(&new_th, &attr, thread_func, NULL); - if (rc !=0 ) { - perror(ERROR_PREFIX "failed to create a thread"); - exit(PTS_FAIL); - } - - rc = pthread_join(new_th, NULL); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_join"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/3-1.sh deleted file mode 100755 index a680acc14d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_attr_setstack returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c deleted file mode 100644 index 6336b50f6b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_attr_setstacksize() - * - * Steps: - * 1. Initialize pthread_attr_t object (attr) - * 2. set the stacksize less tha PTHREAD_STACK_MIN - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "pthread_attr_setstacksize" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define STACKSIZE PTHREAD_STACK_MIN - sysconf(_SC_PAGE_SIZE) - -void *thread_func() -{ - pthread_exit(0); - return NULL; -} -int main() -{ - pthread_attr_t attr; - void *saddr; - size_t stack_size; - int rc; - - /* Initialize attr */ - rc = pthread_attr_init(&attr); - if( rc != 0) { - perror(ERROR_PREFIX "pthread_attr_init"); - exit(PTS_UNRESOLVED); - } - - stack_size = STACKSIZE; - - if (posix_memalign (&saddr, sysconf(_SC_PAGE_SIZE), - stack_size) != 0) - { - perror (ERROR_PREFIX "out of memory while " - "allocating the stack memory"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_attr_setstacksize(&attr, stack_size); - if (rc != EINVAL ) { - perror(ERROR_PREFIX "Got the wrong return value"); - exit(PTS_FAIL); - } - - rc = pthread_attr_destroy(&attr); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_attr_destroy"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/assertions.xml deleted file mode 100644 index 7c0ba9edd1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/assertions.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - The pthread_attr_setstack() shall set the thread creation stack - stacksize in the attr ojbect. - - - - The stacksize attribute shall define the minimum stack size (in bytes) - allocated for the created thread stack. - - - - If success, it returns zero and stores the stacksize attribute in - the stacksize if successful. - - - - if fail, an error number shall be returned to indicate the error. - The pthread_attr_setstacksize() function shall fail if: - [EINVAL] The value of stacksize is less than {PTHREAD_STACK_MIN} - or exceeds an implementation-defined limit. - - - - Shall not return an error code of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/coverage.txt deleted file mode 100644 index 0bf1c77235..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_setstacksize/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_attr_setstacksize function: - -Assertion Tested? -1 YES -2 YES (The test uses a Non-POSIX-Compliant API - pthread_getattr_np to get attr in a created thread) -3 YES -4 YES -5 won't test - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/1-1.c deleted file mode 100644 index 658b25b2b7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/1-1.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrier_destroy() - * - * - * The pthread_barrier_destroy( ) function shall destroy the barrier - * referenced by barrier and release any resources used by the barrier. - * - * Steps: - * 1. Main initialize barrier with count 2 - * 2. Main destroy the barrier - * 3. Repeat step 1,2 for N times - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_barrier_t barrier; -#define LOOP_NUM 5 - -int main() -{ - int cnt; - int rc; - - for(cnt = 0; cnt < LOOP_NUM; cnt++) - { - if(pthread_barrier_init(&barrier, NULL, 2) != 0) - { - printf("Test FAILED: Error at pthread_barrier_init()\n"); - return PTS_FAIL; - } - - rc = pthread_barrier_destroy(&barrier); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_barrier_destroy() " - " return code: %d, %s\n", rc, strerror(rc)); - return PTS_FAIL; - } - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/2-1.c deleted file mode 100644 index be6c9f22d1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/2-1.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrier_destroy() - * - * The pthread_barrier_destroy( ) function may fail if: - * [EBUSY] The implementation has detected an attempt to destroy a barrier while it is in - * use (for example, while being used in a pthread_barrier_wait( ) call) by another - * thread. - * - * Note: This case will always PASS - * - * Steps: - * 1. Main initialize barrier with count 2 - * 2. Main create a child thread - * 3. Child thread call pthread_barrier_wait(), should block - * 4. Main call pthread_barrier_destroy(), while child is blocking on the barrier - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_barrier_t barrier; -static int thread_state; -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_chld(void *arg) -{ - int rc = 0; - - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - thread_state = ENTERED_THREAD; - - /* Child should block here */ - printf("child: barrier wait\n"); - rc = pthread_barrier_wait(&barrier); - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Error: child: pthread_barrier_wait() get unexpected " - "return code : %d\n" , rc); - exit(PTS_UNRESOLVED); - } - else if(rc == PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("child: get PTHREAD_BARRIER_SERIAL_THREAD\n"); - } - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - int rc; - pthread_t child_thread; - - printf("main: Initialize barrier with count = 2\n"); - if(pthread_barrier_init(&barrier, NULL, 2) != 0) - { - printf("main: Error at pthread_barrier_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: create child thread\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* Expect the child to block*/ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2); - - if(thread_state == EXITING_THREAD) - { - /* child thread did not block */ - printf("Test FAILED: child thread did not block on " - "pthread_barrier_wait()\n"); - exit(PTS_FAIL); - } - else if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: destroy barrier while child is waiting\n"); - - rc = pthread_barrier_destroy(&barrier); - - if(rc == EBUSY) - { - printf("main: correctly got EBUSY\n"); - printf("Test PASSED\n"); - } - else - { - printf("main: got return code: %d, %s\n", rc, strerror(rc)); - printf("Test PASSED: Note*: Expected EBUSY, but standard says 'may' fail.\n"); - } - - /* Cleanup (cancel thread in case it is still blocking */ - pthread_cancel(child_thread); - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/3-1.sh deleted file mode 100755 index 059da4c43b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Upon successful completion, these functions shall return zero; -# otherwise, an error number shall be returned to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/assertions.xml deleted file mode 100644 index f700a13da9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/assertions.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - The pthread_barrier_destroy( ) function shall destroy the barrier referenced by barrier and - release any resources used by the barrier. - - - - The pthread_barrier_destroy( ) function may fail if: - [EBUSY] The implementation has detected an attempt to destroy a barrier while it is in - use (for example, while being used in a pthread_barrier_wait( ) call) by another - thread. - [EINVAL] The value specified by barrier is invalid. - - - - Upon successful completion, these functions shall return zero; otherwise, an error number shall - be returned to indicate the error. - - These functions shall not return an error code of EINTR. - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/coverage.txt deleted file mode 100644 index 858d92b4e1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_destroy/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_barrier_destroy() function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/1-1.c deleted file mode 100644 index e89b002388..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/1-1.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrier_init() - * - * - * The pthread_barrier_init( ) function shall allocate any resources - * required to use the barrier referenced by barrier and shall initialize - * the barrier with attributes referenced by attr. If attr is NULL, - * the default barrier attributes shall be used; - * the effect is the same as passing the address of a default barrier attributes object. - * - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define COUNT 1 - -static pthread_barrier_t barrier; - -int main() -{ - int rc; - pthread_barrierattr_t ba; - - /* Intilized barrier with NULL attribute, check that this can be done. */ - rc = pthread_barrier_init(&barrier, NULL, COUNT); - - if(rc !=0) - { - printf("Test FAILED: Error at pthread_barrier_init() " - "return code %d, %s\n", rc, strerror(rc)); - return PTS_FAIL; - } - - /* Cleanup */ - if(pthread_barrier_destroy(&barrier) != 0) - { - printf("Error at pthread_barrier_destroy() " - " return code: %d, %s\n", rc, strerror(rc)); - return PTS_UNRESOLVED; - } - - /* Initialize a barrier attribute object */ - if(pthread_barrierattr_init(&ba) != 0) - { - printf("Error at pthread_barrierattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Initialize barrier with this barrier attribute object */ - rc = pthread_barrier_init(&barrier, &ba, COUNT); - if(rc != 0) - { - printf("Test FAILED: Error at 2nd pthread_barrier_init() " - "return code %d, %s\n", rc, strerror(rc)); - return PTS_FAIL; - } - - /* Cleanup */ - if(pthread_barrierattr_destroy(&ba) != 0) - { - printf("Error at pthread_barrierattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - - if(pthread_barrier_destroy(&barrier) != 0) - { - printf("Error at pthread_barrier_destroy() " - " return code: %d, %s\n", rc, strerror(rc)); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/2-1.sh deleted file mode 100755 index 059da4c43b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Upon successful completion, these functions shall return zero; -# otherwise, an error number shall be returned to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/3-1.c deleted file mode 100644 index 4e64a34094..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/3-1.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrier_init() - * - * - * The pthread_barrier_init( ) function shall fail if: - * [EINVAL] The value specified by count is equal to zero. - * - */ - -#define COUNT 0 - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - int rc; - pthread_barrier_t barrier; - - /* Intilized barrier with count 0 (it should return EINVAL) */ - - rc = pthread_barrier_init(&barrier, NULL, COUNT); - - if(rc != EINVAL) - { - printf("Test FAILED: pthread_barrier_init() does not return EINVAL when intializing a barrier with count=0," - " return code %d, %s\n", rc, strerror(rc)); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/4-1.c deleted file mode 100644 index 68737e0d7a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/4-1.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrier_init() - * - * The pthread_barrier_init( ) function may fail if: - * [EBUSY] The implementation has detected an attempt to reinitialize a barrier while it is - * in use (for example, while being used in a pthread_barrier_wait( ) call) by - * another thread. - * - * NOTE: This case will always pass. - * - * Steps: - * 1. Main initialize barrier with count 2 - * 2. Main create a child thread - * 3. Child thread call pthread_barrier_wait(), should block - * 4. Main call pthread_barrier_init() - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_barrier_t barrier; -static int thread_state; -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -/* child thread */ -static void* fn_chld(void *arg) -{ - int rc = 0; - - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - thread_state = ENTERED_THREAD; - - printf("thread: barrier wait\n"); - rc = pthread_barrier_wait(&barrier); - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Error: thread: pthread_barrier_wait() got unexpected " - "return code : %d\n" , rc); - exit(PTS_UNRESOLVED); - } - else if(rc == PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("thread: got PTHREAD_BARRIER_SERIAL_THREAD\n"); - } - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -void sig_handler() -{ - printf("Interrupted by SIGALRM\n"); - printf("Test PASSED: main blocked on barrier init\n"); - exit(PTS_PASS); -} - -int main() -{ - int cnt = 0; - int rc; - pthread_t child_thread; - struct sigaction act; - - /* Set up main thread to handle SIGALRM */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - sigfillset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - - printf("main: Initialize barrier with count = 2\n"); - if(pthread_barrier_init(&barrier, NULL, 2) != 0) - { - printf("main: Error at pthread_barrier_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: create child thread\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* Expect the child to block*/ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2); - - - if(thread_state == EXITING_THREAD) - { - /* child thread did not block */ - printf("Test FAILED: child thread did not block on " - "pthread_barrier_wait()\n"); - exit(PTS_FAIL); - } - else if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state\n"); - exit(PTS_UNRESOLVED); - } - - /* Just in case main gets in a blocked state, send me a SIGALRM after 2 secs */ - alarm(2); - - printf("main: reinitilize barrier while thread is blocking on it\n"); - rc = pthread_barrier_init(&barrier, NULL, 2); - - if(rc == EBUSY) - { - printf("main: pthread_barrier_init() correctly got EBUSY"); - printf("Test PASSED\n"); - } - else - { - printf("main: got return code: %d, %s\n", rc, strerror(rc)); - printf("Test PASSED: Note*: Expected EBUSY, but standard says 'may' fail.\n"); - } - - /* Cancel thread in case it is still blocked */ - pthread_cancel(child_thread); - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/assertions.xml deleted file mode 100644 index e315f6f31a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/assertions.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - The pthread_barrier_init( ) function shall allocate any resources required to use the barrier - referenced by barrier and shall initialize the barrier with attributes referenced by attr. If - attr is NULL, the default barrier attributes shall be used; the effect is the same as passing - the address of a default barrier attributes object. - - - - Upon successful completion, these functions shall return zero; otherwise, an error number shall - be returned to indicate the error. - - - - The pthread_barrier_init( ) function shall fail if: - [EAGAIN] The system lacks the necessary resources to initialize another barrier. - [EINVAL] The value specified by count is equal to zero. - [ENOMEM] Insufficient memory exists to initialize the barrier. - - - - The pthread_barrier_init( ) function may fail if: - [EBUSY] The implementation has detected an attempt to reinitialize a barrier while it is - in use (for example, while being used in a pthread_barrier_wait( ) call) by - another thread. - [EINVAL] The value specified by attr is invalid. - - These functions shall not return an error code of [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/coverage.txt deleted file mode 100644 index bd6258018e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_init/coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -This document defines the coverage for the pthread_barrier_init() function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/1-1.c deleted file mode 100644 index 2395580725..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/1-1.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrier_wait() - * - * The pthread_barrier_wait( ) function shall synchronize participating threads - * at the barrier referenced by barrier. The calling thread shall block - * until the required number of threads have called pthread_barrier_wait( ) - * specifying the barrier. - * - * Steps: - * 1. Main initialize barrier with count 2 - * 2. Main create a child thread - * 3. Child thread call pthread_barrier_wait(), should block - * 4. Main call pthread_barrier_wait(), child and main should all return - * from pthread_barrier_wait() - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_barrier_t barrier; -static int thread_state; -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_chld(void *arg) -{ - int rc = 0; - thread_state = ENTERED_THREAD; - - printf("child: barrier wait\n"); - rc = pthread_barrier_wait(&barrier); - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Test FAILED: child: pthread_barrier_wait() got unexpected " - "return code : %d\n" , rc); - exit(PTS_FAIL); - } - else if(rc == PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("child: get PTHREAD_BARRIER_SERIAL_THREAD\n"); - } - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -void sig_handler() -{ - printf("Interrupted by SIGALRM\n"); - printf("Test FAILED: main blocked on barrier wait\n"); - exit(PTS_FAIL); -} - -int main() -{ - int cnt = 0; - int rc; - pthread_t child_thread; - struct sigaction act; - - /* Set up main thread to handle SIGALRM */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - sigfillset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - - printf("Initialize barrier with count = 2\n"); - if(pthread_barrier_init(&barrier, NULL, 2) != 0) - { - printf("main: Error at pthread_barrier_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: create child thread\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* Expect the child to block*/ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2); - - if(thread_state == EXITING_THREAD) - { - /* child thread did not block */ - printf("Test FAILED: child thread did not block on " - "pthread_barrier_wait()\n"); - exit(PTS_FAIL); - } - else if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: call barrier wait\n"); - - /* we should not block here, but just in case we do */ - alarm(2); - - rc = pthread_barrier_wait(&barrier); - - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Test FAILED: main: pthread_barrier_wait() get unexpected " - "return code : %d\n" , rc); - exit(PTS_FAIL); - } - else if(rc == PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("main: got PTHREAD_BARRIER_SERIAL_THREAD\n"); - } - - /* We expected the child returned from barrier wait */ - cnt = 1; - do{ - sleep(1); - }while (thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: child thread still blocked on " - "barrier wait\n"); - return PTS_FAIL; - } - else if(thread_state != EXITING_THREAD) - { - printf("main: Unexpected thread state: %d\n", thread_state); - return PTS_UNRESOLVED; - } - - if(pthread_join(child_thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_barrier_destroy(&barrier) != 0) - { - printf("Error at pthread_barrier_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/2-1.c deleted file mode 100644 index b566ede980..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/2-1.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrier_wait() - * - * When the required number of threads have called pthread_barrier_wait( ) - * specifying the barrier, the constant PTHREAD_BARRIER_SERIAL_THREAD shall - * be returned to one unspecified thread and zero shall be returned - * to each of the remaining threads. At this point, the barrier shall - * be reset to the state it had as a result of the most recent - * pthread_barrier_init( ) function that referenced it. - * - * Steps: - * 1. Main thread do the following for LOOP_NUM times - * 2. In each loop, Main thread initialize barrier, with count set to THREAD_NUM - * 3. Main create THREAD_NUM threads - * 4. Each thread will call pthread_barrier_wait() - * 5. When the last thread calls pthread_barrier_wait, only one thread will - * get PTHREAD_BARRIER_SERIAL_THREAD, all the other threads should get zero - * 6. This holds true for every loop. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 5 -#define LOOP_NUM 3 - -static pthread_barrier_t barrier; -static int serial; -static int normal_rt; - -static void* fn_chld(void *arg) -{ - int rc = 0; - int thread_num = *(int*)arg; - - printf("child[%d]: barrier wait\n", thread_num); - rc = pthread_barrier_wait(&barrier); - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Test FAILED: child[%d]: pthread_barrier_wait() get unexpected " - "return code : %d\n" , thread_num, rc); - exit(PTS_FAIL); - } - else if(rc == PTHREAD_BARRIER_SERIAL_THREAD) - { - serial++; - printf("child[%d]: get PTHREAD_BARRIER_SERIAL_THREAD\n", thread_num); - } - else - { - normal_rt++; - } - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t child_threads[THREAD_NUM]; - int cnt; - int loop; - - printf("Initialize barrier with count = %d\n", THREAD_NUM); - if(pthread_barrier_init(&barrier, NULL, THREAD_NUM) != 0) - { - printf("main: Error at pthread_barrier_init()\n"); - return PTS_UNRESOLVED; - } - - for(loop = 0; loop < LOOP_NUM; loop++) - { - serial = 0; - normal_rt = 0; - printf("\n-Loop %d-\n", loop); - - printf("main: create %d child threads\n", THREAD_NUM); - for(cnt = 0; cnt < THREAD_NUM; cnt++) - { - if(pthread_create(&child_threads[cnt], NULL, fn_chld, &cnt) != 0) - { - printf("main: Error at %dth pthread_create()\n", cnt); - return PTS_UNRESOLVED; - } - - } - printf("main: wait for child threads to end\n"); - for(cnt = 0; cnt < THREAD_NUM; cnt++) - { - if(pthread_join(child_threads[cnt], NULL) != 0) - { - printf("main: Error at %dth pthread_join()\n", cnt); - exit(PTS_UNRESOLVED); - } - } - - if(serial != 1 || (serial + normal_rt) != THREAD_NUM ) - { - printf("Test FAILED: On %d loop, PTHREAD_BARRIER_SERIAL_THREAD " - "should be returned to one unspecified thread\n", loop); - return PTS_FAIL; - } - - } - - if(pthread_barrier_destroy(&barrier) != 0) - { - printf("Error at pthread_barrier_destroy()"); - return PTS_UNRESOLVED; - } - - printf("\nTest PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/3-1.c deleted file mode 100644 index 36e7936e0f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/3-1.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrier_wait() - * - * If a signal is delivered to a thread blocked on a barrier, upon return - * from the signal handler the thread shall resume waiting at the barrier - * if the barrier wait has not completed (that is, if the - * required number of threads have not arrived at the barrier - * during the execution of the signal handler); - * - * Steps: - * 1. Main initialize barrier with count 2 - * 2. Main create a child thread - * 3. Child thread call pthread_barrier_wait(), should block - * 4. While child thread is blocking, send SIGUSR1 to child - * 5. The signal handler did nothing just print a messge - * 6. After return from the signal handler, child should resume blocking - * 7. Main call pthread_barrier_wait(), child and main should all return - * from pthread_barrier_wait() - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_barrier_t barrier; -static int thread_state; -static int sig_rcvd; - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -void sig_handler() -{ - sig_rcvd = 1; - printf("thread: interrupted by SIGUSR1\n"); -} - -static void* fn_chld(void *arg) -{ - int rc = 0; - struct sigaction act; - - thread_state = ENTERED_THREAD; - - /* Set up thread to handle SIGUSR1 */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - sigfillset(&act.sa_mask); - sigaction(SIGUSR1, &act, 0); - - printf("thread: call barrier wait\n"); - rc = pthread_barrier_wait(&barrier); - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Test FAILED: child: pthread_barrier_wait() got unexpected " - "return code : %d\n" , rc); - exit(PTS_FAIL); - } - else if(rc == PTHREAD_BARRIER_SERIAL_THREAD) - printf("thread: get PTHREAD_BARRIER_SERIAL_THREAD\n"); - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - - -int main() -{ - int cnt = 0; - int rc; - pthread_t child_thread; - sig_rcvd = 0; - - printf("Initialize barrier with count = 2\n"); - if(pthread_barrier_init(&barrier, NULL, 2) != 0) - { - printf("main: Error at pthread_barrier_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: create child thread\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* Expect the child to block*/ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2); - - if(thread_state == EXITING_THREAD) - { - /* child thread did not block */ - printf("Test FAILED: child thread did not block on " - "pthread_barrier_wait()\n"); - exit(PTS_FAIL); - } - else if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: send SIGUSR1 to child thread\n"); - if(pthread_kill(child_thread, SIGUSR1) != 0) - { - printf("main: Error at pthread_kill()\n"); - exit(PTS_UNRESOLVED); - } - - /* Expect the child to continue blocking */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2); - - if(sig_rcvd != 1) - { - printf("child did not handle SIGUSR1\n"); - exit(PTS_UNRESOLVED); - } - - if(thread_state == EXITING_THREAD) - { - /* child thread did not block */ - printf("Test FAILED: child thread should still block on " - "pthread_barrier_wait() when interrupted by signal\n"); - exit(PTS_FAIL); - } - else if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - printf("main: thread continued blocking after handling SIGUSR1\n"); - - printf("main: call barrier wait\n"); - rc = pthread_barrier_wait(&barrier); - - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Test FAILED: main: pthread_barrier_wait() got unexpected " - "return code : %d\n" , rc); - exit(PTS_FAIL); - } - else if(rc == PTHREAD_BARRIER_SERIAL_THREAD) - printf("main: get PTHREAD_BARRIER_SERIAL_THREAD\n"); - - /* We expected the child returned from barrier wait */ - cnt = 0; - do{ - sleep(1); - }while (thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: child thread still blocked on " - "barrier wait\n"); - return PTS_FAIL; - } - else if(thread_state != EXITING_THREAD) - { - printf("main: Unexpected thread state: %d\n", thread_state); - return PTS_UNRESOLVED; - } - - if(pthread_join(child_thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_barrier_destroy(&barrier) != 0) - { - printf("Error at pthread_barrier_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/3-2.c deleted file mode 100644 index 599e543597..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/3-2.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrier_wait() - * - * If a signal is delivered to a thread blocked on a barrier.. - * otherwise, the thread shall continue as normal from the completed barrier wait. Until - * the thread in the signal handler returns from it, it is unspecified whether other threads may - * proceed past the barrier once they have all reached it. - * - * Steps: - * 1. Main initialize barrier with count 2 - * 2. Main create a child thread - * 3. Child thread call pthread_barrier_wait(), should block - * 4. While child thread is blocking, send SIGUSR1 to child - * 5. While child thread is in the signal handler, main thread call pthread_barrier_wait() - * 6. After return from the signal handler, the child thread should continue as normal - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_barrier_t barrier; -static int thread_state; -static int sig_rcvd; -static int barrier_waited; - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -void sig_handler() -{ - struct timespec ts; - sig_rcvd = 1; - printf("thread: interrupted by SIGUSR1\n"); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - while(barrier_waited != 1) - { - nanosleep(&ts, NULL); - } -} - -static void* fn_chld(void *arg) -{ - int rc = 0; - struct sigaction act; - - thread_state = ENTERED_THREAD; - - /* Set up thread to handle SIGUSR1 */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - sigfillset(&act.sa_mask); - sigaction(SIGUSR1, &act, 0); - - printf("thread: call barrier wait\n"); - rc = pthread_barrier_wait(&barrier); - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Test FAILED: child: pthread_barrier_wait() got unexpected " - "return code : %d\n" , rc); - exit(PTS_FAIL); - } - else if(rc == PTHREAD_BARRIER_SERIAL_THREAD) - printf("thread: got PTHREAD_BARRIER_SERIAL_THREAD\n"); - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - - -int main() -{ - int cnt = 0; - int rc; - pthread_t child_thread; - sig_rcvd = 0; - barrier_waited = 0; - - printf("Initialize barrier with count = 2\n"); - if(pthread_barrier_init(&barrier, NULL, 2) != 0) - { - printf("main: Error at pthread_barrier_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: create child thread\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* Expect the child to block*/ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2); - - if(thread_state == EXITING_THREAD) - { - /* child thread did not block */ - printf("Test FAILED: child thread did not block on " - "pthread_barrier_wait()\n"); - exit(PTS_FAIL); - } - else if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: send SIGUSR1 to child thread\n"); - if(pthread_kill(child_thread, SIGUSR1) != 0) - { - printf("main: Error at pthread_kill()\n"); - exit(PTS_UNRESOLVED); - } - - /* Wait for thread to receive the signal */ - while(sig_rcvd != 1) - { - sleep(1); - } - - printf("main: call barrier wait\n"); - rc = pthread_barrier_wait(&barrier); - - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Test FAILED: main: pthread_barrier_wait() got unexpected " - "return code : %d\n" , rc); - exit(PTS_FAIL); - } - else if(rc == PTHREAD_BARRIER_SERIAL_THREAD) - printf("main: got PTHREAD_BARRIER_SERIAL_THREAD\n"); - - barrier_waited = 1; - - /* We expected the child returned from barrier wait */ - cnt = 0; - do{ - sleep(1); - }while (thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: child thread still blocked on " - "barrier wait\n"); - return PTS_FAIL; - } - else if(thread_state != EXITING_THREAD) - { - printf("main: Unexpected thread state\n"); - return PTS_UNRESOLVED; - } - - if(pthread_join(child_thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_barrier_destroy(&barrier) != 0) - { - printf("Error at pthread_barrier_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/4-1.sh deleted file mode 100755 index e132fec781..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/4-1.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# A thread that has blocked on a barrier shall not prevent any unblocked -# thread that is eligible to use the same processing resources from -# eventually making forward progress in its execution. -# Eligibility for processing resources shall be determined by the scheduling policy. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/5-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/5-1.sh deleted file mode 100755 index 1133c2a2a5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/5-1.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Upon successful completion, the pthread_barrier_wait( ) function shall return -# PTHREAD_BARRIER_SERIAL_THREAD for a single (arbitrary) thread synchronized at the -# barrier and zero for each of the other threads. Otherwise, -# an error number shall be returned to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/6-1.c deleted file mode 100644 index 6849fb66c4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/6-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrier_wait() - * - * The pthread_barrier_wait( ) function may fail if: - * [EINVAL] The value specified by barrier does not refer to an initialized barrier object. - * - * This case will always pass. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int rc; - -void sig_handler() -{ - printf("main: blocked on barrier wait with an un-initializied barrier object.\n"); - printf("Test PASSED: Note*: Expected EINVAL when calling this funtion with an un-initialized barrier object, but standard says 'may' fail.\n"); - exit(PTS_PASS); -} - -int main() -{ - pthread_barrier_t barrier; - struct sigaction act; - - /* Set up main thread to handle SIGALRM */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - sigfillset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - - /* Intialize return code */ - rc = 1; - - /* Call pthread_barrier_wait while refering to an un-initialized barrier object */ - - /* Just in case we are blocked, send a SIGALRM after 2 sec. */ - alarm(2); - - rc = pthread_barrier_wait(&barrier); - - if(rc == EINVAL) - { - printf("Test PASSED\n"); - } - else - { - printf("return code : %d, %s\n" , rc, strerror(rc)); - printf("Test PASSED: Note*: Expected EINVAL when calling this funtion with an un-initialized barrier object, but standard says 'may' fail.\n"); - } - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/assertions.xml deleted file mode 100644 index 0e5ba19633..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/assertions.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - The pthread_barrier_wait( ) function shall synchronize participating threads at the barrier - referenced by barrier. The calling thread shall block until the required number of threads have - called pthread_barrier_wait( ) specifying the barrier. - - - - When the required number of threads have called pthread_barrier_wait( ) specifying the barrier, - the constant PTHREAD_BARRIER_SERIAL_THREAD shall be returned to one unspecified - thread and zero shall be returned to each of the remaining threads. At this point, the - barrier shall be reset to the state it had as a result of the most recent - pthread_barrier_init( ) function that referenced it. - - - - If a signal is delivered to a thread blocked on a barrier, upon return from the signal - handler the thread shall resume waiting at the barrier if the barrier wait has not completed - (that is, if the required number of threads have not arrived at the barrier during the - execution of the signal handler); otherwise, the thread shall continue as normal from the - completed barrier wait. Until the thread in the signal handler returns from it, it is - unspecified whether other threads may proceed past the barrier once they have all reached it. - - - - A thread that has blocked on a barrier shall not prevent any unblocked thread that is eligible - to use the same processing resources from eventually making forward progress in its execution. - Eligibility for processing resources shall be determined by the scheduling policy. - - - - Upon successful completion, the pthread_barrier_wait( ) function shall return - PTHREAD_BARRIER_SERIAL_THREAD for a single (arbitrary) thread synchronized at the - barrier and zero for each of the other threads. Otherwise, an error number shall be returned to - indicate the error. - - - - The pthread_barrier_wait( ) function may fail if: - [EINVAL] The value specified by barrier does not refer to an initialized barrier object. - - These functions shall not return an error code of EINTR. - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/coverage.txt deleted file mode 100644 index b2cb0d944c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrier_wait/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_barrier_wait() function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/1-1.c deleted file mode 100644 index 6d5278c9ff..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/1-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrierattr_destroy() - * - * The pthread_barrierattr_destroy( ) function shall destroy a barrier - * attributes object. A destroyed attr attributes object can be reinitialized - * - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - int rc; - pthread_barrierattr_t ba; - - /* Initialize a barrier attribute object */ - if(pthread_barrierattr_init(&ba) != 0) - { - printf("Error at pthread_barrierattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Destroy barrier attribute object */ - rc = pthread_barrierattr_destroy(&ba); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_barrierattr_destroy() " - "return code: %d, %s", rc, strerror(rc)); - return PTS_FAIL; - } - - /* Re-initialize the barrier attribute object */ - rc = pthread_barrierattr_init(&ba); - if(rc != 0) - { - printf("Test FAILED: Error while re-initializing barrier attribute object\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/2-1.sh deleted file mode 100755 index 4f8d4329b6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Upon successful completion, this function shall return zero; -# otherwise, an error number shall be returned to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/assertions.xml deleted file mode 100644 index c842a581a4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/assertions.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - The pthread_barrierattr_destroy( ) function shall destroy a barrier attributes object. - A destroyed attr attributes object can be reinitialized using pthread_barrierattr_init( ); - - - - The pthread_barrierattr_destroy( ) function may fail if: - [EINVAL] The value specified by attr is invalid. - - These functions shall not return an error code of [EINTR]. - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/coverage.txt deleted file mode 100644 index 8a6519865b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_destroy/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -This document defines the coverage for the pthread_barrierattr_destroy() function: - -Assertion Tested? -1 YES -2 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/1-1.c deleted file mode 100644 index 75fd8c4553..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/1-1.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrierattr_getpshared() - * - * The pthread_barrierattr_getpshared( ) function shall obtain the value of - * the process-shared attribute from the attributes object referenced by attr. - * - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - int rc; - pthread_barrierattr_t ba; - int pshared; - - /* Initialize the barrier attribute object */ - rc = pthread_barrierattr_init(&ba); - if(rc != 0) - { - printf("Error while initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Get pshared */ - if(pthread_barrierattr_getpshared(&ba, &pshared) != 0) - { - printf("Error at pthread_barrierattr_getpshared()\n"); - return PTS_FAIL; - } - - if(pshared != PTHREAD_PROCESS_PRIVATE) - { - printf("The process shared attribute was not set to " - "default value of PTHREAD_PROCESS_PRIVATE\n"); - return PTS_UNRESOLVED; - } - - /* Cleanup */ - rc = pthread_barrierattr_destroy(&ba); - if(rc != 0) - { - printf("Error at pthread_barrierattr_destroy() " - "return code: %d, %s", rc, strerror(rc)); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/2-1.c deleted file mode 100644 index 67be68cb62..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/2-1.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The idea of this case comes from GNU C library NPTL test tst-barrier2.c. - * - * The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit - * a barrier to be operated upon by any thread that has access to the memory - * where the barrier is allocated. If the process-shared attribute - * is PTHREAD_PROCESS_PRIVATE, the barrier shall only be operated - * upon by threads created within the same process as the thread - * that initialized the barrier; if threads of different processes attempt - * to operate on such a barrier, the behavior is undefined. - * The default value of the attribute shall be PTHREAD_PROCESS_PRIVATE. Both constants - * PTHREAD_PROCESS_SHARED and PTHREAD_PROCESS_PRIVATE are defined in . - * - * steps: - * 1. Create a piece of shared memory object, create pthread barrier object 'barrier' - * and set the PTHREAD_PROCESS_SHARED attribute. - * 2. Parent map the shared memory to its memory space, put 'barrier' into it; - * 3. Parent fork to create child process; - * 4. Child process map the 'barrier' to its memory space; - * 5. Parent and Child execute same code: loop N times, calling pthread_barrier_wait() - * 6. Parent and Child should not block on pthread_barrier_wait() - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define LOOP_NUM 10 - -void sig_handler() -{ - printf("Interrupted by SIGALRM\n"); - printf("Test Fail: block on pthread_barrier_wait()\n"); - exit(PTS_FAIL); -} - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNSUPPORTED; - #endif - - static pthread_barrier_t* barrier; - pthread_barrierattr_t ba; - int pshared = PTHREAD_PROCESS_SHARED; - - char shm_name[] = "tmp_pthread_barrierattr_getpshared"; - int shm_fd; - int pid; - int loop; - int serial = 0; - int rc; - int status = 0; - struct sigaction act; - - /* Set up parent to handle SIGALRM */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - sigfillset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - - /* Initialize a barrier attributes object */ - if(pthread_barrierattr_init(&ba) != 0) - { - printf("Error at pthread_barrierattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the pshard value to private to shared */ - if(pthread_barrierattr_setpshared(&ba, pshared) != 0) - { - printf("Error at pthread_barrierattr_setpshared()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_barrierattr_getpshared(&ba, &pshared) != 0) - { - printf("Test FAILED: Error at pthread_barrierattr_getpshared()\n"); - return PTS_FAIL; - } - - if(pshared != PTHREAD_PROCESS_SHARED) - { - printf("Test FAILED: Incorrect pshared value %d\n", pshared); - return PTS_FAIL; - } - - /* Create shared object */ - shm_unlink(shm_name); - shm_fd = shm_open(shm_name, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - perror("Error at shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(shm_fd, sizeof(pthread_barrier_t)) != 0) - { - perror("Error at ftruncate()"); - shm_unlink(shm_name); - return PTS_UNRESOLVED; - } - - /* Map the shared memory object to my memory */ - barrier = mmap(NULL, sizeof(pthread_barrier_t), PROT_READ|PROT_WRITE, - MAP_SHARED, shm_fd, 0); - - if(barrier == MAP_FAILED) - { - perror("Error at first mmap()"); - shm_unlink(shm_name); - return PTS_UNRESOLVED; - } - - /* Initialize a barrier */ - if((pthread_barrier_init(barrier, &ba, 2)) != 0) - { - printf("Error at pthread_barrier_init()\n"); - return PTS_UNRESOLVED; - } - - /* Cleanup */ - if((pthread_barrierattr_destroy(&ba)) != 0) - { - printf("Error at pthread_barrierattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - /* Fork a child process */ - pid = fork(); - if(pid == -1) - { - perror("Error at fork()"); - return PTS_UNRESOLVED; - } - else if(pid == 0) - { - /* Child */ - /* Map the shared object to child's memory */ - barrier = mmap(NULL, sizeof(pthread_barrier_t), PROT_READ|PROT_WRITE, - MAP_SHARED, shm_fd, 0); - - if(barrier == MAP_FAILED) - { - perror("child: Error at first mmap()"); - return PTS_UNRESOLVED; - } - } - else - { - printf("parent pid : %d, child pid : %d\n", getpid(), pid); - printf("parent: send me SIGALRM 2 secs later in case I am blocked\n"); - alarm(2); - } - - for(loop = 0; loop < LOOP_NUM; loop++) - { - rc = pthread_barrier_wait(barrier); - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Test FAILED: %d: pthread_barrier_wait() got unexpected " - "return code : %d\n" , getpid(), rc); - exit(PTS_FAIL); - } - else if(rc == PTHREAD_BARRIER_SERIAL_THREAD) - { - serial++; - printf("process %d: get PTHREAD_BARRIER_SERIAL_THREAD\n" - , getpid()); - } - - } - - if(pid > 0) - { - /* parent */ - if( wait(&status) != pid) - { - printf("parent: error at waitpid()\n"); - return PTS_UNRESOLVED; - } - - if(!WIFEXITED(status)) - { - printf("Child exited abnormally\n"); - return PTS_UNRESOLVED; - } - - if((WEXITSTATUS(status) + serial) != LOOP_NUM) - { - printf("status = %d\n", status); - printf("serial = %d\n", serial); - printf("Test FAILED: One of the two processes should get " - "PTHREAD_BARRIER_SERIAL_THREAD\n"); - return PTS_FAIL; - } - - /* Cleanup */ - if(pthread_barrier_destroy(barrier) != 0) - { - printf("Error at pthread_barrier_destroy()"); - return PTS_UNRESOLVED; - } - - if((shm_unlink(shm_name)) != 0) - { - perror("Error at shm_unlink()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(pid == 0) - { - exit(serial); - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/3-1.sh deleted file mode 100755 index 059da4c43b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Upon successful completion, these functions shall return zero; -# otherwise, an error number shall be returned to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/assertions.xml deleted file mode 100644 index 52ecb45724..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/assertions.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - The pthread_barrierattr_getpshared( ) function shall obtain the value of the process-shared - attribute from the attributes object referenced by attr. - - - - The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a barrier to be - operated upon by any thread that has access to the memory where the barrier is allocated. - If the process-shared attribute is PTHREAD_PROCESS_PRIVATE, the barrier shall only be operated - upon by threads created within the same process as the thread that initialized the barrier; if - threads of different processes attempt to operate on such a barrier, the behavior is undefined. - The default value of the attribute shall be PTHREAD_PROCESS_PRIVATE. Both constants - PTHREAD_PROCESS_SHARED and PTHREAD_PROCESS_PRIVATE are defined in "pthread.h". - - - - If successful, the pthread_barrierattr_getpshared( ) function shall return zero and store the - value of the process-shared attribute of attr into the object referenced by the pshared - parameter. Otherwise, an error number shall be returned to indicate the error. - - - - These functions may fail if: - [EINVAL] The value specified by attr is invalid. - These functions shall not return an error code of EINTR. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/coverage.txt deleted file mode 100644 index c94f3590b9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_getpshared/coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -This document defines the coverage for the pthread_barrierattr_destroy() function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/1-1.c deleted file mode 100644 index cddc1851ba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/1-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrierattr_init() - * - * The pthread_barrierattr_init( ) function shall initialize a barrier attributes - * object attr with the default value for all of the attributes defined - * by the implementation. - * - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - int rc; - pthread_barrierattr_t ba; - int pshared; - - /* Initialize the barrier attribute object */ - rc = pthread_barrierattr_init(&ba); - if(rc != 0) - { - printf("Test FAILED: Error while initialize attribute object\n"); - return PTS_FAIL; - } - - /* Get the pshared value of the initialized barrierattr object */ - if(pthread_barrierattr_getpshared(&ba, &pshared) != 0) - { - printf("Error at pthread_barrierattr_getpshared()\n"); - return PTS_UNRESOLVED; - } - - /* The default should be PTHREAD_PROCESS_PRIVATE */ - if(pshared != PTHREAD_PROCESS_PRIVATE) - { - printf("Test FAILED: The process shared attribute was not set to " - "default value\n"); - return PTS_FAIL; - } - - /* Cleanup */ - rc = pthread_barrierattr_destroy(&ba); - if(rc != 0) - { - printf("Error at pthread_barrierattr_destroy() " - "return code: %d, %s", rc, strerror(rc)); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/2-1.c deleted file mode 100644 index 93695d9db9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/2-1.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrierattr_init() - * - * After a barrier attributes object has been used to initialize one or more barriers - * any function affecting the attributes object (including destruction) shall not - * affect any previously initialized barrier. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BARRIER_NUM 100 - -int main() -{ - int rc; - pthread_barrierattr_t ba; - pthread_barrier_t barriers [BARRIER_NUM]; - int cnt; - - /* Initialize the barrier attribute object */ - rc = pthread_barrierattr_init(&ba); - if(rc != 0) - { - printf("Test FAILED: Error while initialize attribute object\n"); - return PTS_FAIL; - } - - /* Initialize BARRIER_NUM barrier objects, with count==1 */ - for(cnt = 0; cnt < BARRIER_NUM; cnt++) - { - if(pthread_barrier_init(&barriers[cnt], &ba, 1) != 0) - { - printf("Error at %dth initialization\n", cnt); - return PTS_UNRESOLVED; - } - } - - /* Destroy barrier attribute object */ - rc = pthread_barrierattr_destroy(&ba); - if(rc != 0) - { - printf("Error at pthread_barrierattr_destroy() " - "return code: %d, %s", rc, strerror(rc)); - return PTS_UNRESOLVED; - } - - /* Check that pthread_barrier_wait can still be performed, even after the attributes - * object has been destroyed */ - for(cnt = 0; cnt < BARRIER_NUM; cnt++) - { - rc = pthread_barrier_wait(&barriers[cnt]); - if(rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) - { - printf("Test Fail: Error at %dth wait, %s\n", cnt, strerror(rc)); - return PTS_FAIL; - } - } - - /* Cleanup */ - for(cnt = 0; cnt < BARRIER_NUM; cnt++) - { - rc = pthread_barrier_destroy(&barriers[cnt]); - if(rc != 0) - { - printf("Error at %dth destruction, %s\n", cnt, strerror(rc)); - return PTS_UNRESOLVED; - } - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/3-1.sh deleted file mode 100755 index 4f8d4329b6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Upon successful completion, this function shall return zero; -# otherwise, an error number shall be returned to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/assertions.xml deleted file mode 100644 index 212a6a390e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/assertions.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - The pthread_barrierattr_init( ) function shall initialize a barrier attributes object attr - with the default value for all of the attributes defined by the implementation. - - - - After a barrier attributes object has been used to initialize one or more barriers, any - function affecting the attributes object (including destruction) shall not affect any - previously initialized barrier. - - - - If successful, - it shall return zero; otherwise, an error number shall be returned to indicate the error. - The pthread_barrierattr_init( ) function shall fail if: - - [ENOMEM] Insufficient memory exists to initialize the barrier attributes object. - - This function shall not return an error code of [EINTR]. - - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/coverage.txt deleted file mode 100644 index 309e00dc9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_init/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_barrierattr_init() function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/1-1.c deleted file mode 100644 index b5f2140370..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/1-1.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrierattr_setpshared() - * - * The pthread_barrierattr_setpshared( ) function shall - * set the process-shared attribute in an initialized attributes object referenced by attr. - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNSUPPORTED; - #endif - - pthread_barrierattr_t ba; - int pshared = PTHREAD_PROCESS_SHARED; - int pshared2 = PTHREAD_PROCESS_PRIVATE; - int rc; - - /* Initialize a barrier attributes object */ - if(pthread_barrierattr_init(&ba) != 0) - { - printf("Error at pthread_barrierattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set pshared to PTHREAD_PROCESS_SHARED */ - rc = pthread_barrierattr_setpshared(&ba, pshared); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_barrierattr_setpshared()\n"); - return PTS_FAIL; - } - - if(pthread_barrierattr_getpshared(&ba, &pshared) != 0) - { - printf("Error at pthread_barrierattr_getpshared()\n"); - return PTS_FAIL; - } - - if(pshared != PTHREAD_PROCESS_SHARED) - { - printf("Test FAILED: Got error shared attribute value %d\n", pshared); - return PTS_FAIL; - } - - /* Set pshared to PTHREAD_PROCESS_SHARED */ - rc = pthread_barrierattr_setpshared(&ba, pshared2); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_barrierattr_setpshared()\n"); - return PTS_FAIL; - } - - if(pthread_barrierattr_getpshared(&ba, &pshared2) != 0) - { - printf("Error at pthread_barrierattr_getpshared()\n"); - return PTS_FAIL; - } - - if(pshared2 != PTHREAD_PROCESS_PRIVATE) - { - printf("Test FAILED: Got error shared attribute value %d\n", pshared); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/2-1.c deleted file mode 100644 index 4a19b76445..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/2-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * pthread_barrierattr_setpshared() - * - * The pthread_barrierattr_setpshared( ) function may fail if: - * [EINVAL] The new value specified for the process-shared attribute is not one of - * the legal values PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE. - * This case will always pass - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNSUPPORTED; - #endif - - pthread_barrierattr_t ba; - int pshared = PTHREAD_PROCESS_PRIVATE + 1; - int rc; - - /* Set pshared to an invalid value */ - if(pshared == PTHREAD_PROCESS_SHARED) - { - pshared += 1; - } - - /* Initialize a barrier attributes object */ - if(pthread_barrierattr_init(&ba) != 0) - { - printf("Error at pthread_barrierattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set process-shared attribute to an invalid value */ - rc = pthread_barrierattr_setpshared(&ba, pshared); - if(rc == EINVAL) - printf("Test PASSED\n"); - else - { - printf("Get return code: %d, %s\n", rc, strerror(rc)); - printf("Test PASSED: Note*: Expected EINVAL, but standard says 'may' fail.\n"); - } - - return PTS_PASS; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/3-1.sh deleted file mode 100755 index 996af40566..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/3-1.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Upon successful completion, these functions shall return zero; -# otherwise, an error number shall be returned to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/assertions.xml deleted file mode 100644 index cecbd6ebe7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/assertions.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - The pthread_barrierattr_setpshared( ) function shall - set the process-shared attribute in an initialized attributes object referenced by attr. - - - - The pthread_barrierattr_setpshared( ) function may fail if: - - [EINVAL] The new value specified for the process-shared attribute is not one of the legal - values PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE. - - These functions shall not return an error code of [EINTR]. - - - - If successful, the pthread_barrierattr_setpshared( ) function shall return zero; otherwise, - an error number shall be returned to indicate the error. - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/coverage.txt deleted file mode 100644 index 995f14b583..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_barrierattr_setpshared/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_barrierattr_setpshared() function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/1-1.c deleted file mode 100644 index 10814398e2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/1-1.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancel - * Shall request that 'thread' shall be canceled. The target thread's - * cancelability state and type determines when the cancelation takes - * effect. - * - * Test when a thread is PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_ASYNCHRONOUS - * - * STEPS: - * 1. Create a thread. - * 2. In the thread function, set the set and type to - * PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_ASYNCHRONOUS - * 3. Setup a cleanup handler for the thread. - * 4. Send out a thread cancel request to the new thread - * 5. If the cancel request was honored immediately and correctly, the - * cleanup handler would have been executed, and the test will pass. - * 6. If not, the thread will wait for 10 seconds before it exits itself, - * and the test will fail. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cleanup_flag; - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is -1, it means that the thread was canceled. */ -void a_cleanup_func() -{ - cleanup_flag=1; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - pthread_cleanup_push(a_cleanup_func,NULL); - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Wait until main() has sent out a cancel request, meaning until it - * sets sem1==0 */ - while(sem1==1) - sleep(1); - - /* Give thread 10 seconds to time out. If the cancel request was not - * honored until now, the test will fail. */ - sleep(10); - - /* Shouldn't get here if the cancel request was honored immediately - * like it should have been. */ - cleanup_flag=-1; - pthread_cleanup_pop(0); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cleanup_flag=0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=1.) */ - while(sem1==INTHREAD) - sleep(1); - - if(pthread_cancel(new_th) != 0) - { - printf("Test FAILED: Couldn't cancel thread\n"); - return PTS_FAIL; - } - - /* Indicate to the thread function that the thread cancel request - * has been sent to it. */ - sem1=INTHREAD; - - /* Wait for thread to return. (i.e. either canceled correctly and - * called the cleanup function, or timed out after 10 seconds. */ - while(cleanup_flag==INTHREAD) - sleep(1); - - /* This means that the cleanup function wasn't called, so the cancel - * request was not honord immediately like it should have been. */ - if(cleanup_flag < 0) - { - printf("Test FAILED: Cancel request timed out\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/1-2.c deleted file mode 100644 index 3847e7bb27..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/1-2.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancel - * Shall request that 'thread' shall be canceled. The target thread's - * cancelability state and type determines when the cancelation takes - * effect. - * - * Test when a thread is PTHREAD_CANCEL_DISABLE - * - * STEPS: - * 1. Create a thread. - * 2. In the thread function, set the state to - * PTHREAD_CANCEL_DISABLE - * 3. Setup a cleanup handler for the thread. - * 4. Send out a thread cancel request to the new thread - * 5. If the cancel request was honored, the cleanup handler would have - * been executed and the test will fail. - * 6. If not, the thread will continue until the end of execution and exit - * correctly, therefore passing the test. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cleanup_flag; - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is -1, it means that the thread was canceled, meaning - * the test will fail. */ -void a_cleanup_func() -{ - cleanup_flag=-1; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); - - pthread_cleanup_push(a_cleanup_func,NULL); - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Wait until main() has sent out a cancel request, meaning until it - * sets sem1==INMAIN. Sleeping for 3 secs. to give time for the - * cancel request to be sent and processed. */ - while(sem1==INMAIN) - sleep(1); - - /* Should reach here if the thread correctly ignores the cancel - * request. */ - pthread_cleanup_pop(0); - cleanup_flag=1; - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cleanup_flag=0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=1.) */ - while(sem1==INTHREAD) - sleep(1); - - if(pthread_cancel(new_th) != 0) - { - perror("Error sending cancel request\n"); - return PTS_UNRESOLVED; - } - - /* Indicate to the thread function that the thread cancel request - * has been sent to it. */ - sem1=INTHREAD; - - /* Wait for thread to return. (i.e. either canceled incorrectly and - * called the cleanup function, or exited normally at the end of - * thread execution like it should do. */ - while(cleanup_flag==0) - sleep(1); - - /* This means that the cleanup function was called, meaning the - * thread was canceled rather than ignored the cancel request. */ - if(cleanup_flag <= 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/1-3.c deleted file mode 100644 index 05cb543f76..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/1-3.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancel - * Shall request that 'thread' shall be canceled. The target thread's - * cancelability state and type determines when the cancelation takes - * effect. - * - * Test when a thread is PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_DEFERRED - * - * STEPS: - * 1. Setup a mutex and lock it in main() - * 2. Create a thread. - * 3. In the thread function, set the type to PTHREAD_CANCEL_DEFERRED and state to - * PTHREAD_CANCEL_ENABLE. - * 4. Setup a cleanup handler for the thread. - * 5. Make the thread block on the locked mutex - * 6. Send out a thread cancel request to the new thread, and unlock the mutex allowing the - * thread to continue execution. - * 7. If the cancel request was honored immediately, the - * cleanup handler would have been executed, setting the cleanup_flag to -1, making the - * test fail. - * 8. If not, the thread will continue execution, pop the cleanup handler, set the cleanup - * flag to 1, and call the cancelation point pthread_testcancel(). The test will pass. - * 9. If the thread did not cancel at the cancelation point like it was supposed to, the thread - * will continue execution and set the cleanup_flag to -2, failing the test. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */ -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */ - - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is 1, it means that the thread was canceled. */ -void a_cleanup_func() -{ - cleanup_flag=-1; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); - - pthread_cleanup_push(a_cleanup_func,NULL); - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Lock the mutex. It should have already been locked in main, so the thread - * should block. */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - /* Should get here if the cancel request was deffered. */ - pthread_cleanup_pop(0); - cleanup_flag=1; - - /* Cancelation point. Cancel request should not be honored here. */ - pthread_testcancel(); - - /* Should not get here if the cancel request was honored at the cancelation point - * pthread_testcancel(). */ - cleanup_flag=-2; - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cleanup_flag=0; - - /* Lock the mutex */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - return PTS_UNRESOLVED; - } - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=INMAIN.) */ - while(sem1==INTHREAD) - sleep(1); - - /* Send cancel request to the thread. */ - if(pthread_cancel(new_th) != 0) - { - printf("Test FAILED: Couldn't cancel thread\n"); - return PTS_FAIL; - } - - /* Cancel request has been sent, unlock the mutex */ - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error in pthread_mutex_unlock()\n"); - return PTS_UNRESOLVED; - } - - /* Wait 'till the thread has been canceled or has ended execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* This means that the cleanup function wasn't called, so the cancel - * request was not honord immediately like it should have been. */ - if(cleanup_flag == -1) - { - printf("Test FAILED: Cancel request was not deferred.\n"); - return PTS_FAIL; - } - - if(cleanup_flag == -2) - { - printf("Test FAILED: (1) Cancel request not honored at cancelation point pthread_testcancel() OR (2) pthread_testcancel() not treated as a cancelation point.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/2-1.c deleted file mode 100644 index 4984eae375..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/2-1.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancel - * When the cancelation is acted on, the cancelation cleanup handlers for - * 'thread' shall be called. - * - * STEPS: - * 1. Create a thread - * 2. In the thread function, push a cleanup function onto the stack - * 3. Cancel the thread. The cleanup function should be automatically - * executed, else the test will fail. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int sem; /* Manual semaphore */ -int cleanup_flag; /* Made global so that the cleanup function - can manipulate the value as well. */ - -/* A cleanup function that sets the cleanup_flag to 1, meaning that the - * cleanup function was reached. */ -void a_cleanup_func() -{ - cleanup_flag=1; - sem=0; - return; -} - -/* A thread function called at the creation of the thread. It will push - * the cleanup function onto it's stack, then go into a continuous 'while' - * loop, never reaching the cleanup_pop function. So the only way the cleanup - * function can be called is when the thread is canceled and all the cleanup - * functions are supposed to be popped. */ -void *a_thread_func() -{ - /* To enable thread immediate cancelation, since the default - * is PTHREAD_CANCEL_DEFERRED. */ - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - pthread_cleanup_push(a_cleanup_func,NULL); - sem=1; - while(sem==1) - sleep(1); - sleep(5); - sem=0; - /* Should never be reached, but is required to be in the code - * since pthread_cleanup_push is in the code. Else a compile error - * will result. */ - pthread_cleanup_pop(0); - perror("Operation timed out, thread could not be canceled\n"); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int i; - /* Initializing the cleanup flag. */ - cleanup_flag=0; - sem=0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. */ - while(sem==0) - sleep(1); - - if(pthread_cancel(new_th) != 0) - { - printf("Error canceling thread\n"); - return PTS_FAIL; - } - - i=0; - while(sem==1) - { - sleep(1); - if(i==10) - { - printf("Test FAILED: Timed out while waiting for cancelation cleanup handlers to execute\n"); - return PTS_FAIL; - } - i++; - } - - /* If the cleanup function was not reached by calling the - * pthread_cancel function, then the test fails. */ - if(cleanup_flag != 1) - { - printf("Test FAILED: Could not cancel thread\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/2-2.c deleted file mode 100644 index ddb48dff51..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/2-2.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancel() - * - * Any destructors for thread_specific data will be called - * - * Steps: - * 1. Create a new thread. - * 2. Create a thread specific object in the thread with a destructor - * 3. Call pthread_cancel on the thread. - * 4. Make sure that the destructor was called - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-2" -#define FUNCTION "pthread_cancel" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -int cleanup_flag = 0; -int sem = 0; /* manual semaphore */ - -void destructor(void *tmp) -{ - cleanup_flag = 1; -} - -/* Thread's function. */ -void *a_thread_func(void *tmp) -{ - pthread_key_t key; - int value = 1; - int rc = 0; - - /* To enable thread immediate cancelation, since the default - * is PTHREAD_CANCEL_DEFERRED. */ - rc = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - if (rc != 0) { - printf(ERROR_PREFIX "pthread_setcanceltype\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_key_create(&key, destructor); - if (rc != 0) { - printf(ERROR_PREFIX "pthread_key_create\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_setspecific(key, &value); - if (rc != 0) { - printf(ERROR_PREFIX "pthread_setspecific\n"); - exit(PTS_UNRESOLVED); - } - - /* Tell main that the key is created */ - sem = 1; - - /* Sleep forever */ - while(1) - sleep(5); - return NULL; -} - -int main() -{ - pthread_t new_th; - int rc = 0; - sem = 0; - - /* Create a new thread. */ - rc = pthread_create(&new_th, NULL, a_thread_func, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_create\n"); - exit(PTS_UNRESOLVED); - } - - /* Wait for the thread to be ready */ - while(sem == 0) - sleep(1); - - /* Cancel the thread. */ - rc = pthread_cancel(new_th); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_cancel\n"); - exit(PTS_UNRESOLVED); - } - - /* Delay enough so that the destructor must have been called */ - sleep(5); - - if(cleanup_flag != 1) { - printf(ERROR_PREFIX "Test FAIL: Destructor was not executed.\n"); - exit(PTS_FAIL); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/2-3.c deleted file mode 100644 index 51fff8231a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/2-3.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancel() - * - * Any destructors for thread_specific data will be called after - * all cleanup handlers return - * - * Steps: - * 1. Create a new thread. - * 2. Create a thread specific object in the thread with a destructor - * 3. Add a cleanup function in the thread - * 4. Call pthread_cancel on the thread. - * 5. Make sure that the destructor was called after the cleanup handler - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-3" -#define FUNCTION "pthread_cancel" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -int cleanup_flag = 0; -int destructor_flag = 0; -int sem = 0; /* manual semaphore */ -struct timespec destructor_time, cleanup_time; - -/* - Destructor for the Thread Specific Data - */ -void destructor(void *tmp) -{ - clock_gettime(CLOCK_REALTIME, &destructor_time); - destructor_flag = 1; -} - -/* - Cleanup Handler for the Thread - */ -void cleanup_function() -{ - clock_gettime(CLOCK_REALTIME, &cleanup_time); - cleanup_flag = 1; -} - -/* Thread's function. */ -void *a_thread_func(void *tmp) -{ - pthread_key_t key; - int value = 1; - int rc = 0; - - /* To enable thread immediate cancelation, since the default - * is PTHREAD_CANCEL_DEFERRED. */ - rc = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - if (rc != 0) { - printf(ERROR_PREFIX "pthread_setcanceltype\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_key_create(&key, destructor); - if (rc != 0) { - printf(ERROR_PREFIX "pthread_key_create\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_setspecific(key, &value); - if (rc != 0) { - printf(ERROR_PREFIX "pthread_setspecific\n"); - exit(PTS_UNRESOLVED); - } - - pthread_cleanup_push(cleanup_function, NULL); - - /* Tell main that the key is created */ - sem = 1; - - /* Sleep forever */ - while(1) - sleep(5); - - pthread_cleanup_pop(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int rc = 0; - double diff; - sem = 0; - - /* Create a new thread. */ - rc = pthread_create(&new_th, NULL, a_thread_func, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_create\n"); - exit(PTS_UNRESOLVED); - } - - /* Wait for the thread to be ready */ - while(sem == 0) - sleep(1); - - /* Cancel the thread. */ - rc = pthread_cancel(new_th); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_cancel\n"); - exit(PTS_UNRESOLVED); - } - - /* Delay enough so that the destructor must have been called */ - sleep(5); - - if(cleanup_flag != 1) { - printf(ERROR_PREFIX "Test FAIL: Cleanup handler was not executed.\n"); - exit(PTS_FAIL); - } - - if(destructor_flag != 1) { - printf(ERROR_PREFIX "Test FAIL: Destructor was not executed.\n"); - exit(PTS_FAIL); - } - - diff = destructor_time.tv_sec - cleanup_time.tv_sec; - diff += (double)(destructor_time.tv_nsec - cleanup_time.tv_nsec)/1000000000.0; - if(diff < 0) { - printf(ERROR_PREFIX "Test FAIL: Destructor called before Cleanup Handler\n"); - exit(PTS_FAIL); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/3-1.c deleted file mode 100644 index a51b615a2a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/3-1.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancel - * When the cancelation is acted on, the cancelation cleanup handlers for - * 'thread' shall be called "asynchronously" - * - * STEPS: - * 1. Change main thread to a real-time thread with a high priority - * 1. Create a lower priority thread - * 2. In the thread function, push a cleanup function onto the stack - * 3. Cancel the thread from main and get timestamp, then block. - * 4. The cleanup function should be automatically - * executed, else the test will fail. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" -#include - -#define TEST "3-1" -#define FUNCTION "pthread_cancel" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define FIFOPOLICY SCHED_FIFO -#define MAIN_PRIORITY 30 -#define TIMEOUT_IN_SECS 10 - -/* Manual semaphore */ -int sem; - -/* Made global so that the cleanup function - * can manipulate the value as well. - */ -int cleanup_flag; -struct timespec main_time, cleanup_time; - -/* A cleanup function that sets the cleanup_flag to 1, meaning that the - * cleanup function was reached. - */ -void a_cleanup_func() -{ - clock_gettime(CLOCK_REALTIME, &cleanup_time); - cleanup_flag = 1; - sem = 0; - return; -} - -/* A thread function called at the creation of the thread. It will push - * the cleanup function onto it's stack, then go into a continuous 'while' - * loop, never reaching the cleanup_pop function. So the only way the cleanup - * function can be called is when the thread is canceled and all the cleanup - * functions are supposed to be popped. - */ -void *a_thread_func() -{ - int rc = 0; - - /* To enable thread immediate cancelation, since the default - * is PTHREAD_CANCEL_DEFERRED. - */ - rc = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_setcanceltype\n"); - exit(PTS_UNRESOLVED); - } - pthread_cleanup_push(a_cleanup_func, NULL); - - sem=1; - while(sem == 1) - sleep(1); - sleep(5); - sem=0; - - /* Should never be reached, but is required to be in the code - * since pthread_cleanup_push is in the code. Else a compile error - * will result. - */ - pthread_cleanup_pop(0); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int i; - double diff ; - struct sched_param param; - int rc = 0; - - /* Initializing the cleanup flag. */ - cleanup_flag = 0; - sem = 0; - param.sched_priority = MAIN_PRIORITY; - - /* Increase priority of main, so the new thread doesn't get to run */ - rc = pthread_setschedparam(pthread_self(), FIFOPOLICY, ¶m); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_setschedparam\n"); - exit(PTS_UNRESOLVED); - } - - /* Create a new thread. */ - rc = pthread_create(&new_th, NULL, a_thread_func, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_create\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created and executed before we cancel it. */ - while(sem == 0) - sleep(1); - - rc = pthread_cancel(new_th); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_cancel\n"); - exit(PTS_FAIL); - } - - /* Get the time after canceling the thread */ - clock_gettime(CLOCK_REALTIME, &main_time); - i = 0; - while(sem == 1) { - sleep(1); - if(i == TIMEOUT_IN_SECS) { - printf(ERROR_PREFIX "Cleanup handler was not called\n"); - exit(PTS_FAIL); - } - i++; - } - - /* If the cleanup function was not reached by calling the - * pthread_cancel function, then the test fails. - */ - if(cleanup_flag != 1) { - printf(ERROR_PREFIX "Cleanup handler was not called\n"); - exit(PTS_FAIL); - } - - diff = cleanup_time.tv_sec - main_time.tv_sec; - diff += (double)(cleanup_time.tv_nsec - main_time.tv_nsec)/1000000000.0; - if(diff < 0) { - printf(ERROR_PREFIX "Cleanup function was called before main continued\n"); - exit(PTS_FAIL); - } - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/4-1.c deleted file mode 100644 index 3a4facaa37..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/4-1.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancel - * Upon successful completion will return a 0. - * - * STEPS: - * 1. Create a thread - * 2. Cancel that thread - * 3. If pthread_cancel does not return [ESRCH] then it should return 0 - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int sem; /* Manual semaphore */ -void *a_thread_func() -{ - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - /* Indicate to main() that the thread has been created. */ - sem=1; - - while(1) - sleep(1); - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int ret; - - sem=0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. */ - while(sem==0) - sleep(1); - - /* Send cancel request to thread */ - ret=pthread_cancel(new_th); - - if(ret != 0) - { - if(ret == ESRCH) - { - perror("Could not cancel thread\n"); - return PTS_UNRESOLVED; - } - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/5-1.c deleted file mode 100644 index d3b53122d0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/5-1.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancel - * It may return an error number of: - * -[ESRCH] No thread could be found corresponding to that thread ID - - * It shall not return an error code of [EINTR] -* - * STEPS: - * 1. Create a thread - * 2. Wait 'till the thread has ended execution - * 3. Send a cancel request to the thread (which isn't existing anymore) - * 3. It should return an error code of [ESRCH], else test fails. - * - */ - -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int ret; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to finish execution. */ - pthread_join(new_th, NULL); - - /* Try and cancel thread. It should return an error because it - * already is canceled and doesn't exist anymore. */ - ret=pthread_cancel(new_th); - - if(ret != 0) - { - if(ret == ESRCH) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED: Returned error code other than [ESRCH]\n"); - return PTS_FAIL; - } - - printf("Test PASSED: *NOTE: Returned 0 on error, though standard states 'may' fail.\n"); - return PTS_PASS; - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/5-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/5-2.c deleted file mode 100644 index c4e30cbf8f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/5-2.c +++ /dev/null @@ -1,362 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function does not return EINTR - -* The steps are: -* -> kill a thread which calls pthread_cancel -* -> check that EINTR is never returned - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -char do_it = 1; -unsigned long count_ope = 0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig = 0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} - -thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig ( void * arg ) -{ - thestruct * thearg = ( thestruct * ) arg; - int ret; - pid_t process; - - process = getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread" ); - } - - while ( do_it ) - { -#ifdef WITH_SYNCHRO - - if ( ( ret = sem_wait( thearg->sem ) ) ) - { - UNRESOLVED( errno, "Sem_wait in sendsig" ); - } - - count_sig++; -#endif - - ret = kill( process, thearg->sig ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Kill in sendsig" ); - } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig1 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 1" ); - } - -#endif -} - -/* This one is registered for signal SIGUSR2 */ -void sighdl2( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig2 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 2" ); - } - -#endif -} - -/* Init function */ -void * testth( void * arg ) -{ - - while ( do_it ) - sched_yield(); - - return NULL; -} - - -/* Test function -- calls pthread_kill() and checks that EINTR is never returned. */ -void * test( void * arg ) -{ - int ret = 0; - pthread_t test_ch; - - ret = pthread_create( &test_ch, NULL, testth, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a thread" ); - } - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_UNBLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread" ); - } - - - while ( do_it ) - { - count_ope++; - - ret = pthread_cancel( test_ch ); - - if ( ret == EINTR ) - { - FAILED( "pthread_self returned EINTR" ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_self returned an unexpected error" ); - } - - } - - - ret = pthread_join( test_ch, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the canceled thread" ); - } - - return NULL; -} - -/* Main function */ -int main ( int argc, char * argv[] ) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset ( &sa.sa_mask ); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - - if ( ( ret = sigaction ( SIGUSR1, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler1" ); - } - - sa.sa_handler = sighdl2; - - if ( ( ret = sigaction ( SIGUSR2, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler2" ); - } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset( &usersigs ); - - ret = sigaddset( &usersigs, SIGUSR1 ); - - ret |= sigaddset( &usersigs, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to add SIGUSR1 or 2 to a signal set" ); - } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread" ); - } - -#ifdef WITH_SYNCHRO - if ( sem_init( &semsig1, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig1 init" ); - } - - if ( sem_init( &semsig2, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig2 init" ); - } - -#endif - - if ( ( ret = pthread_create( &th_work, NULL, test, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread creation failed" ); - } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ( ( ret = pthread_create( &th_sig1, NULL, sendsig, ( void * ) & arg1 ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread creation failed" ); - } - - if ( ( ret = pthread_create( &th_sig2, NULL, sendsig, ( void * ) & arg2 ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread creation failed" ); - } - - - - /* Let's wait for a while now */ - sleep( 1 ); - - - /* Now stop the threads and join them */ - do - { - do_it = 0; - } - while ( do_it ); - - - if ( ( ret = pthread_join( th_sig1, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread join failed" ); - } - - if ( ( ret = pthread_join( th_sig2, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread join failed" ); - } - - - if ( ( ret = pthread_join( th_work, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread join failed" ); - } - - -#if VERBOSE > 0 - output( "Test executed successfully.\n" ); - - output( " %d operations.\n", count_ope ); - -#ifdef WITH_SYNCHRO - output( " %d signals were sent meanwhile.\n", count_sig ); - -#endif -#endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/assertions.xml deleted file mode 100644 index 2e8912b33d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/assertions.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - The function - - int pthread_cancel(pthread_t thread); - - sends a request that 'thread' shall be canceled. The target thread's - cancelability state and type determines when/if the cancelation takes - effect. - - - When the cancelation request is honored, the cancelation cleanup handlers for - 'thread' are called. - - When the last cancelation cleanup handler returns, the thread-specific - data destructer functions will be called for 'thread'. - When the last destructer function returns, 'thread' then terminates. - - NOTE: Still trying to find a good way to test the second paragraph of - assertion #2. - - - The cancelation processing in the target thread will run asynchronously - with respect to the calling thread returning from pthread_cancel(); - - - If success, it returns a 0; - - - It may return an error number if: - - -[ESRCH] No thread could be found corresponding to that thread ID - - It will not return [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/coverage.txt deleted file mode 100644 index 73bce89e78..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/coverage.txt +++ /dev/null @@ -1,16 +0,0 @@ -This document defines the coverage for the pthread_cancel function: - -Assertion Tested? -1 YES -2 YES ** Difficult to test and assert that date destructors - have been called (read assertions.xml file for more). -3 YES -4 YES -5 YES ** Keeping in mind it 'may' fail and not 'shall' fail, - so it will always return PASS, but will return a - PASS and print out a warning if it fails. - -NOTE: In a lot of these test, I didn't make use of semaphores or mutexes, but -rather manually created my own. This is because I was taking into account -different implementations. - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cancel/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/1-1.c deleted file mode 100644 index 39b489806e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/1-1.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * void pthread_cleanup_pop(int execution); - * - * Shall remove the routine at the top of the calling thread's cancelation cleanup stack and - * optionally invoke it (if execute is non-zero). - * - * STEPS: - * 1. Create a thread - * 2. The thread will push a cleanup handler routine, then call pthread_cleanup_pop, setting - * 'execution' to a non-zero value (meaning the cleanup handler should be executed) - * 3. Verify that the cleanup handler was called. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define CLEANUP_NOTCALLED 0 -# define CLEANUP_CALLED 1 - -# define INTHREAD 0 -# define INMAIN 1 - -int sem1; /* Manual semaphore */ -int cleanup_flag; - -/* Cleanup handler */ -void a_cleanup_func(void *flag_val) -{ - cleanup_flag = (long)flag_val; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_cleanup_push(a_cleanup_func, (void*) CLEANUP_CALLED); - pthread_cleanup_pop(1); - - /* Tell main that the thread has called the pop function */ - sem1 = INMAIN; - - /* Wait for main to say it's ok to continue (as it checks to make sure that - * the cleanup handler was called */ - while (sem1 == INMAIN) - sleep(1); - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cleanup_flag = CLEANUP_NOTCALLED; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to call the pthread_cleanup_pop */ - while(sem1==INTHREAD) - sleep(1); - - /* Check to verify that the cleanup handler was called */ - if(cleanup_flag != CLEANUP_CALLED) - { - printf("Test FAILED: Cleanup handler was not called\n"); - return PTS_FAIL; - } - - /* Tell thread it can keep going now */ - sem1=INTHREAD; - - /* Wait for thread to end execution */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/1-2.c deleted file mode 100644 index fde4216cca..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/1-2.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * void pthread_cleanup_pop(int execution); - * - * Shall remove the routine at the top of the calling thread's cancelation cleanup stack and - * optionally invoke it (if execute is non-zero). - * - * STEPS: - * 1. Create a thread - * 2. The thread will push a cleanup handler routine, then call pthread_cleanup_pop, setting - * 'execution' to a zero value (meaning the cleanup handler shouldn't be executed) - * 3. Verify that the cleanup handler was not called. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define CLEANUP_NOTCALLED 0 -# define CLEANUP_CALLED 1 - -# define INTHREAD 0 -# define INMAIN 1 - -int sem1; /* Manual semaphore */ -int cleanup_flag; - -/* Cleanup handler */ -void a_cleanup_func(void *flag_val) -{ - cleanup_flag = (long)flag_val; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_cleanup_push(a_cleanup_func, (void*) CLEANUP_CALLED); - pthread_cleanup_pop(0); - - /* Tell main that the thread has called the pop function */ - sem1 = INMAIN; - - /* Wait for main to say it's ok to continue (as it checks to make sure that - * the cleanup handler was called */ - while (sem1 == INMAIN) - sleep(1); - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cleanup_flag = CLEANUP_NOTCALLED; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to call the pthread_cleanup_pop */ - while(sem1==INTHREAD) - sleep(1); - - /* Check to verify that the cleanup handler was called */ - if(cleanup_flag == CLEANUP_CALLED) - { - printf("Test FAILED: Cleanup was incorrectly called\n"); - return PTS_FAIL; - } - - /* Tell thread it can keep going now */ - sem1=INTHREAD; - - /* Wait for thread to end execution */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/1-3.c deleted file mode 100644 index b584088c05..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/1-3.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * void pthread_cleanup_pop(int execution); - * - * Shall remove the routine at the top of the calling thread's cancelation cleanup stack and - * optionally invoke it (if execute is non-zero). - * - * STEPS: - * 1. Create a thread - * 2. The thread will push 3 cleanup handler routines, then it will call the pop function 3 - * times. - * 3. Verify that the cleanup handlers are popped in order. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define CLEANUP_NOTCALLED 0 -# define CLEANUP_CALLED 1 - -int cleanup_flag[3]; /* Array to hold the cleanup flags for the 3 cleanup handlers */ -int i; - -/* 3 Cleanup handlers */ -void a_cleanup_func1(void *flag_val) -{ - cleanup_flag[i] = 1; - i++; - return; -} - -void a_cleanup_func2(void *flag_val) -{ - cleanup_flag[i] = 2; - i++; - return; -} - -void a_cleanup_func3(void *flag_val) -{ - cleanup_flag[i] = 3; - i++; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_cleanup_push(a_cleanup_func1, NULL); - pthread_cleanup_push(a_cleanup_func2, NULL); - pthread_cleanup_push(a_cleanup_func3, NULL); - pthread_cleanup_pop(1); - pthread_cleanup_pop(1); - pthread_cleanup_pop(1); - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - for(i = 0;i < 3;i++) - cleanup_flag[i] = 0; - i = 0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Verify that the cancellation handlers are popped in order, that is: - * 3, 2, then 1. */ - if((cleanup_flag[0] != 3) || (cleanup_flag[1] != 2) || (cleanup_flag[2] != 1)) - { - printf("Test FAILED: Cleanup handlers not popped in order, expected 3,2,1, but got:\n"); - printf("%d, %d, %d\n", cleanup_flag[0], cleanup_flag[1], cleanup_flag[2]); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/2-1.sh deleted file mode 100755 index 6cf261cfe8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/2-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_cleanup_pop() does not return a value or an error code of [EINTR] - - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/assertions.xml deleted file mode 100644 index c6fae2535b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/assertions.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - The function - - void pthread_cleanup_pop(int execute); - - Shall remove the routine at the top of the calling thread's cancelation cleanup stack and - optionally invoke it (if execute is non-zero). - - - - - It will not return a value, or an error code of [EINTR] - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/coverage.txt deleted file mode 100644 index ba6b809df3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_pop/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_cleanup_pop function: - -Assertion Tested? -1 YES -2 YES - -NOTE: - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/1-1.c deleted file mode 100644 index ea981ec908..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/1-1.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * void pthread_cleanup_push(void (*routine) (void*), void *arg); - * - * Shall push the specified cancelation cleanup handler routine onto the calling thread's - * cancelation cleanup stack. The cancelation cleanup handler shall be popped from the - * cancelation cleanup stack and invoked with the argument arg when: - * - * (a)- The thread exits (calls pthread_exit()) - * (b)- The thread acts upon a cancelation request - * (c)- the thread calls pthread_cleanup_pop() with a non-zero execution argument - * - * Testing (a) - * - * STEPS: - * 1. Create a thread - * 2. The thread will push a cleanup handler routine and then exit befor the cleanup_pop - * routine is reached. - * 3. Verify that the cleanup handler was called. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define CLEANUP_NOTCALLED 0 -# define CLEANUP_CALLED 1 - -int cleanup_flag; - -/* Cleanup handler */ -void a_cleanup_func(void *flag_val) -{ - cleanup_flag = (long)flag_val; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_cleanup_push(a_cleanup_func, (void*) CLEANUP_CALLED); - - pthread_exit(0); - pthread_cleanup_pop(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - cleanup_flag = CLEANUP_NOTCALLED; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check to verify that the cleanup handler was called */ - if(cleanup_flag != CLEANUP_CALLED) - { - printf("Test FAILED: Cleanup handler not called upon exit\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/1-2.c deleted file mode 100644 index cbfd6a13cb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/1-2.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * void pthread_cleanup_push(void (*routine) (void*), void *arg); - * - * Shall push the specified cancelation cleanup handler routine onto the calling thread's - * cancelation cleanup stack. The cancelation cleanup handler shall be popped from the - * cancelation cleanup stack and invoked with the argument arg when: - * - * (a)- The thread exits (calls pthread_exit()) - * (b)- The thread acts upon a cancelation request - * (c)- the thread calls pthread_cleanup_pop() with a non-zero execution argument - * - * Testing (b) - * - * STEPS: - * 1. Create a thread - * 2. In the thread, push a cancelation handler - * 3. Main will cancel the thread before the thread exits - * 4. Verify that the cleanup handler was called - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define CLEANUP_NOTCALLED 0 -# define CLEANUP_CALLED 1 - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cleanup_flag; - -/* The cleanup handler */ -void a_cleanup_func(void *flag_val) -{ - cleanup_flag = (long)flag_val; - sem1 = INMAIN; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - pthread_cleanup_push(a_cleanup_func, (void*) CLEANUP_CALLED); - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Wait until main() has sent out a cancel request, meaning until it - * sets sem1==INTHREAD */ - while(sem1==INMAIN) - sleep(1); - - /* Give thread 10 seconds to time out. If the cancel request was not - * honored until now, the test is unresolved because the cancel request - * was not handled correctly. */ - sleep(10); - - /* Shouldn't get here if the cancel request was honored immediately - * like it should have been. */ - pthread_cleanup_pop(0); - pthread_exit((void*)PTS_UNRESOLVED); - return NULL; -} - -int main() -{ - pthread_t new_th; - void *value_ptr; /* hold return value of thread from pthread_join */ - - /* Initializing values */ - sem1=INTHREAD; - cleanup_flag=CLEANUP_NOTCALLED; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=1.) */ - while(sem1==INTHREAD) - sleep(1); - - if(pthread_cancel(new_th) != 0) - { - printf("Error: Couldn't cancel thread\n"); - return PTS_UNRESOLVED; - } - - /* Indicate to the thread function that the thread cancel request - * has been sent to it. */ - sem1=INTHREAD; - - /* Wait for thread to return. */ - if(pthread_join(new_th, &value_ptr) != 0) - { - printf("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Make sure cancellation happened correctly */ - if((long)value_ptr == PTS_UNRESOLVED) - { - printf("Error: cancellation not correctly handled\n"); - return PTS_UNRESOLVED; - } - - /* This means that the cleanup function wasn't called, so the cancel - * request was not honord immediately like it should have been. */ - if(cleanup_flag != CLEANUP_CALLED) - { - printf("Test FAILED: Cleanup hanlder not called up cancellation\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/1-3.c deleted file mode 100644 index 954016ddde..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/1-3.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * void pthread_cleanup_push(void (*routine) (void*), void *arg); - * - * Shall push the specified cancelation cleanup handler routine onto the calling thread's - * cancelation cleanup stack. The cancelation cleanup handler shall be popped from the - * cancelation cleanup stack and invoked with the argument arg when: - * - * (a)- The thread exits (calls pthread_exit()) - * (b)- The thread acts upon a cancelation request - * (c)- the thread calls pthread_cleanup_pop() with a non-zero execution argument - * - * Testing (c) - * - * STEPS: - * 1. Create a thread - * 2. The thread will push a cleanup handler routine, then pop the cleanup handler routine. - * 3. Verify that the cleanup handler was called. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define CLEANUP_NOTCALLED 0 -# define CLEANUP_CALLED 1 - -int cleanup_flag; - -/* Cleanup handler */ -void a_cleanup_func(void *flag_val) -{ - cleanup_flag = (long)flag_val; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_cleanup_push(a_cleanup_func, (void*) CLEANUP_CALLED); - pthread_cleanup_pop(1); - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - cleanup_flag = CLEANUP_NOTCALLED; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check to verify that the cleanup handler was called */ - if(cleanup_flag != CLEANUP_CALLED) - { - printf("Test FAILED: Cleanup handler not called\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/2-1.sh deleted file mode 100755 index 87528e1322..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/2-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_cleanup_push() does not return a value or an error code of [EINTR] - - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/assertions.xml deleted file mode 100644 index 43d682ca2f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/assertions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - The function - - void pthread_cleanup_push(void (*routine) (void*), void *arg); - - Shall push the specified cancelation cleanup handler routine onto the calling thread's - cancelation cleanup stack. - - The cancelation cleanup handler shall be popped from the cancelation cleanup stack and invoked - with the argument arg when: - - - The thread exits (calls pthread_exit()) - - The thread acts upon a cancelation request - - the thread calls pthread_cleanup_pop() with a non-zero execution argument - - - - It will not return a value, or an error code of [EINTR] - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/coverage.txt deleted file mode 100644 index 28fb6b851d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cleanup_push/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_cleanup_push function: - -Assertion Tested? -1 YES -2 YES - -NOTE: - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/1-1.c deleted file mode 100644 index c2cddc3f96..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/1-1.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_broadcast() - * shall unblock all threads currently blocked on the specified condition - * variable cond. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 3 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -int start_num = 0; -int waken_num = 0; - -void *thr_func(void *arg) -{ - int rc; - pthread_t self = pthread_self(); - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] failed to acquire the mutex\n", (void*)self); - exit(PTS_UNRESOLVED); - } - start_num ++; - fprintf(stderr,"[Thread 0x%p] started and locked the mutex\n", (void*)self); - - fprintf(stderr,"[Thread 0x%p] is waiting for the cond\n", (void*)self); - rc = pthread_cond_wait(&td.cond, &td.mutex); - if(rc != 0) { - fprintf(stderr,"pthread_cond_wait return %d\n", rc); - exit(PTS_UNRESOLVED); - } - waken_num ++; - fprintf(stderr,"[Thread 0x%p] was wakened and acquired the mutex again\n", (void*)self); - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] failed to release the mutex\n", (void*)self); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"[Thread 0x%p] released the mutex\n", (void*)self); - return NULL; -} - -int main() -{ - int i, rc; - pthread_t thread[THREAD_NUM]; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - for (i=0; i Create as many threads as possible which will wait on a condition variable - * -> broadcast the condition and check that all threads are awaken - * - * The test will fail when the threads are not terminated within a certain duration. - * - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#define UNRESOLVED_KILLALL(error, text) { \ - if (td->fork) \ - { \ - children_t *tmp; \ - while (children->next != NULL) \ - { \ - tmp=children->next; \ - children->next=tmp->next; \ - kill(tmp->data.p, SIGKILL); \ - free(tmp); \ - } \ - } \ - UNRESOLVED(error, text); \ - } -#define FAILED_KILLALL(text) { \ - if (td->fork) \ - { \ - children_t *tmp; \ - while (children->next != NULL) \ - { \ - tmp=children->next; \ - children->next=tmp->next; \ - kill(tmp->data.p, SIGKILL); \ - free(tmp); \ - } \ - } \ - FAILED(text); \ - } -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/* Do not create more than this amount of children: */ -#define MAX_PROCESS_CHILDREN (200) -#define MAX_THREAD_CHILDREN (10000) - -#define TIMEOUT (180) - -#ifndef WITHOUT_ALTCLK -#define USE_ALTCLK /* make tests with MONOTONIC CLOCK if supported */ -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -#ifdef WITHOUT_XOPEN -/* We define those to avoid compilation errors, but they won't be used */ -#define PTHREAD_MUTEX_DEFAULT 0 -#define PTHREAD_MUTEX_NORMAL 0 -#define PTHREAD_MUTEX_ERRORCHECK 0 -#define PTHREAD_MUTEX_RECURSIVE 0 - -#endif - - -struct _scenar -{ - int m_type; /* Mutex type to use */ - int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */ - int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */ - int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_DEFAULT, 0, 0, 0, "Default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 0, 0, 0, "Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 0, 0, "Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 0, 0, "Recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, 0, "PShared default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 1, 0, 0, "Pshared normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, 0, "Pshared errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, 0, "Pshared recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, 1, "Pshared default mutex across processes"} - ,{PTHREAD_MUTEX_NORMAL, 1, 0, 1, "Pshared normal mutex across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, 1, "Pshared errorcheck mutex across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, 1, "Pshared recursive mutex across processes"} - -#ifdef USE_ALTCLK - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, 1, "Pshared default mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_NORMAL, 1, 1, 1, "Pshared normal mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, 1, "Pshared errorcheck mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, 1, "Pshared recursive mutex and alt clock condvar across processes"} - - ,{PTHREAD_MUTEX_DEFAULT, 0, 1, 0, "Default mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_NORMAL, 0, 1, 0, "Normal mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 1, 0, "Errorcheck mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 1, 0, "Recursive mutex and alt clock condvar"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, 0, "PShared default mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_NORMAL, 1, 1, 0, "Pshared normal mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, 0, "Pshared errorcheck mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, 0, "Pshared recursive mutex and alt clock condvar"} -#endif -}; -#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0])) - -/* The shared data */ -typedef struct -{ - int count; /* number of children currently waiting */ - pthread_cond_t cnd; - pthread_mutex_t mtx; - int predicate; /* Boolean associated to the condvar */ - clockid_t cid; /* clock used in the condvar */ - char fork; /* the children are processes */ -} testdata_t; -testdata_t * td; - - -/* Child function (either in a thread or in a process) */ -void * child(void * arg) -{ - int ret=0; - struct timespec ts; - char timed; - - /* lock the mutex */ - ret = pthread_mutex_lock(&td->mtx); - if (ret != 0) { UNRESOLVED(ret, "Failed to lock mutex in child"); } - - /* increment count */ - td->count++; - - timed=td->count & 1; - - if (timed) - { - /* get current time if we are a timedwait */ - ret = clock_gettime(td->cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to read clock"); } - ts.tv_sec += TIMEOUT; - } - - do { - /* Wait while the predicate is false */ - if (timed) - ret = pthread_cond_timedwait(&td->cnd, &td->mtx, &ts); - else - ret = pthread_cond_wait(&td->cnd, &td->mtx); - #if VERBOSE > 5 - output("[child] Wokenup timed=%i, Predicate=%i, ret=%i\n", timed, td->predicate, ret); - #endif - } while ((ret == 0) && (td->predicate==0)); - if (ret == ETIMEDOUT) - { - FAILED("Timeout occured. This means a cond signal was lost -- or parent died"); - } - if (ret != 0) { UNRESOLVED(ret, "Failed to wait for the cond"); } - - /* unlock the mutex */ - ret = pthread_mutex_unlock(&td->mtx); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex."); } - - return NULL; -} - -/* Structure used to store the children information */ -typedef struct _children -{ - union - { - pid_t p; - pthread_t t; - } data; - struct _children * next; -} children_t; - -children_t sentinel={.next=NULL}; - -children_t * children=&sentinel; - -/* Timeout thread */ - -sem_t sem_tmr; - -void * timer(void * arg) -{ - unsigned int to = TIMEOUT; - int ret; - - do { ret = sem_wait(&sem_tmr); } - while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Failed to wait for the semaphore in timer thread."); } - - do { to = sleep(to); } - while (to>0); - FAILED_KILLALL("Operation timed out. A signal was lost."); - return NULL; /* For compiler */ -} - -/* main function */ - -int main (int argc, char * argv[]) -{ - int ret; - - pthread_mutexattr_t ma; - pthread_condattr_t ca; - - int scenar; - long pshared, monotonic, cs, mf; - - int child_count; - children_t *tmp, *cur; - - int ch; - pid_t pid; - int status; - - pthread_t t_timer; - - pthread_attr_t ta; - - testdata_t alternativ; - - output_init(); - - /* check the system abilities */ - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - cs = sysconf(_SC_CLOCK_SELECTION); - monotonic = sysconf(_SC_MONOTONIC_CLOCK); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TPS : %li\n", pshared); - output(" CS : %li\n", cs); - output(" MON : %li\n", monotonic); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - if ((cs < 0) || (monotonic < 0)) - output("Alternative clock won't be tested\n"); - #endif - - /* We are not interested in testing the clock if we have no other clock available.. */ - if (monotonic < 0) - cs = -1; - -#ifndef USE_ALTCLK - if (cs > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file, we use an alternative method */ - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/cond_broadcast-XXXXXX"; - size_t sz, ps; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - ps = (size_t)sysconf(_SC_PAGESIZE); - sz= ((sizeof(testdata_t) / ps) + 1) * ps; /* # pages needed to store the testdata */ - - tmp = calloc( 1 , sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory (%ib).\n", sizeof(testdata_t)); - #endif - } - - /* Initialize the thread attribute object */ - ret = pthread_attr_init(&ta); - if (ret != 0) { UNRESOLVED(ret, "[parent] Failed to initialize a thread attribute object"); } - ret = pthread_attr_setstacksize(&ta, sysconf(_SC_THREAD_STACK_MIN)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Failed to set thread stack size"); } - - /* Initialize the semaphore for the timer thread */ - ret = sem_init(&sem_tmr, 0, 0); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize the semaphore"); } - - /* Do the test for each test scenario */ - for (scenar=0; scenar < NSCENAR; scenar++) - { - /* set / reset everything */ - td->fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the cond attribute object"); } - - #ifndef WITHOUT_XOPEN - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[scenar].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #endif - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[scenar].mc_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the cond var process-shared"); } - } - - /* Set the alternative clock, if supported */ - #ifdef USE_ALTCLK - if ((cs > 0) && (scenarii[scenar].c_clock != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the monotonic clock for the cond"); } - } - ret = pthread_condattr_getclock(&ca, &td->cid); - if (ret != 0) { UNRESOLVED(ret, "Unable to get clock from cond attr"); } - #else - td->cid = CLOCK_REALTIME; - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[scenar].fork != 0)) - { - td->fork = 1; - } - - /* initialize the condvar */ - ret = pthread_cond_init(&td->cnd, &ca); - if (ret != 0) { UNRESOLVED(ret, "Cond init failed"); } - - /* initialize the mutex */ - ret = pthread_mutex_init(&td->mtx, &ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex init failed"); } - - /* Destroy the attributes */ - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var attribute object"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - #if VERBOSE > 2 - output("[parent] Starting test %s\n", scenarii[scenar].descr); - #endif - - td->count=0; - child_count=0; - cur=children; - - /* create the timeout thread */ - ret = pthread_create(&t_timer, NULL, timer, NULL); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Unable to create timer thread"); } - - /* Create all the children */ - if (td->fork==0) - { - do - { - tmp=(children_t *)malloc(sizeof(children_t)); - if (tmp != (children_t *) NULL) - { - ret = pthread_create(&(tmp->data.t), &ta, child, NULL); - if (ret != 0) - { - free(tmp); - } - else - { - child_count++; - tmp->next=NULL; - cur->next=tmp; - cur=tmp; - } - } - else - { - ret = errno; - } - } while ((ret == 0) && (child_count < MAX_THREAD_CHILDREN)); - #if VERBOSE > 2 - output("[parent] Created %i children threads\n", child_count); - #endif - if (child_count==0) - { UNRESOLVED(ret, "Unable to create any thread"); } - } - else - { - do - { - tmp=(children_t *)malloc(sizeof(children_t)); - if (tmp != (children_t *) NULL) - { - tmp->data.p=fork(); - if (tmp->data.p == 0) /* We are the child */ - { - child(NULL); - exit(0); - } - if (tmp->data.p == -1) /* The fork failed */ - { - ret = errno; - free(tmp); - } - else /* We are the father */ - { - ret = 0; - child_count++; - tmp->next=NULL; - cur->next=tmp; - cur=tmp; - } - } - else - { - ret = errno; - } - } while ((ret == 0) && (child_count < MAX_PROCESS_CHILDREN)); - #if VERBOSE > 2 - output("[parent] Created %i children processes\n", child_count); - #endif - if (child_count==0) - { UNRESOLVED(ret, "Unable to create any process"); } - - } - - /* Make sure all children are waiting */ - ret = pthread_mutex_lock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex"); } - ch = td->count; - while (ch < child_count) - { - ret = pthread_mutex_unlock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex"); } - sched_yield(); - ret = pthread_mutex_lock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex"); } - ch = td->count; - } - - #if VERBOSE > 4 - output("[parent] All children are waiting\n"); - #endif - - /* start the timer count */ - do { ret = sem_post(&sem_tmr); } - while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED_KILLALL(errno, "Failed to post the semaphore."); } - - /* Wakeup the children */ - td->predicate=1; - ret = pthread_cond_broadcast(&td->cnd); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to broadcast the condition."); } - - #if VERBOSE > 4 - output("[parent] Condition was signaled\n"); - #endif - - ret = pthread_mutex_unlock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex"); } - - #if VERBOSE > 4 - output("[parent] Joining the children\n"); - #endif - - /* join the children */ - while (children->next != NULL) - { - tmp=children->next; - children->next=tmp->next; - if (td->fork==0) - { - ret |= pthread_join(tmp->data.t, NULL); - } - else - { - pid = waitpid(tmp->data.p, &status, 0); - if (pid != tmp->data.p) - { - ret = errno; - output("Waitpid failed (expected: %i, got: %i)\n", tmp->data.p, pid); - free(tmp); - UNRESOLVED_KILLALL(ret, "Waitpid failed"); - } - if (WIFEXITED(status)) - { - /* the child should return only failed or unresolved or passed */ - if (ret != PTS_FAIL) - ret |= WEXITSTATUS(status); - } - } - free(tmp); - } - if (ret != 0) - { - output_fini(); - exit(ret); - } - #if VERBOSE > 4 - output("[parent] All children terminated\n"); - #endif - - - /* cancel the timeout thread */ - ret = pthread_cancel(t_timer); - if (ret != 0) - { - /* Strange error here... the thread cannot be terminated (app would be killed) */ - UNRESOLVED(ret, "Failed to cancel the timeout handler"); - } - - /* join the timeout thread */ - ret = pthread_join(t_timer, NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to join the timeout handler"); } - - /* Destroy the datas */ - ret = pthread_cond_destroy(&td->cnd); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the condvar"); } - - ret = pthread_mutex_destroy(&td->mtx); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - } - - /* Destroy global data */ - ret = pthread_attr_destroy(&ta); - if (ret != 0) { UNRESOLVED(ret, "Final thread attr destroy failed"); } - - ret = sem_destroy(&sem_tmr); - if (ret != 0) { UNRESOLVED(errno, "Final semaphore destroy failed"); } - - - /* exit */ - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/2-1.c deleted file mode 100644 index dd009e202c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/2-1.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_broadcast() - * When each thread unblocked as a result of pthread_cond_signal() - * returns from its call to pthread_cond_wait(), the thread shall - * own the mutex with which it called pthread_cond_wait(). - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 3 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -int start_num = 0; -int waken_num = 0; - -void *thr_func(void *arg) -{ - int rc; - pthread_t self = pthread_self(); - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] failed to acquire the mutex\n",(void*)self); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"[Thread 0x%p] started and locked the mutex\n", (void*)self); - start_num ++; - - fprintf(stderr,"[Thread 0x%p] is waiting for the cond\n", (void*)self); - rc = pthread_cond_wait(&td.cond, &td.mutex); - if(rc != 0) { - fprintf(stderr,"pthread_cond_wait return %d\n", rc); - exit(PTS_UNRESOLVED); - } - - if (pthread_mutex_trylock(&td.mutex) == 0) { - fprintf(stderr,"[Thread 0x%p] should not be able to lock the mutex again\n", - (void*)self); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr,"[Thread 0x%p] was wakened and acquired the mutex again\n", (void*)self); - waken_num ++; - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] failed to release the mutex\n", (void*)self); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr,"[Thread 0x%p] released the mutex\n", (void*)self); - return NULL; -} - -int main() -{ - int i, rc; - pthread_t thread[THREAD_NUM]; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - for (i=0; i -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 3 -#define TIMEOUT THREAD_NUM * 2 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -int start_num = 0; -int waken_num = 0; - -void *thr_func(void *arg) -{ - int rc; - struct timespec timeout; - struct timeval curtime; - pthread_t self = pthread_self(); - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] failed to acquire the mutex\n", (void*)self); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"[Thread 0x%p] started and locked the mutex\n", (void*)self); - start_num ++; - - if (gettimeofday(&curtime, NULL) !=0 ) { - fprintf(stderr,"Fail to get current time\n"); - exit(PTS_UNRESOLVED); - } - timeout.tv_sec = curtime.tv_sec + TIMEOUT; - timeout.tv_nsec = curtime.tv_usec * 1000; - - fprintf(stderr,"[Thread 0x%p] is waiting for the cond for at most %d secs\n", - (void*)self, TIMEOUT); - rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout); - if(rc != 0) { - fprintf(stderr,"[Thread 0x%p] pthread_cond_wait returned %d\n", - (void*)self, rc); - exit(PTS_UNRESOLVED); - } - - if (pthread_mutex_trylock(&td.mutex) == 0) { - fprintf(stderr,"[Thread 0x%p] should not be able to lock the mutex again\n", - (void*)self); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr,"[Thread 0x%p] was wakened and acquired the mutex again\n", (void*)self); - waken_num ++; - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] failed to release the mutex\n", (void*)self); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr,"[Thread 0x%p] released the mutex\n", (void*)self); - return NULL; -} - -int main() -{ - int i, rc; - pthread_t thread[THREAD_NUM]; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - for (i=0; i Create N threads which will wait on a condition variable - * -> broadcast the condition - * -> Every child checks that it owns the mutex (when possible) - * - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#define UNRESOLVED_KILLALL(error, text) { \ - if (td->fork) \ - { \ - int _nch; \ - for (_nch=0; _nchfork) \ - { \ - int _nch; \ - for (_nch=0; _nchmtx); - if (ret != 0) { UNRESOLVED(ret, "Failed to lock mutex in child"); } - - /* increment count */ - td->count++; - timed=td->count & 1; - - if (timed) - { - /* get current time if we are a timedwait */ - ret = clock_gettime(td->cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to read clock"); } - ts.tv_sec += TIMEOUT; - } - - do { - /* Wait while the predicate is false */ - if (timed) - ret = pthread_cond_timedwait(&td->cnd, &td->mtx, &ts); - else - ret = pthread_cond_wait(&td->cnd, &td->mtx); - #if VERBOSE > 5 - output("[child] Wokenup timed=%i, Predicate=%i, ret=%i\n", timed, td->predicate, ret); - #endif - } while ((ret == 0) && (td->predicate==0)); - if (ret == ETIMEDOUT) - { - FAILED("Timeout occured. This means a cond signal was lost -- or parent died"); - } - if (ret != 0) { UNRESOLVED(ret, "Failed to wait for the cond"); } - - /* Check that we are owning the mutex */ - #ifdef WITHOUT_XOPEN - ret = pthread_mutex_trylock(&(td->mtx)); - if (ret == 0) { FAILED("The mutex was not owned after return from condition waiting"); } - #else - if (td->mtype == PTHREAD_MUTEX_RECURSIVE) - { - ret = pthread_mutex_trylock(&(td->mtx)); - if (ret != 0) { FAILED("Unable to relock recursive mutex: not owning?"); } - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex"); } - } - if (td->mtype == PTHREAD_MUTEX_ERRORCHECK) - { - ret = pthread_mutex_lock(&(td->mtx)); - if (ret == 0) { FAILED("Was able to lock errorcheck mutex: the mutex was not acquired once already?"); } - } - #endif - - - /* unlock the mutex */ - ret = pthread_mutex_unlock(&td->mtx); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex."); } - - return NULL; -} - -/* Timeout thread */ -void * timer(void * arg) -{ - unsigned int to = TIMEOUT; - do { to = sleep(to); } - while (to>0); - FAILED_KILLALL("Operation timed out. A signal was lost.", pchildren); - return NULL; /* For compiler */ -} - -/* main function */ - -int main (int argc, char * argv[]) -{ - int ret; - - pthread_mutexattr_t ma; - pthread_condattr_t ca; - - int scenar; - long pshared, monotonic, cs, mf; - - int child_count; - - pid_t pid; - int status; - - pthread_t t_timer; - - pthread_attr_t ta; - - testdata_t alternativ; - - output_init(); - - /* check the system abilities */ - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - cs = sysconf(_SC_CLOCK_SELECTION); - monotonic = sysconf(_SC_MONOTONIC_CLOCK); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TPS : %li\n", pshared); - output(" CS : %li\n", cs); - output(" MON : %li\n", monotonic); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - if ((cs < 0) || (monotonic < 0)) - output("Alternative clock won't be tested\n"); - #endif - - /* We are not interested in testing the clock if we have no other clock available.. */ - if (monotonic < 0) - cs = -1; - -#ifndef USE_ALTCLK - if (cs > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file, we use an alternative method */ - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/cond_broadcast-XXXXXX"; - size_t sz, ps; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - ps = (size_t)sysconf(_SC_PAGESIZE); - sz= ((sizeof(testdata_t) / ps) + 1) * ps; /* # pages needed to store the testdata */ - - tmp = calloc( 1 , sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory (%ib).\n", sizeof(testdata_t)); - #endif - } - - /* Initialize the thread attribute object */ - ret = pthread_attr_init(&ta); - if (ret != 0) { UNRESOLVED(ret, "[parent] Failed to initialize a thread attribute object"); } - ret = pthread_attr_setstacksize(&ta, sysconf(_SC_THREAD_STACK_MIN)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Failed to set thread stack size"); } - - /* Do the test for each test scenario */ - for (scenar=0; scenar < NSCENAR; scenar++) - { - /* set / reset everything */ - td->fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the cond attribute object"); } - - #ifndef WITHOUT_XOPEN - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[scenar].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #endif - - td->mtype=scenarii[scenar].m_type; - - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[scenar].mc_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the cond var process-shared"); } - } - - /* Set the alternative clock, if supported */ - #ifdef USE_ALTCLK - if ((cs > 0) && (scenarii[scenar].c_clock != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the monotonic clock for the cond"); } - } - ret = pthread_condattr_getclock(&ca, &td->cid); - if (ret != 0) { UNRESOLVED(ret, "Unable to get clock from cond attr"); } - #else - td->cid = CLOCK_REALTIME; - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[scenar].fork != 0)) - { - td->fork = 1; - } - - /* initialize the condvar */ - ret = pthread_cond_init(&td->cnd, &ca); - if (ret != 0) { UNRESOLVED(ret, "Cond init failed"); } - - /* initialize the mutex */ - ret = pthread_mutex_init(&td->mtx, &ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex init failed"); } - - /* Destroy the attributes */ - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var attribute object"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - #if VERBOSE > 2 - output("[parent] Starting test %s\n", scenarii[scenar].descr); - #endif - - td->count=0; - - /* Create all the children */ - for (children.nb=0; children.nbfork==0) - { - ret = pthread_create(&(children.ch[children.nb].t), &ta, child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to create enough threads"); } - } - else - { - children.ch[children.nb].p=fork(); - if (children.ch[children.nb].p == 0) /* We are the child */ - { - child(NULL); - exit(0); - } - if (children.ch[children.nb].p == -1) /* The fork failed */ - { - children.nb--; - UNRESOLVED_KILLALL(errno, "Failed to create enough processes"); - } - } - } - #if VERBOSE > 4 - output("[parent] Created %i children\n", NCHILDREN); - #endif - - /* Make sure all children are waiting */ - ret = pthread_mutex_lock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex"); } - child_count = td->count; - while (child_count < NCHILDREN) - { - ret = pthread_mutex_unlock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex"); } - sched_yield(); - ret = pthread_mutex_lock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex"); } - child_count = td->count; - } - - #if VERBOSE > 4 - output("[parent] All children are waiting\n"); - #endif - - /* create the timeout thread */ - ret = pthread_create(&t_timer, NULL, timer, NULL); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Unable to create timer thread"); } - - /* Wakeup the children */ - td->predicate=1; - ret = pthread_cond_broadcast(&td->cnd); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to broadcast the condition."); } - - #if VERBOSE > 4 - output("[parent] Condition was signaled\n"); - #endif - - ret = pthread_mutex_unlock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex"); } - - #if VERBOSE > 4 - output("[parent] Joining the children\n"); - #endif - - /* join the children */ - for (--children.nb; children.nb >= 0; children.nb--) - { - if (td->fork==0) - { - ret = pthread_join(children.ch[children.nb].t, NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to join a child thread"); } - } - else - { - pid = waitpid(children.ch[children.nb].p, &status, 0); - if (pid != children.ch[children.nb].p) - { - ret = errno; - output("Waitpid failed (expected: %i, got: %i)\n", children.ch[children.nb].p, pid); - UNRESOLVED_KILLALL(ret, "Waitpid failed"); - } - if (WIFEXITED(status)) - { - /* the child should return only failed or unresolved or passed */ - if (ret != PTS_FAIL) - ret |= WEXITSTATUS(status); - } - } - } - if (ret != 0) - { - output_fini(); - exit(ret); - } - #if VERBOSE > 4 - output("[parent] All children terminated\n"); - #endif - - - /* cancel the timeout thread */ - ret = pthread_cancel(t_timer); - if (ret != 0) - { - /* Strange error here... the thread cannot be terminated (app would be killed) */ - UNRESOLVED(ret, "Failed to cancel the timeout handler"); - } - - /* join the timeout thread */ - ret = pthread_join(t_timer, NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to join the timeout handler"); } - - /* Destroy the datas */ - ret = pthread_cond_destroy(&td->cnd); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the condvar"); } - - ret = pthread_mutex_destroy(&td->mtx); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - } - - /* Destroy global data */ - ret = pthread_attr_destroy(&ta); - if (ret != 0) { UNRESOLVED(ret, "Final thread attr destroy failed"); } - - - /* exit */ - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/4-1.c deleted file mode 100644 index d4d795fa46..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/4-1.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_broadcast() - * Upon successful completion, a value of zero shall be returned. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 5 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -int start_num = 0; -int waken_num = 0; - -void *thr_func(void *arg) -{ - int rc; - pthread_t self = pthread_self(); - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] failed to acquire the mutex\n", (void*)self); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"[Thread 0x%p] started and locked the mutex\n", (void*)self); - start_num ++; - - fprintf(stderr,"[Thread 0x%p] is waiting for the cond\n", (void*)self); - rc = pthread_cond_wait(&td.cond, &td.mutex); - if(rc != 0) { - fprintf(stderr,"pthread_cond_wait return %d\n", rc); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"[Thread 0x%p] was wakened\n", (void*)self); - waken_num ++; - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] failed to release the mutex\n", (void*)self); - exit(PTS_UNRESOLVED); - } - return NULL; -} - -int main() -{ - int i, rc; - pthread_t thread[THREAD_NUM]; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - for (i=0; i Create some threads which wait for a condition. - * -> Create a worker thread which broadcasts this condition. - * -> Another thread loops on killing the worker thread. - * - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#define WITH_SYNCHRO -#ifndef VERBOSE -#define VERBOSE 2 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -char do_it=1; -char woken=0; -unsigned long count_cnd_sig=0, count_cnd_wup=0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -struct -{ - pthread_mutex_t mtx; - pthread_cond_t cnd; -} data; - -/* the following function keeps on sending the signal to the process */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - pid_t process; - - process=getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - ret = kill(process, thearg->sig); - if (ret != 0) { UNRESOLVED(errno, "Kill in sendsig"); } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -/* This one is registered for signal SIGUSR2 */ -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* The following function will wait on the cond - * it does check that no error code of EINTR is returned */ -void * waiter(void * arg) -{ - int ret; - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - ret = pthread_mutex_lock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock mutex in waiter thread"); } - - do - { - ret = pthread_cond_wait(&(data.cnd),&(data.mtx)); - count_cnd_wup++; - } while ((ret == 0) && (do_it != 0)); - if (ret != 0) - { - UNRESOLVED(ret, "pthread_cond_wait returned an unexpected error"); - } - woken++; - - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock mutex in waiter thread"); } - - return NULL; -} - - -/* The next function will signal the condition */ -void * worker (void * arg) -{ - int ret=0; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_UNBLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread"); } - - while (woken<5) - { - ret = pthread_cond_broadcast(&(data.cnd)); - if (ret == EINTR) { FAILED("pthread_cond_signal returned EINTR"); } - if (ret != 0) { UNRESOLVED(ret, "Failed to signal the condition"); } - count_cnd_sig++; - } - - return NULL; -} - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret,i; - pthread_t th_waiter[5], th_worker, th_sig1, th_sig2; - thestruct arg1, arg2; - struct sigaction sa; - - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset(&usersigs); - ret = sigaddset(&usersigs, SIGUSR1); - ret |= sigaddset(&usersigs, SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Unable to add SIGUSR1 or 2 to a signal set"); } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread"); } - - - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - for (i=0; i<5; i++) - { - if ((ret = pthread_create(&th_waiter[i], NULL, waiter, NULL))) - { UNRESOLVED(ret, "Waiter thread creation failed"); } - } - - if ((ret = pthread_create(&th_worker, NULL, worker, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - /* Let's wait for a while now */ - sleep(1); - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - for (i=0; i<5; i++) - { - if ((ret = pthread_join(th_waiter[i], NULL))) - { UNRESOLVED(ret, "Waiter thread join failed"); } - } - if ((ret = pthread_join(th_worker, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" Condition was signaled %d times.\n", count_cnd_sig); - output(" pthread_cond_wait exited %d times.\n", count_cnd_wup); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/assertions.xml deleted file mode 100644 index 34841ff2b2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/assertions.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - The function - int pthread_cond_broadcast(pthread_cond_t *cond); - shall unblock all threads currently blocked on the specified condition - variable cond. - - - - When each thread unblocked as a result of a - pthread_cond_broadcast() returns from its call to pthread_cond_wait() or - pthread_cond_timedwait(), the thread shall own the mutex with which it called - pthread_cond_wait() or pthread_cond_timedwait(). - - - - The pthread_cond_broadcast() functions shall have no effect if there are - no threads currently blocked on cond. - - - - If successful, the pthread_cond_broadcast() function shall return zero; - - - - The pthread_cond_broadcast() function may fail if: - [EINVAL] The value cond does not refer to an initialized condition variable. - These functions shall not return an error code of [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/coverage.txt deleted file mode 100644 index e2751caca5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_cond_broadcast function: - -Assertion Tested? -1 YES -2 YES -3 NO -4 YES -5 NO * When it specifies it 'may' fail and not 'shall' fail, - it will always return PASS, but will return a - PASS and print out a warning if it fails. -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_broadcast/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/1-1.c deleted file mode 100644 index b5ad8395f1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/1-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_destroy() - * shall destroy the condition variable referenced by 'cond'; - * the condition variable object in effect becomes uninitialized. - * - */ - -#include -#include -#include "posixtest.h" - -pthread_cond_t cond1, cond2; -pthread_cond_t cond3 = PTHREAD_COND_INITIALIZER; - -int main() -{ - pthread_condattr_t condattr; - int rc; - - /* Initialize a condition variable attribute object */ - if((rc=pthread_condattr_init(&condattr)) != 0) { - fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Initialize cond1 with the default condition variable attribute */ - if((rc=pthread_cond_init(&cond1,&condattr)) != 0) { - fprintf(stderr,"Fail to initialize cond1, rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Initialize cond2 with NULL attributes */ - if((rc=pthread_cond_init(&cond2,NULL)) != 0) { - fprintf(stderr,"Fail to initialize cond2, rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Destroy the condition variable attribute object */ - if((rc=pthread_condattr_destroy(&condattr)) != 0) { - fprintf(stderr,"Error at pthread_condattr_destroy(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Destroy cond1 */ - if((rc=pthread_cond_destroy(&cond1)) != 0) { - fprintf(stderr,"Fail to destroy cond1, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Destroy cond2 */ - if((rc=pthread_cond_destroy(&cond2)) != 0) { - fprintf(stderr,"Fail to destroy cond2, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Destroy cond3 */ - if((rc=pthread_cond_destroy(&cond3)) != 0) { - fprintf(stderr,"Fail to destroy cond3, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/2-1.c deleted file mode 100644 index a170436b83..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/2-1.c +++ /dev/null @@ -1,672 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * It is safe to destroy a condition variable when no thread is blocked on it. - - * The steps are: - * -> Some threads are waiting on a condition variable. - * -> A thread broadcasts and destroys immediatly the condvar, - * then corrupts the memory of the condvar. - * - * The test fails if it hangs or if an error is returned, either - * in the wait routines or in the destroy routine. - * - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#define UNRESOLVED_KILLALL(error, text, Tchild) { \ - if (td->fork) \ - { \ - int _nch; \ - for (_nch=0; _nchfork) \ - { \ - int _nch; \ - for (_nch=0; _nchmtx1); - if (ret != 0) { UNRESOLVED(ret, "Failed to lock mutex in child"); } - - /* increment count */ - td->count1++; - - timed=td->count1 & 1; - - if (timed) - { - /* get current time if we are a timedwait */ - ret = clock_gettime(td->cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to read clock"); } - ts.tv_sec += TIMEOUT; - } - - do { - /* Wait while the predicate is false */ - if (timed) - ret = pthread_cond_timedwait(&td->cnd, &td->mtx1, &ts); - else - ret = pthread_cond_wait(&td->cnd, &td->mtx1); - } while ((ret == 0) && (td->predicate1==0)); - if ((ret != 0) && (td->predicate1 != 0)) - { - output("Wakening the cond failed with error %i (%s)\n", ret, strerror(ret)); - FAILED("Destroying the cond var while threads were awaken but inside wait routine failed."); - } - if (ret != 0) { UNRESOLVED(ret, "Failed to wait for the cond"); } - - td->count1--; - - /* unlock the mutex */ - ret = pthread_mutex_unlock(&td->mtx1); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex."); } - - /* Second pass */ - - /* lock the mutex */ - ret = pthread_mutex_lock(&td->mtx2); - if (ret != 0) { UNRESOLVED(ret, "Failed to lock mutex in child"); } - - /* increment count */ - td->count2++; - - timed=td->count2 & 1; - - if (timed) - { - /* get current time if we are a timedwait */ - ret = clock_gettime(td->cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to read clock"); } - ts.tv_sec += TIMEOUT; - } - - do { - /* Wait while the predicate is false */ - if (timed) - ret = pthread_cond_timedwait(&td->cnd, &td->mtx2, &ts); - else - ret = pthread_cond_wait(&td->cnd, &td->mtx2); - } while ((ret == 0) && (td->predicate2==0)); - if ((ret != 0) && (td->predicate2 != 0)) - { - output("Wakening the cond failed with error %i (%s)\n", ret, strerror(ret)); - FAILED("Destroying the cond var while threads were awaken but inside wait routine failed."); - } - if (ret != 0) { UNRESOLVED(ret, "Failed to wait for the cond"); } - - /* unlock the mutex */ - ret = pthread_mutex_unlock(&td->mtx2); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex."); } - - - return NULL; -} - -/* Timeout thread */ -void * timer(void * arg) -{ - pid_t *pchildren = (pid_t *)arg; - unsigned int to = TIMEOUT; - do { to = sleep(to); } - while (to>0); - FAILED_KILLALL("Test failed (hang)", pchildren); - return NULL; /* For compiler */ -} - -/* main function */ - -int main (int argc, char * argv[]) -{ - int ret; - - pthread_mutexattr_t ma; - pthread_condattr_t ca; - - int scenar; - long pshared, monotonic, cs, mf; - - pid_t p_child[NTHREADS]; - pthread_t t_child[NTHREADS]; - int ch; - pid_t pid; - int status; - - pthread_t t_timer; - - testdata_t alternativ; - - output_init(); - - /* check the system abilities */ - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - cs = sysconf(_SC_CLOCK_SELECTION); - monotonic = sysconf(_SC_MONOTONIC_CLOCK); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TPS : %li\n", pshared); - output(" CS : %li\n", cs); - output(" MON : %li\n", monotonic); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - if ((cs < 0) || (monotonic < 0)) - output("Alternative clock won't be tested\n"); - #endif - - /* We are not interested in testing the clock if we have no other clock available.. */ - if (monotonic < 0) - cs = -1; - -#ifndef USE_ALTCLK - if (cs > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file, we use an alternative method */ - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/cond_destroy-XXXXXX"; - size_t sz, ps; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - ps = (size_t)sysconf(_SC_PAGESIZE); - sz= ((sizeof(testdata_t) / ps) + 1) * ps; /* # pages needed to store the testdata */ - - tmp = calloc( 1 , sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory (%ib).\n", sizeof(testdata_t)); - #endif - } - - /* Do the test for each test scenario */ - for (scenar=0; scenar < NSCENAR; scenar++) - { - /* set / reset everything */ - td->fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the cond attribute object"); } - - #ifndef WITHOUT_XOPEN - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[scenar].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #endif - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[scenar].mc_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the cond var process-shared"); } - } - - /* Set the alternative clock, if supported */ - #ifdef USE_ALTCLK - if ((cs > 0) && (scenarii[scenar].c_clock != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the monotonic clock for the cond"); } - } - ret = pthread_condattr_getclock(&ca, &td->cid); - if (ret != 0) { UNRESOLVED(ret, "Unable to get clock from cond attr"); } - #else - td->cid = CLOCK_REALTIME; - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[scenar].fork != 0)) - { - td->fork = 1; - } - - - /* Proceed to testing */ - /* initialize the mutex */ - ret = pthread_mutex_init(&td->mtx1, &ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex init failed"); } - - ret = pthread_mutex_init(&td->mtx2, &ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex init failed"); } - - ret = pthread_mutex_lock(&td->mtx2); - if (ret != 0) { UNRESOLVED(ret, "Mutex lock failed"); } - - /* initialize the condvar */ - ret = pthread_cond_init(&td->cnd, &ca); - if (ret != 0) { UNRESOLVED(ret, "Cond init failed"); } - - #if VERBOSE > 2 - output("[parent] Starting 1st pass of test %s\n", scenarii[scenar].descr); - #endif - - td->count1=0; - td->count2=0; - td->predicate1=0; - td->predicate2=0; - - /* Create all the children */ - for (ch=0; ch < NTHREADS; ch++) - { - if (td->fork==0) - { - ret = pthread_create(&t_child[ch], NULL, child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to create a child thread"); } - } - else - { - p_child[ch]=fork(); - if (p_child[ch] == -1) - { - ret = errno; - for (--ch; ch>=0; ch--) - kill(p_child[ch], SIGKILL); - UNRESOLVED(ret, "Failed to create a child process"); - } - - if (p_child[ch] == 0) /* We are the child */ - { - child(NULL); - exit(0); - } - } - } - #if VERBOSE > 4 - output("[parent] All children are running\n"); - #endif - - /* Make sure all children are waiting */ - ret = pthread_mutex_lock(&td->mtx1); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex", p_child); } - ch = td->count1; - while (ch < NTHREADS) - { - ret = pthread_mutex_unlock(&td->mtx1); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex",p_child); } - sched_yield(); - ret = pthread_mutex_lock(&td->mtx1); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex",p_child); } - ch = td->count1; - } - - #if VERBOSE > 4 - output("[parent] All children are waiting\n"); - #endif - - /* create the timeout thread */ - ret = pthread_create(&t_timer, NULL, timer, p_child); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Unable to create timer thread",p_child); } - - /* Wakeup the children */ - td->predicate1=1; - ret = pthread_cond_broadcast(&td->cnd); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to signal the condition.", p_child); } - - ret = pthread_mutex_unlock(&td->mtx1); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex",p_child); } - - /* Destroy the condvar (this must be safe) */ - ret = pthread_cond_destroy(&td->cnd); - if (ret != 0) { FAILED_KILLALL("Unable to destroy the cond while no thread is blocked inside", p_child); } - - /* Reuse the cond memory */ - memset(&td->cnd, 0xFF, sizeof(pthread_cond_t)); - - #if VERBOSE > 4 - output("[parent] Condition was broadcasted, and condvar destroyed.\n"); - #endif - - /* Make sure all children have exited the first wait */ - ret = pthread_mutex_lock(&td->mtx1); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex",p_child); } - ch = td->count1; - while (ch > 0) - { - ret = pthread_mutex_unlock(&td->mtx1); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex",p_child); } - sched_yield(); - ret = pthread_mutex_lock(&td->mtx1); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex",p_child); } - ch = td->count1; - } - - ret = pthread_mutex_unlock(&td->mtx1); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex",p_child); } - - /* Go toward the 2nd pass */ - /* Now, all children are waiting to lock the 2nd mutex, which we own here. */ - /* reinitialize the condvar */ - ret = pthread_cond_init(&td->cnd, &ca); - if (ret != 0) { UNRESOLVED(ret, "Cond init failed"); } - - #if VERBOSE > 2 - output("[parent] Starting 2nd pass of test %s\n", scenarii[scenar].descr); - #endif - - /* Make sure all children are waiting */ - ch = td->count2; - while (ch < NTHREADS) - { - ret = pthread_mutex_unlock(&td->mtx2); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex",p_child); } - sched_yield(); - ret = pthread_mutex_lock(&td->mtx2); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex",p_child); } - ch = td->count2; - } - - #if VERBOSE > 4 - output("[parent] All children are waiting\n"); - #endif - - /* Wakeup the children */ - td->predicate2=1; - ret = pthread_cond_broadcast(&td->cnd); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to signal the condition.", p_child); } - - /* Allow the children to terminate */ - ret = pthread_mutex_unlock(&td->mtx2); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex",p_child); } - - /* Destroy the condvar (this must be safe) */ - ret = pthread_cond_destroy(&td->cnd); - if (ret != 0) { FAILED_KILLALL("Unable to destroy the cond while no thread is blocked inside", p_child); } - - /* Reuse the cond memory */ - memset(&td->cnd, 0x00, sizeof(pthread_cond_t)); - - #if VERBOSE > 4 - output("[parent] Condition was broadcasted, and condvar destroyed.\n"); - #endif - - #if VERBOSE > 4 - output("[parent] Joining the children\n"); - #endif - - /* join the children */ - for (ch=(NTHREADS - 1); ch >= 0 ; ch--) - { - if (td->fork==0) - { - ret = pthread_join(t_child[ch], NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to join a child thread"); } - } - else - { - pid = waitpid(p_child[ch], &status, 0); - if (pid != p_child[ch]) - { - ret = errno; - output("Waitpid failed (expected: %i, got: %i)\n", p_child[ch], pid); - for (; ch>=0; ch--) - { - kill(p_child[ch], SIGKILL); - } - UNRESOLVED(ret, "Waitpid failed"); - } - if (WIFEXITED(status)) - { - /* the child should return only failed or unresolved or passed */ - if (ret != PTS_FAIL) - ret |= WEXITSTATUS(status); - } - } - } - if (ret != 0) - { - output_fini(); - exit(ret); - } - #if VERBOSE > 4 - output("[parent] All children terminated\n"); - #endif - - - /* cancel the timeout thread */ - ret = pthread_cancel(t_timer); - if (ret != 0) - { - /* Strange error here... the thread cannot be terminated (app would be killed) */ - UNRESOLVED(ret, "Failed to cancel the timeout handler"); - } - - /* join the timeout thread */ - ret = pthread_join(t_timer, NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to join the timeout handler"); } - - /* Destroy the datas */ - ret = pthread_cond_destroy(&td->cnd); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the condvar"); } - - ret = pthread_mutex_destroy(&td->mtx1); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - ret = pthread_mutex_destroy(&td->mtx2); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - /* Destroy the attributes */ - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var attribute object"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - - } - - /* exit */ - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/3-1.c deleted file mode 100644 index dbe5220a47..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/3-1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_destroy() - * Upon succesful completion, it shall return a 0 - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_cond_t cond; - int rc; - - /* Initialize a cond object */ - if((rc=pthread_cond_init(&cond,NULL)) != 0) { - fprintf(stderr,"Fail to initialize cond, rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - if((rc=pthread_cond_destroy(&cond)) == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - /* Check if returned values are tolerable */ - else if(rc == EBUSY) { - fprintf(stderr,"Detected an attempt to destroy a cond in use\n"); - return PTS_FAIL; - } - else if(rc == EINVAL) { - fprintf(stderr,"The value specified by 'cond' is invalid\n"); - return PTS_FAIL; - } - - /* Any other returned value means the test failed */ - else - { - printf("Test FAILED (error %i unexpected)\n", rc); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/assertions.xml deleted file mode 100644 index 2da4607d97..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/assertions.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - The function - int pthread_cond_destroy(pthread_cond_t *cond); - shall destroy the given condition variable specified by cond; - the object becomes, in effect, uninitialized. An implementation may cause pthread_cond_destroy() - to set the object referenced by cond to an invalid value. A destroyed condition variable object can - be reinitialized using pthread_cond_init(); the results of otherwise referencing the object after it - has been destroyed are undefined. - - - - It shall be safe to destroy an initialized condition variable upon which no threads are currently - blocked. Attempting to destroy a condition variable upon which other threads are currently - blocked results in undefined behavior. - - - - If successful, the pthread_cond_destroy() function shall return zero; - - - - The pthread_cond_destroy() function may fail if: - [EBUSY] The implementation has detected an attempt to destroy the object referenced - by cond while it is referenced (for example, while being used in a - pthread_cond_wait() or pthread_cond_timedwait( )) by another thread. - [EINVAL] The value specified by cond is invalid. - The function shall not return an error code of [EINTR]. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/coverage.txt deleted file mode 100644 index 6e56bdd0ba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_cond_destroy function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO * When it specifies it 'may' fail and not 'shall' fail, - it will always return PASS, but will return a - PASS and print out a warning if it fails. - * EBUSY is tested -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/speculative/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/speculative/4-1.c deleted file mode 100644 index d20f091628..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/speculative/4-1.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that when pthread_cond_destroy() - * is called on a cond that some thread is waiting, then it returns - * EBUSY - - * Steps: - * 1. Create a condvar - * 2. Create a thread and make it wait on the condvar - * 3. Try to destroy the cond var in main - * 4. Check that pthread_cond_destroy returns EBUSY - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "pthread_cond_destroy" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -/* cond used by the two threads */ -pthread_cond_t cond = PTHREAD_COND_INITIALIZER; - -/* cond used by the two threads */ -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - -void * thread(void *tmp) -{ - int rc = 0; - - /* acquire the mutex */ - rc = pthread_mutex_lock(&mutex); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_mutex_lock\n"); - exit(PTS_UNRESOLVED); - } - - /* Wait on the cond var. This will not return, as nobody signals*/ - rc = pthread_cond_wait(&cond, &mutex); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_cond_wait\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_mutex_unlock(&mutex); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_mutex_unlock\n"); - exit(PTS_UNRESOLVED); - } - return NULL; -} - -int main() -{ - pthread_t low_id; - int rc = 0; - - /* Create a new thread with default attributes */ - rc = pthread_create(&low_id, NULL, thread, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_create\n"); - exit(PTS_UNRESOLVED); - } - - /* Let the other thread run */ - sleep(2); - - /* Try to destroy the cond var. This should return an error */ - rc = pthread_cond_destroy(&cond); - if(rc != EBUSY) { - printf(ERROR_PREFIX "Test PASS: Expected %d(EBUSY) got %d, " - "though the standard states 'may' fail\n", EBUSY, rc); - - exit(PTS_PASS); - } - - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_destroy/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/1-1.c deleted file mode 100644 index 5095d1e60e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/1-1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_init() - * shall initialize the condition variable referenced by cond with attributes - * referenced by attr. If attr is NULL, the default condition variable attributes - * shall be used; the effect is the same as passing the address of a default - * condition variable attributes object. - - * NOTE: There is no direct way to judge if two condition variables are equal, - * so this test does not cover the statement in the last sentence. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_condattr_t condattr; - pthread_cond_t cond1, cond2; - int rc; - - /* Initialize a condition variable attributes object */ - if((rc=pthread_condattr_init(&condattr)) != 0) { - fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Initialize cond1 with the default condition variable attributes */ - if((rc=pthread_cond_init(&cond1,&condattr)) != 0) { - fprintf(stderr,"Fail to initialize cond1, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Initialize cond2 with NULL attributes */ - if((rc=pthread_cond_init(&cond2,NULL)) != 0) { - fprintf(stderr,"Fail to initialize cond2, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/1-2.c deleted file mode 100644 index b48de80778..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/1-2.c +++ /dev/null @@ -1,642 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * If attr is NULL, the effect is the same as passing the address - * of a default condition variable attributes object. - - * The steps are: - * -> Create two cond vars, one with NULL attribute and - * the other with a default attribute. - * -> Compare those two cond vars: - * -> If the Clock Selection option and the Timers option are supported, - * do both condvars use the same clock? - * (steps to do the comparison: - * - test whether the system supports the CS option - * - get the clock_id of the default cond attr - * - wait for the two conditions with a timeout of 3 days (for exemple) - * - set_time the clock_id at a later time than the timeout. - * - if the set_time fails, consider the feature as passed (how to test?) - * - if the set_time succeeds, check whether both conds have the same behavior. - * ) - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include /* we need the clock_settime routine */ - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -typedef struct -{ - pthread_mutex_t * pmtx; - pthread_cond_t * pcnd; - struct timespec * timeout; - unsigned short ctrl; - int rc; -} datatest_t; - -#define FLAG_TIMEDOUT (1 << 15) /* Will be set if the function exited with a timeout error */ -#define FLAG_AWAKEN (1 << 14) /* Will be set if the function exited with no error and the next flag was set */ -#define FLAG_CONDWAKE (1 << 13) /* the boolean associated with the condition */ -#define FLAG_INWAIT (1 << 12) /* Child thread got the mutex locked */ -#define MASK_COUNTER ((1 << 12) - 1) /* Those bits are reserved for a counter value */ - -datatest_t dtN; /* Data structure for the Null attribute condvar */ -datatest_t dtD; /* Data structure for the Default attribute condvar */ - -/**** - * test_timeout - * This function will receive a datatest_t argument. - * It will lock the mutex, then mark the control value. - * and enter a cond timedwait with the argument timeout. - */ -void * test_timeout(void * arg) -{ - int ret; - unsigned short cnt = 0; - datatest_t * dt = (datatest_t *)arg; - - /* lock the test mutex */ - ret = pthread_mutex_lock(dt->pmtx); - if (ret != 0) - { UNRESOLVED(ret, "Unable to lock mutex in test_timeout"); } - - /* Signal the parent thread that we are ready to wait */ - dt->ctrl |= FLAG_INWAIT; - - /* Enter the timed wait */ - do - { - dt->rc = pthread_cond_timedwait(dt->pcnd, dt->pmtx, dt->timeout); - cnt = dt->ctrl & MASK_COUNTER; - cnt++; - cnt &= MASK_COUNTER; - dt->ctrl &= ~MASK_COUNTER; - dt->ctrl += cnt; - } while ((dt->rc == 0) && ((dt->ctrl & FLAG_CONDWAKE) == 0)); - - /* Set the flags */ - if (dt->rc == 0) - { - dt->ctrl |= FLAG_AWAKEN; - } - if (dt->rc == ETIMEDOUT) - { - dt->ctrl |= FLAG_TIMEDOUT; - } - - /* Unlock the mutex and exit */ - ret = pthread_mutex_unlock(dt->pmtx); - if (ret != 0) - { UNRESOLVED(ret, "Unable to unlock the test mutex in test_timeout"); } - - return NULL; -} - -/**** - * do_cs_test - * This function will take care of the clock testing. - */ -int do_cs_test(void) -{ - int ret; - int result=0; - - pthread_condattr_t ca; - pthread_mutex_t mtxN, mtxD; - pthread_cond_t cndN, cndD; - - pthread_t thN, thD; - - struct timespec ts, timeout; - - clockid_t cid; - - /* The 3 next data aim to minimize the impact on the - * system time, when the monotonic clock is supported - */ - long monotonic_clk; - struct timespec diff; - char sens=0; - - /* We are going to initialize the cond vars and the mutexes */ - dtN.pmtx = &mtxN; - dtD.pmtx = &mtxD; - dtN.pcnd = &cndN; - dtD.pcnd = &cndD; - ret = pthread_mutex_init(&mtxD, NULL); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize a default mutex"); } - ret = pthread_mutex_init(&mtxN, NULL); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize a default mutex"); } - ret = pthread_condattr_init(&ca); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize cond attribute object"); } - ret = pthread_cond_init(&cndD, &ca); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize the default attribute conditional variable."); } -#if 0 /* Test if the testcase is valid: change the clock from the "NULL" cond var */ - pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - ret = pthread_cond_init(&cndN, &ca); - pthread_condattr_setclock(&ca, CLOCK_REALTIME); -#else - ret = pthread_cond_init(&cndN, NULL); -#endif - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize the NULL attribute conditional variable."); } - - dtD.ctrl = 0; - dtN.ctrl = 0; - dtD.rc = 0; - dtN.rc = 0; - - #if VERBOSE > 1 - output("Data initialized successfully for CS test.\n"); - #endif - - monotonic_clk = sysconf(_SC_MONOTONIC_CLOCK); - #if VERBOSE > 1 - output("Sysconf for monotonix clock: %li\n", monotonic_clk); - #endif - - /* Get the default clock ID */ - ret = pthread_condattr_getclock(&ca, &cid); - if (ret != 0) - { UNRESOLVED(ret, "Unable to get clockid from the default cond attribute object"); } - - /* Check whether we can set the system clock */ - - /* Backup the current monotonic time if available */ - if (monotonic_clk != -1L) - { - ret = clock_gettime(CLOCK_MONOTONIC, &diff); - if (ret != 0) - { - output("Clock_gettime(CLOCK_MONOTONIC) failed when the system claims to support this option\n"); - monotonic_clk = -1L; - } - } - ret = clock_gettime(cid, &ts); - if (ret != 0) - { UNRESOLVED(errno, "Unable to get clock time"); } - - - ret = clock_settime(cid, &ts); - if (ret != 0) - { - #if VERBOSE > 1 - output("clock_settime failed (%s)\n", strerror(errno)); - output("We cannot test if both cond uses the same clock then...\n"); - #endif - UNTESTED("Was unable to set the default clock time. Need more privileges?"); - } - else /* We can do the test */ - { - #if VERBOSE > 1 - output("clock_settime succeeded\n"); - #endif - - if (monotonic_clk != -1L) - { - #if VERBOSE > 2 - output("Monotonic clock : %10i.%09li\n", diff.tv_sec, diff.tv_nsec); - output("Default clock : %10i.%09li\n", ts.tv_sec, ts.tv_nsec); - #endif - /* Save the decay between default clock and clock MONOTONIC */ - if (diff.tv_sec > ts.tv_sec) - { - sens = -1; /* monotonic was bigger than system */ - if (diff.tv_nsec < ts.tv_nsec) - { - diff.tv_nsec += 1000000000 - ts.tv_nsec; - diff.tv_sec -= 1 + ts.tv_sec; - } - else - { - diff.tv_nsec -= ts.tv_nsec; - diff.tv_sec -= ts.tv_sec; - } - } - else - { - if (diff.tv_sec == ts.tv_sec) - { - diff.tv_sec = 0; - if (diff.tv_nsec > ts.tv_nsec) - { - sens = -1; - diff.tv_nsec -= ts.tv_nsec; - } - else - { - sens = 1; /* Default clock was bigger than monotonic */ - diff.tv_nsec = ts.tv_nsec - diff.tv_nsec; - } - } - else /* ts.tv_sec > diff.tv_sec */ - { - sens = 1; - if (ts.tv_nsec < diff.tv_nsec) - { - diff.tv_nsec = 1000000000 + ts.tv_nsec - diff.tv_nsec; - diff.tv_sec = ts.tv_sec - (1 + diff.tv_sec); - } - else - { - diff.tv_nsec = ts.tv_nsec - diff.tv_nsec; - diff.tv_sec = ts.tv_sec - diff.tv_sec; - } - } - } - - #if VERBOSE > 2 - output("Computed diff : %10i.%09li\n", diff.tv_sec, diff.tv_nsec); - output("With monotonic %s than default\n", sens>0?"smaller":"bigger"); - #endif - } - - /* Prepare the timeout parameters */ - timeout.tv_nsec = 0; - timeout.tv_sec = ts.tv_sec + 260000; /* About 3 days later */ - dtN.timeout = &timeout; - dtD.timeout = &timeout; - - /* create the threads */ - ret = pthread_create(&thD, NULL, test_timeout, &dtD); - if (ret != 0) - { UNRESOLVED(ret, "Unable to create a thread"); } - ret = pthread_create(&thN, NULL, test_timeout, &dtN); - if (ret != 0) - { UNRESOLVED(ret, "Unable to create a thread"); } - - /* Lock the two mutex and make sure the threads are in wait */ - ret = pthread_mutex_lock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - while ((dtN.ctrl & FLAG_INWAIT) == 0) - { - ret = pthread_mutex_unlock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - sched_yield(); - ret = pthread_mutex_lock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - } - ret = pthread_mutex_lock(&mtxD); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - while ((dtD.ctrl & FLAG_INWAIT) == 0) - { - ret = pthread_mutex_unlock(&mtxD); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - sched_yield(); - ret = pthread_mutex_lock(&mtxD); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - } - - /* Now both threads are in the timed wait */ - #if VERBOSE > 1 - output("Two threads are created and waiting.\n"); - output("About to change the default clock value.\n"); - #endif - - /* We re-read the default clock time, to introduce minimal error on the clock */ - ret = clock_gettime(cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to get clock time"); } - - ts.tv_sec += 604800; /* Exactly 1 week forth */ - - /* We set the clock to a date after the timeout parameter */ - ret = clock_settime(cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to set clock time (again)"); } - - /* unlock the two mutex */ - ret = pthread_mutex_unlock(&mtxD); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - ret = pthread_mutex_unlock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - - /* Let the others threads run */ - sched_yield(); - - #if VERBOSE > 1 - output("Checking that both threads have timedout...\n"); - #endif - - /* Relock the mutexs */ - ret = pthread_mutex_lock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - ret = pthread_mutex_lock(&mtxD); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - - /* Check whether the thread has timedout */ - if (dtD.rc == 0) - { - #if VERBOSE > 0 - output("The thread was not woken when the clock was changed so as the timeout expired\n"); - output("Going to simulate this POSIX behavior...\n"); - #endif - ret = pthread_cond_signal(&cndN); - if (ret != 0) { UNRESOLVED(ret, "Unable to signal the Null attribute condition"); } - ret = pthread_cond_signal(&cndD); - if (ret != 0) { UNRESOLVED(ret, "Unable to signal the Default attribute condition"); } - - /* The threads will now report a spurious wake up ... */ - - /* We give the threads another chance to timeout */ - /* unlock the two mutex */ - ret = pthread_mutex_unlock(&mtxD); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - ret = pthread_mutex_unlock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - - /* Let the others threads run */ - sched_yield(); - - #if VERBOSE > 1 - output("Rechecking that both threads have timedout...\n"); - #endif - - /* Relock the mutexs */ - ret = pthread_mutex_lock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - ret = pthread_mutex_lock(&mtxD); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - } - - - /* Process the Null condvar */ - if ((dtN.ctrl & FLAG_TIMEDOUT) != 0) - { - #if VERBOSE > 1 - output("Null attribute cond var timed out\n"); - #endif - /* Join the thread */ - ret = pthread_join(thN, NULL); - if (ret != 0) { UNRESOLVED(ret, "Join thread failed"); } - /* Unlock the mutex */ - ret = pthread_mutex_unlock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - } - else - { - #if VERBOSE > 1 - output("Null attribute cond var did not time out\n"); - #endif - /* Signal the condition */ - dtN.ctrl |= FLAG_CONDWAKE; - ret = pthread_cond_signal(&cndN); - if (ret != 0) { UNRESOLVED(ret, "Unable to signal the Null attribute condition"); } - /* Unlock the mutex and join the thread */ - ret = pthread_mutex_unlock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - /* Join the thread */ - ret = pthread_join(thN, NULL); - if (ret != 0) { UNRESOLVED(ret, "Join thread failed"); } - } - - /* Process the Default condvar */ - if ((dtD.ctrl & FLAG_TIMEDOUT) != 0) - { - #if VERBOSE > 1 - output("Default attribute cond var timed out\n"); - #endif - /* Join the thread */ - ret = pthread_join(thD, NULL); - if (ret != 0) { UNRESOLVED(ret, "Join thread failed"); } - /* Unlock the mutex */ - ret = pthread_mutex_unlock(&mtxD); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - } - else - { - #if VERBOSE > 1 - output("Default attribute cond var did not time out\n"); - #endif - /* Signal the condition */ - dtD.ctrl |= FLAG_CONDWAKE; - ret = pthread_cond_signal(&cndD); - if (ret != 0) { UNRESOLVED(ret, "Unable to signal the Default attribute condition"); } - /* Unlock the mutex and join the thread */ - ret = pthread_mutex_unlock(&mtxD); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - /* Join the thread */ - ret = pthread_join(thD, NULL); - if (ret != 0) { UNRESOLVED(ret, "Join thread failed"); } - } - - /* Set the system time back to its value */ - if (monotonic_clk == -1L) /* Monotonic is not supported */ - { - ret = clock_gettime(cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to get clock time"); } - - ts.tv_sec -= 604800; /* Exactly 1 week back */ - - /* We set the clock to a date after the timeout parameter */ - ret = clock_settime(cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to set clock time (3rd time)"); } - #if VERBOSE > 1 - output("Default clock was set back\n"); - #endif - } - else - { - /* Read the monotonic time */ - ret = clock_gettime(CLOCK_MONOTONIC, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to get monotonic clock time"); } - - /* Apply the difference back */ - if (sens > 0) /* monotonic was smaller than system => we must add the diff value */ - { - ts.tv_sec += diff.tv_sec; - ts.tv_nsec += diff.tv_nsec; - if (ts.tv_nsec >= 1000000000) - { - ts.tv_nsec -= 1000000000; - ts.tv_sec += 1; - } - } - else /* monotonic was bigger than system => we must remove the diff value */ - { - ts.tv_sec -= diff.tv_sec; - if (ts.tv_nsec < diff.tv_nsec) - { - ts.tv_sec -= 1; - ts.tv_nsec += 1000000000 - diff.tv_nsec; - } - else - { - ts.tv_nsec -= diff.tv_nsec; - } - } - - /* We set the clock to a date after the timeout parameter */ - ret = clock_settime(cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to set clock time (3rd time)"); } - - #if VERBOSE > 1 - output("Default clock was set back using monotonic clock as a reference\n"); - #endif - } - - /* Compare the two cond vars */ - #if VERBOSE > 2 - output("Default attribute cond var timedwait return value: %d\n", dtD.rc); - output("Default attribute cond var exited with a timeout : %s\n", (dtD.ctrl & FLAG_TIMEDOUT)?"yes":"no"); - output("Default attribute cond var had to be signaled : %s\n", (dtD.ctrl & FLAG_CONDWAKE)?"yes":"no"); - output("Default attribute cond var exited as signaled : %s\n", (dtD.ctrl & FLAG_AWAKEN)?"yes":"no"); - output("Default attribute cond var spurious wakeups : %d\n", (dtD.ctrl & MASK_COUNTER) - 1); - output(" Null attribute cond var timedwait return value: %d\n", dtN.rc); - output(" Null attribute cond var exited with a timeout : %s\n", (dtN.ctrl & FLAG_TIMEDOUT)?"yes":"no"); - output(" Null attribute cond var had to be signaled : %s\n", (dtN.ctrl & FLAG_CONDWAKE)?"yes":"no"); - output(" Null attribute cond var exited as signaled : %s\n", (dtN.ctrl & FLAG_AWAKEN)?"yes":"no"); - output(" Null attribute cond var spurious wakeups : %d\n", (dtN.ctrl & MASK_COUNTER) - 1); - #endif - if ((dtN.ctrl == dtD.ctrl) && (dtN.rc == dtD.rc)) - { - result = 0; - #if VERBOSE > 1 - output("The two cond vars behaved exactly in the same maneer\n"); - #endif - } - else - { - if ((dtN.ctrl & FLAG_TIMEDOUT) != (dtD.ctrl & FLAG_TIMEDOUT)) - { - result += 1; /* The test has failed */ - } - else - { - if (dtN.rc != dtD.rc) - { - output("Error codes were different: N:%d D:%d\n",dtN.rc, dtD.rc); - UNRESOLVED(dtN.rc>dtD.rc?dtN.rc:dtD.rc, "Different error codes?"); - } - if ((dtN.ctrl & FLAG_AWAKEN) == (dtD.ctrl & FLAG_AWAKEN)) - { - /* The number of spurious wakeups is different */ - output("Different spurious wakeups: N:%d D:%d\n", - (dtN.ctrl & MASK_COUNTER) - 1, - (dtD.ctrl & MASK_COUNTER) - 1); - - result = 0; /* We don't consider this as a fail case */ - } - } - } - } - - /* We can cleanup things now */ - ret = pthread_cond_destroy(&cndN); - if (ret != 0) - { UNRESOLVED(ret, "Cond destroy failed"); } - ret = pthread_cond_destroy(&cndD); - if (ret != 0) - { UNRESOLVED(ret, "Cond destroy failed"); } - ret = pthread_condattr_destroy(&ca); - if (ret != 0) - { UNRESOLVED(ret, "Cond attr destroy failed"); } - ret = pthread_mutex_destroy(&mtxN); - if (ret != 0) - { UNRESOLVED(ret, "Mutex destroy failed"); } - ret = pthread_mutex_destroy(&mtxD); - if (ret != 0) - { UNRESOLVED(ret, "Mutex destroy failed"); } - - return result; -} - -/**** - * Main function - */ -int main(int argc, char * argv[]) -{ - long opt_TMR, opt_CS; - int ret=0; - - output_init(); - - #if VERBOSE > 1 - output("Test starting...\n"); - #endif - - opt_TMR=sysconf(_SC_TIMERS); - opt_CS =sysconf(_SC_CLOCK_SELECTION); - - #if VERBOSE > 1 - output("Timers option : %li\n", opt_TMR); - output("Clock Selection option : %li\n", opt_CS); - #endif - - if ((opt_TMR != -1L) && (opt_CS != -1L)) - { - #if VERBOSE > 0 - output("Starting clock test\n"); - #endif - ret = do_cs_test(); - } - else - { - UNTESTED("This test requires unsupported features"); - } - if (ret != 0) - { FAILED("The cond vars use different clocks."); } - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/1-3.c deleted file mode 100644 index 944e3ee652..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/1-3.c +++ /dev/null @@ -1,899 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * If attr is NULL, the effect is the same as passing the address - * of a default condition variable attributes object. - - * The steps are: - * -> Create two cond vars, one with NULL attribute and - * the other with a default attribute. - * -> Compare those two cond vars: - * -> If the Thread Process-shared Synchronization is supported, - * does both condvars have the same behavior across - * different process? (Beware of the spurious wakeups). - * (Steps to achieve this goal: - * - Have the two cond vars created in shared memory. - * - The associated mutex are process-shared and in shared memory also. - * - Fork - * - One thread in parent process and one thread in child process - * wait for the cond. - * - Broadcast the cond from the parent process; - * then sleep for a while and check if the child process was awaken. - * - Do the same with the other condvar; then compare the result. - * ) - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mkstemp() routine - * - we could rewrite this test without this routine... - */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN - -/* The data shared between both processes */ -typedef struct -{ - pthread_mutex_t mtxN; /* Mutex for Null attr condvar */ - pthread_mutex_t mtxD; /* Mutex for Default attr condvar */ - pthread_mutex_t mtxP; /* Mutex for Pshared condvar */ - pthread_cond_t cndN; - pthread_cond_t cndD; - pthread_cond_t cndP; - int cntrN; - int cntrD; - int cntrP; - char bool; - sem_t semA; - sem_t semB; - int result; - pid_t child; -} globaldata_t; - -/* The data shared between the threads in the child process */ -typedef struct -{ - pthread_mutex_t * pmtx; - pthread_cond_t * pcnd; - int * pcntr; - char * pbool; - sem_t * psem; - pthread_t *pth; -} datatest_t; - -/* The data shared with the signal handlers in the child process */ -struct -{ - sem_t * psem; - pthread_t th[3]; -} sigdata; - -/**** - * The child threads signal handler. - * - */ -void childsighdl(int sig) -{ - int ret=0; - ret = sem_post(sigdata.psem); - if (ret != 0) - { UNRESOLVED(errno, "[child] Unable to post semaphore in thread signal handler"); } -} - -/**** - * The child main signal handler - * - */ -void mainsighdl(int sig) -{ - /* We assume this signal handler is never called before the sigdata structure is initialized */ - int ret = 0; - - ret = pthread_kill(sigdata.th[0], SIGUSR2); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to kill a child thread"); } - ret = pthread_kill(sigdata.th[1], SIGUSR2); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to kill a child thread"); } - ret = pthread_kill(sigdata.th[2], SIGUSR2); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to kill a child thread"); } -} - -/**** - * child_process_th - * Child process's thread function - * - */ -void * child_process_th(void * arg) -{ - int ret=0; - datatest_t * dt = (datatest_t *) arg; - struct sigaction sa; - - /* Register into the signal data structure */ - *(dt->pth) = pthread_self(); - - /* Set the signal action and mask for the child thread: Will call childsighdl when SIGUSR2 is received. */ - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = childsighdl; - ret = sigaction (SIGUSR2, &sa, NULL); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to register action for SIGUSR2"); } - - /* Any signal other than SIGUSR2 is blocked. */ - sigfillset(&sa.sa_mask); - sigdelset(&sa.sa_mask, SIGUSR2); - ret = pthread_sigmask (SIG_SETMASK, &sa.sa_mask, NULL); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to set signal mask in child thread"); } - - - /* lock the mutex */ - ret = pthread_mutex_lock(dt->pmtx); - if (ret != 0) - { UNRESOLVED(ret, "[child][th] Unable to lock mutex."); } - - /* We can now let the parent thread start its work */ - do { ret = sem_post(dt->psem); } - while ((ret != 0) && (errno == EINTR)); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to post semaphore"); } - - /* Now, do the actual test: wait for the cond */ - do - { - *(dt->pcntr) += 1; - ret = pthread_cond_wait(dt->pcnd, dt->pmtx); - *(dt->pcntr) += 1; - } while ((ret == 0) && (*(dt->pbool) == 0)); - - if (ret != 0) - { - #if VERBOSE > 1 - output("[child][thr] Unable to wait for the cond: %d - %s", ret, strerror(ret) ); - #endif - *(dt->pcntr) = 0; /* this will signal the parent thread that an error happened */ - } - - /* unlock the mutex */ - ret = pthread_mutex_unlock(dt->pmtx); - if (ret != 0) - { UNRESOLVED(ret, "[child][th] Unable to unlock mutex."); } - - return NULL; -} - -/**** - * child_process - * Child process main thread - * This function is called in the child process just after the fork. - */ -int child_process(globaldata_t * gd) -{ - int ret; - datatest_t dtN, dtD, dtP; - pthread_t thN, thD, thP; - - struct sigaction sa; - - /* Initialize the datatest structures for the sub threads */ - dtN.pmtx = &(gd->mtxN); - dtN.pcnd = &(gd->cndN); - dtN.pcntr = &(gd->cntrN); - dtN.pbool = &(gd->bool); - dtN.psem = &(gd->semA); - dtN.pth = &(sigdata.th[0]); - dtD.pmtx = &(gd->mtxD); - dtD.pcnd = &(gd->cndD); - dtD.pcntr = &(gd->cntrD); - dtD.pbool = &(gd->bool); - dtD.psem = &(gd->semA); - dtD.pth = &(sigdata.th[1]); - dtP.pmtx = &(gd->mtxP); - dtP.pcnd = &(gd->cndP); - dtP.pcntr = &(gd->cntrP); - dtP.pbool = &(gd->bool); - dtP.psem = &(gd->semA); - dtP.pth = &(sigdata.th[2]); - - sigdata.psem = &(gd->semA); - - /* Register the signal handler: mainsighdl will be called when this thread receives SIGUSR1 */ - sigemptyset (&sa.sa_mask); - sigaddset(&sa.sa_mask, SIGUSR2); - sa.sa_flags = 0; - sa.sa_handler = mainsighdl; - ret = sigaction (SIGUSR1, &sa, NULL); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to register action for SIGUSR1"); } - - /* Set this thread's signal mask: we only accept SIGUSR1 */ - sigfillset (&sa.sa_mask); - sigdelset(&sa.sa_mask, SIGUSR1); - ret = pthread_sigmask (SIG_SETMASK, &sa.sa_mask, NULL); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to set signal mask in child main thread"); } - - /* We start the test threads */ - ret = pthread_create(&thN, NULL, child_process_th, &dtN); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to create thread N"); } - - ret = pthread_create(&thD, NULL, child_process_th, &dtD); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to create thread D"); } - - ret = pthread_create(&thP, NULL, child_process_th, &dtP); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to create thread P"); } - - /* We wait for the parent process to let us signal the conditions */ - do { ret = sem_wait(&(gd->semB)); } - while ((ret != 0) && (errno == EINTR)); - if (ret != 0) - { UNRESOLVED(errno, "[child] Unable to wait for semaphore B"); } - - /* Now signal both conditions. Changing the boolean was carried on by the parent */ - ret = pthread_cond_signal(&(gd->cndN)); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to signal cond N"); } - - ret = pthread_cond_signal(&(gd->cndD)); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to signal cond D"); } - - ret = pthread_cond_signal(&(gd->cndP)); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to signal cond P"); } - - /* Nothing more to do until the threads terminate */ - ret = pthread_join(thN, NULL); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to join the thread N"); } - - ret = pthread_join(thD, NULL); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to join the thread D"); } - - ret = pthread_join(thP, NULL); - if (ret != 0) - { UNRESOLVED(ret, "[child] Unable to join the thread P"); } - - return 0; -} - -/**** - * parent_process - * This function is called in the parent process just after the fork. - * Don't call the UNRESOLVED macro here as it would orphan the child thread! - * Instead, the macro LOC_URSLVD(x, s) is provided. The usage is the same. - */ -#define LOC_URSLVD(x,s) \ -{ \ - output("UNRESOLVED:\n Got error %d - %s\n with message %s\n", x, strerror(x), s); \ - gd->bool = 1; \ - ret = sem_post(&(gd->semB)); \ - if (ret != 0) \ - { \ - kill(gd->child, SIGKILL); \ - /* If the call fails, this probably means the process is already dead */ \ - } \ - return x; \ -} - -int parent_process(globaldata_t * gd) -{ - int ret, tmp, i; - - /* Wait for the child to be ready */ - ret = sem_wait(&(gd->semA)); - if (ret != 0) - { LOC_URSLVD(errno,"[parent] Unable to wait for sem A (1)"); } - - ret = sem_wait(&(gd->semA)); - if (ret != 0) - { LOC_URSLVD(errno,"[parent] Unable to wait for sem A (2)"); } - - ret = sem_wait(&(gd->semA)); - if (ret != 0) - { LOC_URSLVD(errno,"[parent] Unable to wait for sem A (3)"); } - - #if VERBOSE > 1 - output("[parent] Threads are ready...\n"); - #endif - - /* Now let the threads either enter the wait or exit if an error occured */ - ret = pthread_mutex_lock(&(gd->mtxN)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to lock mutex N"); } - - ret = pthread_mutex_lock(&(gd->mtxD)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to lock mutex D"); } - - ret = pthread_mutex_lock(&(gd->mtxP)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to lock mutex P"); } - - if (gd->cntrP == 0) - { - /* There was an unexpected error */ - LOC_URSLVD(0,"[parent] The pshared condvar reported an error"); - } - /* Check the threads status */ - if ((gd->cntrN == 0) && (gd->cntrD == 0)) /* Both threads got an error */ - { - /* the test has passed */ - gd->result = 0; - } - if ((gd->cntrN == 0) && (gd->cntrD != 0)) /* thread N got an error */ - { - /* the test has failed */ - gd->result = gd->cntrD; - } - if ((gd->cntrN != 0) && (gd->cntrD == 0)) /* thread D got an error */ - { - /* the test has failed */ - gd->result = gd->cntrN; - } - if ((gd->cntrN != 0) && (gd->cntrD != 0)) /* Neither thread got an error - we can test further */ - { - #if VERBOSE > 1 - output("[parent] Both threads are waiting for the condition right now.\n"); - #endif - - /* We can unlock the mutexs so the threads can go out from pthread_cond_wait */ - ret = pthread_mutex_unlock(&(gd->mtxN)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to unlock mutex N"); } - - ret = pthread_mutex_unlock(&(gd->mtxD)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to unlock mutex D"); } - - ret = pthread_mutex_unlock(&(gd->mtxP)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to unlock mutex P"); } - - for (i=0; i<100; i++) - { - /* We try to signal the conditions */ - tmp = pthread_cond_signal(&(gd->cndN)); - ret = pthread_cond_signal(&(gd->cndD)); - if (ret != tmp) - { LOC_URSLVD(ret>tmp?ret:tmp, "[parent] Signaling the conditions give different error codes"); } - #if VERBOSE > 1 - if (i==0) - { - output("[parent] Signaling the condition returned %d for both condvar\n", ret); - } - #endif - ret = pthread_cond_signal(&(gd->cndP)); - if (ret != 0) - { LOC_URSLVD(ret, "[parent] Signaling the pshared condition failed"); } - - - /* Make sure the child process's threads were scheduled */ - /* We kill it and wait for both threads to have the signal handled. - This will mean the threads were scheduled */ - ret = kill(gd->child, SIGUSR1); - if (ret != 0) - { LOC_URSLVD(errno, "[parent] Killing child thread with USR1 failed"); } - - ret = sem_wait(&(gd->semA)); - if (ret != 0) - { LOC_URSLVD(errno,"[parent] Unable to wait for sem A (4)"); } - - ret = sem_wait(&(gd->semA)); - if (ret != 0) - { LOC_URSLVD(errno,"[parent] Unable to wait for sem A (5)"); } - - ret = sem_wait(&(gd->semA)); - if (ret != 0) - { LOC_URSLVD(errno,"[parent] Unable to wait for sem A (6)"); } - - sched_yield(); - - /* We try to broadcast the conditions */ - tmp = pthread_cond_broadcast(&(gd->cndN)); - ret = pthread_cond_broadcast(&(gd->cndD)); - if (ret != tmp) - { LOC_URSLVD(ret>tmp?ret:tmp, "[parent] Broadcasting the conditions give different error codes"); } - #if VERBOSE > 1 - if (i==0) - { - output("[parent] Broadcasting the condition returned %d for both condvar\n", tmp); - } - #endif - ret = pthread_cond_broadcast(&(gd->cndP)); - if (ret != 0) - { LOC_URSLVD(ret, "[parent] Broadcasting the pshared conditions failed"); } - - /* Make sure the child process's threads were scheduled */ - /* We kill it and wait for both threads to have the signal handled. - This will mean the threads were scheduled */ - ret = kill(gd->child, SIGUSR1); - if (ret != 0) - { LOC_URSLVD(errno, "[parent] Killing child thread with USR1 failed"); } - - ret = sem_wait(&(gd->semA)); - if (ret != 0) - { LOC_URSLVD(errno,"[parent] Unable to wait for sem A (7)"); } - - ret = sem_wait(&(gd->semA)); - if (ret != 0) - { LOC_URSLVD(errno,"[parent] Unable to wait for sem A (8)"); } - - ret = sem_wait(&(gd->semA)); - if (ret != 0) - { LOC_URSLVD(errno,"[parent] Unable to wait for sem A (9)"); } - - sched_yield(); - } - - - /* Now we relock the mutexes */ - ret = pthread_mutex_lock(&(gd->mtxN)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to lock mutex N"); } - - ret = pthread_mutex_lock(&(gd->mtxD)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to lock mutex D"); } - - ret = pthread_mutex_lock(&(gd->mtxP)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to lock mutex P"); } - - /* We compare the counters values */ - if (gd->cntrP == 0) - { LOC_URSLVD(0, "[parent] The pshared condvar failed"); } - - if ((gd->cntrN == 0) && (gd->cntrD == 0)) - { - #if VERBOSE > 1 - output("[parent] Both cond wait have failed\n"); - #endif - gd->result = 0; /* The test has passed */ - } - if ((gd->cntrN == 0) && (gd->cntrD != 0)) - { - #if VERBOSE > 1 - output("[parent] cond wait has failed for N\n"); - #endif - gd->result = gd->cntrD; /* The test has failed */ - } - if ((gd->cntrN != 0) && (gd->cntrD == 0)) - { - #if VERBOSE > 1 - output("[parent] cond wait has failed for D\n"); - #endif - gd->result = gd->cntrN; /* The test has failed */ - } - if ((gd->cntrN != 0) && (gd->cntrD != 0)) /* None of the condwait returned an error */ - { - if (((gd->cntrN & 1) != 1) || ((gd->cntrD & 1) != 1)) - { - output("N:%d D:%d\n",gd->cntrN,gd->cntrD); - LOC_URSLVD((gd->cntrN & 1)?gd->cntrD:gd->cntrN,"[parent] Even counter - pshared mutex failure"); - } - - gd->result = 0; - - #if VERBOSE > 1 - output("[parent] Reports:\n"); - output("[parent] Process-shared condvar was awaken : %i times (reference)\n", gd->cntrP >> 1); - output("[parent] Null attribute condvar was awaken : %i times\n", gd->cntrN >> 1); - output("[parent] Default attr. condvar was awaken : %i times\n", gd->cntrD >> 1); - #endif - - if ((gd->cntrN == gd->cntrP) && (gd->cntrD != gd->cntrP)) - { - #if VERBOSE > 1 - output("[parent] Null condvar seems to be process-shared while Default condvar seems not\n"); - #endif - gd->result = gd->cntrD; - } - if ((gd->cntrN != gd->cntrP) && (gd->cntrD == gd->cntrP)) - { - #if VERBOSE > 1 - output("[parent] Default condvar seems to be process-shared while Null condvar seems not\n"); - #endif - gd->result = gd->cntrN; - } - - } - } - - #if VERBOSE > 1 - output("[parent] Threads tests are finished, about to stop them...\n"); - #endif - gd->bool = 1; /* the threads can now terminate */ - - ret = pthread_mutex_unlock(&(gd->mtxN)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to unlock mutex N"); } - - ret = pthread_mutex_unlock(&(gd->mtxD)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to unlock mutex D"); } - - ret = pthread_mutex_unlock(&(gd->mtxP)); - if (ret != 0) - { LOC_URSLVD(ret,"[parent] Unable to unlock mutex P"); } - - /* Let the child thread terminate */ - ret = sem_post(&(gd->semB)); - if (ret != 0) - { LOC_URSLVD(errno, "[parent] Failed to post the semaphore B"); } - - return 0; -} - -/**** - * do_tps_test - * This function will take care of testing the condvars - * when shared between processes. - */ -int do_tps_test(void) -{ - int ret=0; - globaldata_t * gd; - pthread_condattr_t ca; - pthread_mutexattr_t ma; - pid_t wrc, child; - - size_t sz; - char filename[] = "/tmp/cond_init_1-3-XXXXXX"; - void * mmaped; - char * tmp; - int fd; - - int status; - int rc2; - - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - sz= (size_t)sysconf(_SC_PAGESIZE); - - tmp = calloc(1, sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - gd = (globaldata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Shared memory created successfully.\n"); - output("Initializing data...\n"); - #endif - - /* Initialize the objects attributes */ - ret = pthread_mutexattr_init(&ma); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize mutex attribute object"); } - - ret = pthread_condattr_init(&ca); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize condvar attribute object"); } - - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) - { UNRESOLVED(ret, "Unable to set the mutex attribute as process shared"); } - - /* Initialize the synchronization objects */ - ret = pthread_mutex_init(&(gd->mtxN), &ma); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize the mutex N in shared memory"); } - - ret = pthread_mutex_init(&(gd->mtxD), &ma); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize the mutex D in shared memory"); } - - ret = pthread_mutex_init(&(gd->mtxP), &ma); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize the mutex P in shared memory"); } - - /* we don't need the mutex attribute object anymore */ - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) - { UNRESOLVED(ret, "Unable to destroy the mutex attribute object"); } - - /* Now we'll initialize the cond vars */ - ret = pthread_cond_init(&(gd->cndN), NULL); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize the Null attribute condvar"); } - - ret = pthread_cond_init(&(gd->cndD), &ca); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize the Default attribute condvar"); } - - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) - { UNRESOLVED(ret, "Unable to set the cond attribute as process shared"); } - - ret = pthread_cond_init(&(gd->cndP), &ca); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize the Pshared condvar"); } - - ret = pthread_condattr_destroy(&ca); - if (ret != 0) - { UNRESOLVED(ret, "Unable to destroy the condvar attribute object"); } - - /* We initialize the other values in the test structure */ - gd->cntrN = 0; - gd->cntrD = 0; - gd->cntrP = 0; - gd->bool = 0; - gd->result = 0; - ret = sem_init(&(gd->semA), 1, 0); - if (ret != 0) - { UNRESOLVED(errno, "Unable to initialize semaphore A"); } - - ret = sem_init(&(gd->semB), 1, 0); - if (ret != 0) - { UNRESOLVED(errno, "Unable to initialize semaphore B"); } - - /* Initializations are OK */ - #if VERBOSE > 1 - output("All initializations OK, proceed to the test (fork).\n"); - #endif - - child = fork(); - if (child == -1) - { UNRESOLVED(errno, "Fork failed"); } - - if (child == 0) - { - /* We are the child */ - ret = child_process(gd); - #if VERBOSE > 1 - output("[child] Test function returned %d.\n", ret); - #endif - exit(ret); - } - - /* We are the parent */ - gd->child = child; - rc2 = parent_process(gd); - #if VERBOSE > 1 - output("[parent] Test function returned %d.\n", rc2); - #endif - - /* In any case we must wait for the child */ - wrc = waitpid(child, &status, 0); - if (wrc != child) - { - output("Expected pid: %i. Got %i\n", (int)child, (int)wrc); - UNRESOLVED(errno, "Waitpid failed"); - } - - if (WIFSIGNALED(status)) - { - output("Child process killed with signal %d\n",WTERMSIG(status)); - UNRESOLVED( rc2 , "Child process was killed"); - } - - if (WIFEXITED(status)) - { - ret = WEXITSTATUS(status); - } - else - { - UNRESOLVED( rc2, "Child process was neither killed nor exited"); - } - - #if VERBOSE > 1 - output("[parent] Successfully waited for child process.\n"); - #endif - - /* The return value from the parent is in 'rc2' and - * 'ret' contains the child return code. - * The test status is in gd->result - */ - if (rc2 != 0) - { - UNRESOLVED(ret, "Parent process failed"); - } - - if (ret != 0) - { - UNRESOLVED(ret, "Child process failed"); - } - - #if VERBOSE > 1 - output("Destroying the data.\n"); - #endif - - /* We can now destroy all the datas */ - ret = sem_destroy(&(gd->semB)); - if (ret != 0) - { UNRESOLVED(errno, "Unable to destroy the semaphore B"); } - - ret = sem_destroy(&(gd->semA)); - if (ret != 0) - { UNRESOLVED(errno, "Unable to destroy the semaphore A"); } - - ret = pthread_cond_destroy(&(gd->cndP)); - if (ret != 0) - { UNRESOLVED(ret, "Unable to destroy the P condvar"); } - - ret = pthread_cond_destroy(&(gd->cndD)); - if (ret != 0) - { UNRESOLVED(ret, "Unable to destroy the D condvar"); } - - ret = pthread_cond_destroy(&(gd->cndN)); - if (ret != 0) - { UNRESOLVED(ret, "Unable to destroy the N condvar"); } - - ret = pthread_mutex_destroy(&(gd->mtxP)); - if (ret != 0) - { UNRESOLVED(ret, "Unable to destroy the P mutex"); } - - ret = pthread_mutex_destroy(&(gd->mtxD)); - if (ret != 0) - { UNRESOLVED(ret, "Unable to destroy the D mutex"); } - - ret = pthread_mutex_destroy(&(gd->mtxN)); - if (ret != 0) - { UNRESOLVED(ret, "Unable to destroy the N mutex"); } - - rc2 = gd->result; - - #if VERBOSE > 1 - output("Unmapping shared memory.\n"); - #endif - - ret = munmap(mmaped, sz); - if (ret != 0) - { UNRESOLVED(errno, "Memory unmapping failed"); } - - return rc2; -} - -/**** - * Main function - * This one is responsible for executing the previous functions - * according to the supported features. - */ -int main(int argc, char * argv[]) -{ - long opt_TPS, opt_MF; - int ret=0; - - output_init(); - - #if VERBOSE > 1 - output("Test starting...\n"); - #endif - - opt_MF =sysconf(_SC_MAPPED_FILES); - opt_TPS=sysconf(_SC_THREAD_PROCESS_SHARED); - - #if VERBOSE > 1 - output("Memory Mapped Files option : %li\n", opt_MF); - output("Thread Process-shared Synchronization option: %li\n", opt_TPS); - #endif - - if ((opt_TPS != -1L) && (opt_MF != -1L)) - { - #if VERBOSE > 0 - output("Starting process test\n"); - #endif - ret = do_tps_test(); - } - else - { - UNTESTED("This test requires unsupported features"); - } - - if (ret != 0) - { FAILED("The cond vars behave differently across processes."); } - - #if VERBOSE > 1 - output("Test terminated successfully\n"); - #endif - - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/2-1.c deleted file mode 100644 index 564b0308fa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/2-1.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the macro PTHREAD_COND_INITIALIZER can be used to intiailize - * condition variables that are statically allocated. - * - */ - -#include -#include -#include -#include "posixtest.h" - -pthread_cond_t cond = PTHREAD_COND_INITIALIZER; - -int main() -{ - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/2-2.c deleted file mode 100644 index d7bfc422a6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/2-2.c +++ /dev/null @@ -1,641 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * If attr is NULL, the effect is the same as passing the address - * of a default condition variable attributes object. - - * The steps are: - * -> Create two cond vars, one with NULL attribute and - * the other with a default attribute. - * -> Compare those two cond vars: - * -> If the Clock Selection option and the Timers option are supported, - * do both condvars use the same clock? - * (steps to do the comparison: - * - test whether the system supports the CS option - * - get the clock_id of the default cond attr - * - wait for the two conditions with a timeout of 3 days (for exemple) - * - set_time the clock_id at a later time than the timeout. - * - if the set_time fails, consider the feature as passed (how to test?) - * - if the set_time succeeds, check whether both conds have the same behavior. - * ) - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include /* we need the clock_settime routine */ - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -typedef struct -{ - pthread_mutex_t * pmtx; - pthread_cond_t * pcnd; - struct timespec * timeout; - unsigned short ctrl; - int rc; -} datatest_t; - -#define FLAG_TIMEDOUT (1 << 15) /* Will be set if the function exited with a timeout error */ -#define FLAG_AWAKEN (1 << 14) /* Will be set if the function exited with no error and the next flag was set */ -#define FLAG_CONDWAKE (1 << 13) /* the boolean associated with the condition */ -#define FLAG_INWAIT (1 << 12) /* Child thread got the mutex locked */ -#define MASK_COUNTER ((1 << 12) - 1) /* Those bits are reserved for a counter value */ - -datatest_t dtN; /* Data structure for the Null attribute condvar */ -datatest_t dtI; /* Data structure for the Initializer condvar */ - -/**** - * test_timeout - * This function will receive a datatest_t argument. - * It will lock the mutex, then mark the control value. - * and enter a cond timedwait with the argument timeout. - */ -void * test_timeout(void * arg) -{ - int ret; - unsigned short cnt = 0; - datatest_t * dt = (datatest_t *)arg; - - /* lock the test mutex */ - ret = pthread_mutex_lock(dt->pmtx); - if (ret != 0) - { UNRESOLVED(ret, "Unable to lock mutex in test_timeout"); } - - /* Signal the parent thread that we are ready to wait */ - dt->ctrl |= FLAG_INWAIT; - - /* Enter the timed wait */ - do - { - dt->rc = pthread_cond_timedwait(dt->pcnd, dt->pmtx, dt->timeout); - cnt = dt->ctrl & MASK_COUNTER; - cnt++; - cnt &= MASK_COUNTER; - dt->ctrl &= ~MASK_COUNTER; - dt->ctrl += cnt; - } while ((dt->rc == 0) && ((dt->ctrl & FLAG_CONDWAKE) == 0)); - - /* Set the flags */ - if (dt->rc == 0) - { - dt->ctrl |= FLAG_AWAKEN; - } - if (dt->rc == ETIMEDOUT) - { - dt->ctrl |= FLAG_TIMEDOUT; - } - - /* Unlock the mutex and exit */ - ret = pthread_mutex_unlock(dt->pmtx); - if (ret != 0) - { UNRESOLVED(ret, "Unable to unlock the test mutex in test_timeout"); } - - return NULL; -} - -/**** - * do_cs_test - * This function will take care of the clock testing. - */ - -pthread_cond_t cndI = PTHREAD_COND_INITIALIZER; - -int do_cs_test(void) -{ - int ret; - int result=0; - - pthread_mutex_t mtxN, mtxI; - pthread_cond_t cndN; - - pthread_condattr_t ca; - - pthread_t thN, thD; - - struct timespec ts, timeout; - - clockid_t cid; - - /* The 3 next data aim to minimize the impact on the - * system time, when the monotonic clock is supported - */ - long monotonic_clk; - struct timespec diff; - char sens=0; - - /* We are going to initialize the cond vars and the mutexes */ - dtN.pmtx = &mtxN; - dtI.pmtx = &mtxI; - dtN.pcnd = &cndN; - dtI.pcnd = &cndI; - ret = pthread_mutex_init(&mtxI, NULL); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize a default mutex"); } - ret = pthread_mutex_init(&mtxN, NULL); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize a default mutex"); } - ret = pthread_condattr_init(&ca); - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize cond attribute object"); } - -#if 0 /* Test if the testcase is valid: change the clock from the "NULL" cond var */ - pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - ret = pthread_cond_init(&cndN, &ca); - pthread_condattr_setclock(&ca, CLOCK_REALTIME); -#else - ret = pthread_cond_init(&cndN, NULL); -#endif - if (ret != 0) - { UNRESOLVED(ret, "Unable to initialize the NULL attribute conditional variable."); } - - dtI.ctrl = 0; - dtN.ctrl = 0; - dtI.rc = 0; - dtN.rc = 0; - - #if VERBOSE > 1 - output("Data initialized successfully for CS test.\n"); - #endif - - monotonic_clk = sysconf(_SC_MONOTONIC_CLOCK); - #if VERBOSE > 1 - output("Sysconf for monotonix clock: %li\n", monotonic_clk); - #endif - - /* Get the default clock ID */ - ret = pthread_condattr_getclock(&ca, &cid); - if (ret != 0) - { UNRESOLVED(ret, "Unable to get clockid from the default cond attribute object"); } - - /* Check whether we can set the system clock */ - - /* Backup the current monotonic time if available */ - if (monotonic_clk != -1L) - { - ret = clock_gettime(CLOCK_MONOTONIC, &diff); - if (ret != 0) - { - output("Clock_gettime(CLOCK_MONOTONIC) failed when the system claims to support this option\n"); - monotonic_clk = -1L; - } - } - ret = clock_gettime(cid, &ts); - if (ret != 0) - { UNRESOLVED(errno, "Unable to get clock time"); } - - - ret = clock_settime(cid, &ts); - if (ret != 0) - { - #if VERBOSE > 1 - output("clock_settime failed (%s)\n", strerror(errno)); - output("We cannot test if both cond uses the same clock then...\n"); - #endif - UNTESTED("Was unable to set the default clock time. Need more privileges?"); - } - else /* We can do the test */ - { - #if VERBOSE > 1 - output("clock_settime succeeded\n"); - #endif - - if (monotonic_clk != -1L) - { - #if VERBOSE > 2 - output("Monotonic clock : %10i.%09li\n", diff.tv_sec, diff.tv_nsec); - output("Default clock : %10i.%09li\n", ts.tv_sec, ts.tv_nsec); - #endif - /* Save the decay between default clock and clock MONOTONIC */ - if (diff.tv_sec > ts.tv_sec) - { - sens = -1; /* monotonic was bigger than system */ - if (diff.tv_nsec < ts.tv_nsec) - { - diff.tv_nsec += 1000000000 - ts.tv_nsec; - diff.tv_sec -= 1 + ts.tv_sec; - } - else - { - diff.tv_nsec -= ts.tv_nsec; - diff.tv_sec -= ts.tv_sec; - } - } - else - { - if (diff.tv_sec == ts.tv_sec) - { - diff.tv_sec = 0; - if (diff.tv_nsec > ts.tv_nsec) - { - sens = -1; - diff.tv_nsec -= ts.tv_nsec; - } - else - { - sens = 1; /* Default clock was bigger than monotonic */ - diff.tv_nsec = ts.tv_nsec - diff.tv_nsec; - } - } - else /* ts.tv_sec > diff.tv_sec */ - { - sens = 1; - if (ts.tv_nsec < diff.tv_nsec) - { - diff.tv_nsec = 1000000000 + ts.tv_nsec - diff.tv_nsec; - diff.tv_sec = ts.tv_sec - (1 + diff.tv_sec); - } - else - { - diff.tv_nsec = ts.tv_nsec - diff.tv_nsec; - diff.tv_sec = ts.tv_sec - diff.tv_sec; - } - } - } - - #if VERBOSE > 2 - output("Computed diff : %10i.%09li\n", diff.tv_sec, diff.tv_nsec); - output("With monotonic %s than default\n", sens>0?"smaller":"bigger"); - #endif - } - - /* Prepare the timeout parameters */ - timeout.tv_nsec = 0; - timeout.tv_sec = ts.tv_sec + 260000; /* About 3 days later */ - dtN.timeout = &timeout; - dtI.timeout = &timeout; - - /* create the threads */ - ret = pthread_create(&thD, NULL, test_timeout, &dtI); - if (ret != 0) - { UNRESOLVED(ret, "Unable to create a thread"); } - ret = pthread_create(&thN, NULL, test_timeout, &dtN); - if (ret != 0) - { UNRESOLVED(ret, "Unable to create a thread"); } - - /* Lock the two mutex and make sure the threads are in wait */ - ret = pthread_mutex_lock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - while ((dtN.ctrl & FLAG_INWAIT) == 0) - { - ret = pthread_mutex_unlock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - sched_yield(); - ret = pthread_mutex_lock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - } - ret = pthread_mutex_lock(&mtxI); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - while ((dtI.ctrl & FLAG_INWAIT) == 0) - { - ret = pthread_mutex_unlock(&mtxI); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - sched_yield(); - ret = pthread_mutex_lock(&mtxI); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - } - - /* Now both threads are in the timed wait */ - #if VERBOSE > 1 - output("Two threads are created and waiting.\n"); - output("About to change the default clock value.\n"); - #endif - - /* We re-read the default clock time, to introduce minimal error on the clock */ - ret = clock_gettime(cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to get clock time"); } - - ts.tv_sec += 604800; /* Exactly 1 week forth */ - - /* We set the clock to a date after the timeout parameter */ - ret = clock_settime(cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to set clock time (again)"); } - - /* unlock the two mutex */ - ret = pthread_mutex_unlock(&mtxI); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - ret = pthread_mutex_unlock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - - /* Let the others threads run */ - sched_yield(); - - #if VERBOSE > 1 - output("Checking that both threads have timedout...\n"); - #endif - - /* Relock the mutexs */ - ret = pthread_mutex_lock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - ret = pthread_mutex_lock(&mtxI); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - - /* Check whether the thread has timedout */ - if (dtI.rc == 0) - { - #if VERBOSE > 0 - output("The thread was not woken when the clock was changed so as the timeout expired\n"); - output("Going to simulate this POSIX behavior...\n"); - #endif - ret = pthread_cond_signal(&cndN); - if (ret != 0) { UNRESOLVED(ret, "Unable to signal the Null attribute condition"); } - ret = pthread_cond_signal(&cndI); - if (ret != 0) { UNRESOLVED(ret, "Unable to signal the Default attribute condition"); } - - /* The threads will now report a spurious wake up ... */ - - /* We give the threads another chance to timeout */ - /* unlock the two mutex */ - ret = pthread_mutex_unlock(&mtxI); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - ret = pthread_mutex_unlock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - - /* Let the others threads run */ - sched_yield(); - - #if VERBOSE > 1 - output("Rechecking that both threads have timedout...\n"); - #endif - - /* Relock the mutexs */ - ret = pthread_mutex_lock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - ret = pthread_mutex_lock(&mtxI); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock a mutex"); } - } - - - /* Process the Null condvar */ - if ((dtN.ctrl & FLAG_TIMEDOUT) != 0) - { - #if VERBOSE > 1 - output("Null attribute cond var timed out\n"); - #endif - /* Join the thread */ - ret = pthread_join(thN, NULL); - if (ret != 0) { UNRESOLVED(ret, "Join thread failed"); } - /* Unlock the mutex */ - ret = pthread_mutex_unlock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - } - else - { - #if VERBOSE > 1 - output("Null attribute cond var did not time out\n"); - #endif - /* Signal the condition */ - dtN.ctrl |= FLAG_CONDWAKE; - ret = pthread_cond_signal(&cndN); - if (ret != 0) { UNRESOLVED(ret, "Unable to signal the Null attribute condition"); } - /* Unlock the mutex and join the thread */ - ret = pthread_mutex_unlock(&mtxN); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - /* Join the thread */ - ret = pthread_join(thN, NULL); - if (ret != 0) { UNRESOLVED(ret, "Join thread failed"); } - } - - /* Process the Default condvar */ - if ((dtI.ctrl & FLAG_TIMEDOUT) != 0) - { - #if VERBOSE > 1 - output("Default attribute cond var timed out\n"); - #endif - /* Join the thread */ - ret = pthread_join(thD, NULL); - if (ret != 0) { UNRESOLVED(ret, "Join thread failed"); } - /* Unlock the mutex */ - ret = pthread_mutex_unlock(&mtxI); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - } - else - { - #if VERBOSE > 1 - output("Default attribute cond var did not time out\n"); - #endif - /* Signal the condition */ - dtI.ctrl |= FLAG_CONDWAKE; - ret = pthread_cond_signal(&cndI); - if (ret != 0) { UNRESOLVED(ret, "Unable to signal the Default attribute condition"); } - /* Unlock the mutex and join the thread */ - ret = pthread_mutex_unlock(&mtxI); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock a mutex"); } - /* Join the thread */ - ret = pthread_join(thD, NULL); - if (ret != 0) { UNRESOLVED(ret, "Join thread failed"); } - } - - /* Set the system time back to its value */ - if (monotonic_clk == -1L) /* Monotonic is not supported */ - { - ret = clock_gettime(cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to get clock time"); } - - ts.tv_sec -= 604800; /* Exactly 1 week back */ - - /* We set the clock to a date after the timeout parameter */ - ret = clock_settime(cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to set clock time (3rd time)"); } - #if VERBOSE > 1 - output("Default clock was set back\n"); - #endif - } - else - { - /* Read the monotonic time */ - ret = clock_gettime(CLOCK_MONOTONIC, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to get monotonic clock time"); } - - /* Apply the difference back */ - if (sens > 0) /* monotonic was smaller than system => we must add the diff value */ - { - ts.tv_sec += diff.tv_sec; - ts.tv_nsec += diff.tv_nsec; - if (ts.tv_nsec >= 1000000000) - { - ts.tv_nsec -= 1000000000; - ts.tv_sec += 1; - } - } - else /* monotonic was bigger than system => we must remove the diff value */ - { - ts.tv_sec -= diff.tv_sec; - if (ts.tv_nsec < diff.tv_nsec) - { - ts.tv_sec -= 1; - ts.tv_nsec += 1000000000 - diff.tv_nsec; - } - else - { - ts.tv_nsec -= diff.tv_nsec; - } - } - - /* We set the clock to a date after the timeout parameter */ - ret = clock_settime(cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to set clock time (3rd time)"); } - - #if VERBOSE > 1 - output("Default clock was set back using monotonic clock as a reference\n"); - #endif - } - - /* Compare the two cond vars */ - #if VERBOSE > 2 - output("Default attribute cond var timedwait return value: %d\n", dtI.rc); - output("Default attribute cond var exited with a timeout : %s\n", (dtI.ctrl & FLAG_TIMEDOUT)?"yes":"no"); - output("Default attribute cond var had to be signaled : %s\n", (dtI.ctrl & FLAG_CONDWAKE)?"yes":"no"); - output("Default attribute cond var exited as signaled : %s\n", (dtI.ctrl & FLAG_AWAKEN)?"yes":"no"); - output("Default attribute cond var spurious wakeups : %d\n", (dtI.ctrl & MASK_COUNTER) - 1); - output(" Null attribute cond var timedwait return value: %d\n", dtN.rc); - output(" Null attribute cond var exited with a timeout : %s\n", (dtN.ctrl & FLAG_TIMEDOUT)?"yes":"no"); - output(" Null attribute cond var had to be signaled : %s\n", (dtN.ctrl & FLAG_CONDWAKE)?"yes":"no"); - output(" Null attribute cond var exited as signaled : %s\n", (dtN.ctrl & FLAG_AWAKEN)?"yes":"no"); - output(" Null attribute cond var spurious wakeups : %d\n", (dtN.ctrl & MASK_COUNTER) - 1); - #endif - if ((dtN.ctrl == dtI.ctrl) && (dtN.rc == dtI.rc)) - { - result = 0; - #if VERBOSE > 1 - output("The two cond vars behaved exactly in the same maneer\n"); - #endif - } - else - { - if ((dtN.ctrl & FLAG_TIMEDOUT) != (dtI.ctrl & FLAG_TIMEDOUT)) - { - result += 1; /* The test has failed */ - } - else - { - if (dtN.rc != dtI.rc) - { - output("Error codes were different: N:%d D:%d\n",dtN.rc, dtI.rc); - UNRESOLVED(dtN.rc>dtI.rc?dtN.rc:dtI.rc, "Different error codes?"); - } - if ((dtN.ctrl & FLAG_AWAKEN) == (dtI.ctrl & FLAG_AWAKEN)) - { - /* The number of spurious wakeups is different */ - output("Different spurious wakeups: N:%d D:%d\n", - (dtN.ctrl & MASK_COUNTER) - 1, - (dtI.ctrl & MASK_COUNTER) - 1); - - result = 0; /* We don't consider this as a fail case */ - } - } - } - } - - /* We can cleanup things now */ - ret = pthread_cond_destroy(&cndN); - if (ret != 0) - { UNRESOLVED(ret, "Cond destroy failed"); } - ret = pthread_condattr_destroy(&ca); - if (ret != 0) - { UNRESOLVED(ret, "Cond attr destroy failed"); } - ret = pthread_mutex_destroy(&mtxN); - if (ret != 0) - { UNRESOLVED(ret, "Mutex destroy failed"); } - ret = pthread_mutex_destroy(&mtxI); - if (ret != 0) - { UNRESOLVED(ret, "Mutex destroy failed"); } - - return result; -} - -/**** - * Main function - */ -int main(int argc, char * argv[]) -{ - long opt_TMR, opt_CS; - int ret=0; - - output_init(); - - #if VERBOSE > 1 - output("Test starting...\n"); - #endif - - opt_TMR=sysconf(_SC_TIMERS); - opt_CS =sysconf(_SC_CLOCK_SELECTION); - - #if VERBOSE > 1 - output("Timers option : %li\n", opt_TMR); - output("Clock Selection option : %li\n", opt_CS); - #endif - - if ((opt_TMR != -1L) && (opt_CS != -1L)) - { - #if VERBOSE > 0 - output("Starting clock test\n"); - #endif - ret = do_cs_test(); - } - else - { - UNTESTED("This test requires unsupported features"); - } - if (ret != 0) - { FAILED("The cond vars use different clocks."); } - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/3-1.c deleted file mode 100644 index 7df9bb2e11..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/3-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_init() - * Upon succesful completion, it shall return a 0 - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_condattr_t condattr; - pthread_cond_t cond; - int rc; - - /* Initialize a cond attributes object */ - if((rc=pthread_condattr_init(&condattr)) != 0) { - fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Initialize a cond object with the default cond attributes */ - if((rc=pthread_cond_init(&cond,&condattr)) == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - /* Check if returned values are tolerable */ - else if(rc == ENOMEM) { - fprintf(stderr,"Insufficient memory to initialize the cond\n"); - return PTS_UNRESOLVED; - } - else if(rc == EAGAIN) { - fprintf(stderr,"Lack of the necessary resources to initilize the cond\n"); - return PTS_UNRESOLVED; - } - else if(rc == EBUSY) { - fprintf(stderr,"Detected an attemp to reinitilize a previously initilized cond\n"); - return PTS_UNRESOLVED; - } - - /* Any other returned value means the test failed */ - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/4-1.c deleted file mode 100644 index 1661ede6c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/4-1.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This sample test aims to check the following assertion: - * The function fails and returns ENOMEM if there is not enough memory. - - - - * The steps are: - * * Fork - * * New process sets its memory resource limit to a minimum value, then - * -> Allocate all the available memory - * -> call pthread_cond_init() - * -> free the memory - * -> Checks that pthread_cond_init() returned 0 or ENOMEM. - * * Parent process waits for the child. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the setrlimit() function from X/OPEN standard */ - #ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -int main(int argc, char * argv[]) -{ - pid_t child; - - - pthread_cond_t cnd; - pthread_condattr_t ca[4]; - pthread_condattr_t *pca[5]; - - int ret=0; - int i; - int retini[5] = {-1,-1,-1,-1,-1}; - int retdtr[5]= {-1,-1,-1,-1,-1}; - - void * ptr, *ptr_prev=NULL; - - int sz = 0; - struct rlimit rl; - - int status=0; - - - output_init(); - - child = fork(); - - if (child == (pid_t)-1) - { UNRESOLVED(errno, "Fork failed"); } - - if (child != 0) /* We are the father */ - { - if (child != waitpid(child, &status, 0)) - { UNRESOLVED(errno, "Waitpid failed"); } - - if (WIFSIGNALED(status)) - { UNRESOLVED(WTERMSIG(status), - "The child process was killed."); } - - if (WIFEXITED(status)) - return WEXITSTATUS(status); - - UNRESOLVED(0, "Child process neither returned nor was killed."); - } - - /* Only the child goes further */ - - /* We initialize the different cond attributes */ - for (i=0; (i<4) && (ret == 0); i++) - { - pca[i] = &ca[i]; - ret = pthread_condattr_init(pca[i]); - } - if (ret) - { UNRESOLVED(ret, "Cond attribute init failed"); } - pca[4] = (pthread_condattr_t *) NULL; - - ret = pthread_condattr_setpshared(pca[0], PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "Cond attribute PSHARED failed"); } - ret = pthread_condattr_setpshared(pca[1], PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "Cond attribute PSHARED failed"); } - - if (sysconf(_SC_MONOTONIC_CLOCK) > 0) - { - ret = pthread_condattr_setclock(pca[1], CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "Cond set monotonic clock failed"); } - ret = pthread_condattr_setclock(pca[2], CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "Cond set monotonic clock failed"); } - } - - sz = sysconf(_SC_PAGESIZE); - - - /* Limit the process memory to a small value (64Mb for example). */ - rl.rlim_max=1024*1024*64; - rl.rlim_cur=1024*1024*64; - if ((ret = setrlimit(RLIMIT_AS, &rl))) - { UNRESOLVED(ret, "Memory limitation failed"); } - - - #if VERBOSE > 1 - output("Ready to take over memory. Page size is %d\n", sz); - #endif - - /* Allocate all available memory */ - while (1) - { - ptr = malloc( sz ); /* Allocate one page of memory */ - if (ptr == NULL) - break; - #if VERBOSE > 1 - ret++; - #endif - *(void **)ptr = ptr_prev; /* Write into the allocated page */ - ptr_prev = ptr; - } - #if VERBOSE > 1 - output("%d pages were allocated before failure\n", ret); - ret = 0; - #endif - - while (1) - { - ptr = malloc( sizeof(void*) ); /* Allocate every remaining bits of memory */ - if (ptr == NULL) - break; - #if VERBOSE > 1 - ret++; - #endif - *(void **)ptr = ptr_prev; /* Keep track of allocated memory */ - ptr_prev = ptr; - } - #if VERBOSE > 1 - output("%d additional spaces were allocated before failure\n", ret); - ret = 0; - #endif - if (errno != ENOMEM) - UNRESOLVED(errno, "Memory not full"); - - /* Now that memory is full, we try to initialize a cond */ - for (i=0; i<5; i++) - { - retini[i] = pthread_cond_init(&cnd, pca[i]); - if (!retini[i]) /* If cond has been initialized, we destroy it */ - retdtr[i] = pthread_cond_destroy(&cnd); - } - - /* We can now free the memory */ - while (ptr_prev != NULL) - { - ptr = ptr_prev; - ptr_prev = *(void **)ptr; - free(ptr); - } - - #if VERBOSE > 1 - output("Memory is released\n"); - #endif - - for (i=0; i<4; i++) - pthread_condattr_destroy(pca[i]); - - - for (i=0; i<5; i++) - { - if (retini[i] != 0 && retini[i] !=ENOMEM) - { FAILED("Cond init returned a wrong error code when no memory was left"); } - - if (retini[i] == 0) - { - #if VERBOSE > 0 - output("Cond (%i) initialization succeeded when memory is full\n", i); - #endif - if (retdtr[i] != 0) - { UNRESOLVED( retdtr[i], "Cond destroy failed for a cond inilialized under full memory"); } - } - #if VERBOSE > 0 - else - { - output("Cond (%i) initialization failed with ENOMEM\n", i); - } - #endif - } - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/4-2.c deleted file mode 100644 index d80f6418b1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/4-2.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This sample test aims to check the following assertion: - * The function does not return an error code of EINTR - - - * The steps are: - * - * -> Create a thread which loops on pthread_cond_init and pthread_cond_destroy - * operations. - * -> Create another thread which loops on sending a signal to the first thread. - * - * - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#define WITH_SYNCHRO -#ifndef VERBOSE -#define VERBOSE 2 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -char do_it=1; -unsigned long count_ope=0; -pthread_mutex_t count_protect = PTHREAD_MUTEX_INITIALIZER; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif -sem_t semsync; - -typedef struct -{ - pthread_t *thr; - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -/* the following function keeps on sending the signal to the thread pointed by arg - * If WITH_SYNCHRO is defined, the target thread has a handler for the signal */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - if ((ret = pthread_kill (*(thearg->thr), thearg->sig))) - { UNRESOLVED(ret, "Pthread_kill in sendsig"); } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* The following function loops on init/destroy some condvars (with different attributes) - * it does check that no error code of EINTR is returned */ - -void * threaded(void * arg) -{ - pthread_condattr_t ca[4], *pca[5]; - pthread_cond_t c[5]; - int i; - int ret; - - /* We need to register the signal handlers */ - struct sigaction sa; - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* Initialize the different cond attributes */ - pca[4]=NULL; - - for (i=0; i<4; i++) - { - pca[i]=&ca[i]; - if ((ret = pthread_condattr_init(pca[i]))) - { UNRESOLVED(ret, "pthread_condattr_init"); } - } - - ret = pthread_condattr_setpshared(pca[0], PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "Cond attribute PSHARED failed"); } - ret = pthread_condattr_setpshared(pca[1], PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "Cond attribute PSHARED failed"); } - - #if VERBOSE >1 - output("PShared condvar attributes initialized\n"); - #endif - if (sysconf(_SC_MONOTONIC_CLOCK) > 0) - { - ret = pthread_condattr_setclock(pca[1], CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "Cond set monotonic clock failed"); } - ret = pthread_condattr_setclock(pca[2], CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "Cond set monotonic clock failed"); } - #if VERBOSE >1 - output("Alternative clock condvar attributes initialized\n"); - #endif - } - - /* We are ready to proceed */ - while (do_it) - { - for (i=0; i<5; i++) - { - ret = pthread_cond_init(&c[i], pca[i]); - if (ret == EINTR) - { - FAILED("pthread_cond_init returned EINTR"); - } - if (ret != 0) - { - UNRESOLVED(ret, "pthread_cond_init failed"); - } - ret = pthread_cond_destroy(&c[i]); - if (ret == EINTR) - { - FAILED("pthread_cond_destroy returned EINTR"); - } - if (ret != 0) - { - UNRESOLVED(ret, "pthread_cond_destroy failed"); - } - pthread_mutex_lock(&count_protect); - count_ope++; - pthread_mutex_unlock(&count_protect); - } - } - - /* Now we can destroy the mutex attributes objects */ - for (i=0; i<4; i++) - { - if ((ret = pthread_condattr_destroy(pca[i]))) - { UNRESOLVED(ret, "pthread_condattr_init"); } - } - - do { - ret = sem_wait(&semsync); - } while (ret && (errno == EINTR)); - if (ret) - { UNRESOLVED(errno, "Could not wait for sig senders termination"); } - - return NULL; -} - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - - output_init(); - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - if (sem_init(&semsync, 0, 0)) - { UNRESOLVED(errno, "semsync init"); } - - if ((ret = pthread_create(&th_work, NULL, threaded, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.thr = &th_work; - arg2.thr = &th_work; - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - /* Let's wait for a while now */ - sleep(1); - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - - if (sem_post(&semsync)) - { UNRESOLVED(errno, "could not post semsync"); } - - if ((ret = pthread_join(th_work, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" %d condvars initialization and destruction were done.\n", count_ope); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/assertions.xml deleted file mode 100644 index 970672296b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/assertions.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - The function - int pthread_cond_init(pthread_cond_t *restrict cond, - const pthread_condattr_t *restrict attr); - shall initialize the condition variable referenced by cond with - attributes referenced by attr.If attr is NULL, the default condition variable attributes shall be - used; the effect is the same as passing the address of a default condition variable attributes - object. Upon successful initialization, the state of the condition variable shall become initialized. - - - - In cases where default condition variable attributes are appropriate, the macro - PTHREAD_COND_INITIALIZER can be used to initialize condition variables that are statically - allocated. The effect shall be equivalent to dynamic initialization by a call to pthread_cond_init() - with parameter attr specified as NULL, except that no error checks are performed. - - - - If successful, the pthread_cond_init() function shall return zero; - - - - The pthread_cond_init() function shall fail if: - [EAGAIN] The system lacked the necessary resources (other than memory) to initialize - another condition variable. - [ENOMEM] Insufficient memory exists to initialize the condition variable. - The pthread_cond_init() function may fail if: - [EBUSY] The implementation has detected an attempt to reinitialize the object - referenced by cond, a previously initialized, but not yet destroyed, condition - variable. - [EINVAL] The value specified by attr is invalid. - The function shall not return an error code of [EINTR]. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/coverage.txt deleted file mode 100644 index 6493158e69..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_cond_init function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO * Looking for a way to produce the error conditions - * When it specifies it 'may' fail and not 'shall' fail, - it will always return PASS, but will return a - PASS and print out a warning if it fails. -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/testfrmw.c deleted file mode 100644 index 575dbe8c3e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/testfrmw.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - pthread_mutex_lock(&m_trace); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/testfrmw.h deleted file mode 100644 index 3de6c02d6a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_init/testfrmw.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/1-1.c deleted file mode 100644 index eab4d38670..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/1-1.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_signal() - * shall unblock at least one of the threads currently blocked on - * the specified condition variable cond. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 3 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -pthread_t thread[THREAD_NUM]; - -int start_num = 0; -int waken_num = 0; - -/* Alarm handler */ -void alarm_handler(int signo) -{ - int i; - printf("Error: failed to wakeup all threads\n"); - for (i=0; i= THREAD_NUM) { - fprintf(stderr,"[Main thread] had to signal the condition %i times\n", i+1); - fprintf(stderr,"[Main thread] to wake up %i threads\n. Test FAILED.\n", THREAD_NUM); - exit(PTS_FAIL); - } - - /* join all secondary threads */ - for (i=0; i Create a lot of threads/process which will wait on a condition variable - * -> Cascade-signal the condition and check that all threads/processes are awaken. - * - * The test will fail when the threads are not terminated within a certain duration. - * - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#define UNRESOLVED_KILLALL(error, text, Tchild) { \ - if (td->fork) \ - { \ - int _nch; \ - for (_nch=0; _nchfork) \ - { \ - int _nch; \ - for (_nch=0; _nchmtx); - if (ret != 0) { UNRESOLVED(ret, "Failed to lock mutex in child"); } - - /* increment count */ - td->count++; - - timed=td->count & 1; - - if (timed) - { - /* get current time if we are a timedwait */ - ret = clock_gettime(td->cid, &ts); - if (ret != 0) { UNRESOLVED(errno, "Unable to read clock"); } - ts.tv_sec += TIMEOUT; - } - - do { - /* Wait while the predicate is false */ - if (timed) - ret = pthread_cond_timedwait(&td->cnd, &td->mtx, &ts); - else - ret = pthread_cond_wait(&td->cnd, &td->mtx); - #if VERBOSE > 5 - output("[child] Wokenup timed=%i, Predicate=%i, ret=%i\n", timed, td->predicate, ret); - #endif - } while ((ret == 0) && (td->predicate==0)); - if (ret == ETIMEDOUT) - { - FAILED("Timeout occured. This means a cond signal was lost -- or parent died"); - } - if (ret != 0) { UNRESOLVED(ret, "Failed to wait for the cond"); } - - /* Signal the condition to cascade */ - ret = pthread_cond_signal(&td->cnd); - if (ret != 0) { UNRESOLVED(ret, "Failed to cascade signal the cond"); } - - /* unlock the mutex */ - ret = pthread_mutex_unlock(&td->mtx); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex."); } - - return NULL; -} - -/* Timeout thread */ -void * timer(void * arg) -{ - pid_t *pchildren = (pid_t *)arg; - unsigned int to = TIMEOUT; - do { to = sleep(to); } - while (to>0); - FAILED_KILLALL("Operation timed out. A signal was lost.", pchildren); - return NULL; /* For compiler */ -} - -/* main function */ - -int main (int argc, char * argv[]) -{ - int ret; - - pthread_mutexattr_t ma; - pthread_condattr_t ca; - - int scenar; - long pshared, monotonic, cs, mf; - - pid_t p_child[NTHREADS]; - pthread_t t_child[NTHREADS]; - int ch; - pid_t pid; - int status; - - pthread_t t_timer; - - testdata_t alternativ; - - output_init(); - - /* check the system abilities */ - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - cs = sysconf(_SC_CLOCK_SELECTION); - monotonic = sysconf(_SC_MONOTONIC_CLOCK); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TPS : %li\n", pshared); - output(" CS : %li\n", cs); - output(" MON : %li\n", monotonic); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - if ((cs < 0) || (monotonic < 0)) - output("Alternative clock won't be tested\n"); - #endif - - /* We are not interested in testing the clock if we have no other clock available.. */ - if (monotonic < 0) - cs = -1; - -#ifndef USE_ALTCLK - if (cs > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file, we use an alternative method */ - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/cond_wait_stress-XXXXXX"; - size_t sz, ps; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - ps = (size_t)sysconf(_SC_PAGESIZE); - sz= ((sizeof(testdata_t) / ps) + 1) * ps; /* # pages needed to store the testdata */ - - tmp = calloc( 1 , sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory (%ib).\n", sizeof(testdata_t)); - #endif - } - - /* Do the test for each test scenario */ - for (scenar=0; scenar < NSCENAR; scenar++) - { - /* set / reset everything */ - td->fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the cond attribute object"); } - - #ifndef WITHOUT_XOPEN - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[scenar].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #endif - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[scenar].mc_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the cond var process-shared"); } - } - - /* Set the alternative clock, if supported */ - #ifdef USE_ALTCLK - if ((cs > 0) && (scenarii[scenar].c_clock != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the monotonic clock for the cond"); } - } - ret = pthread_condattr_getclock(&ca, &td->cid); - if (ret != 0) { UNRESOLVED(ret, "Unable to get clock from cond attr"); } - #else - td->cid = CLOCK_REALTIME; - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[scenar].fork != 0)) - { - td->fork = 1; - } - - /* initialize the condvar */ - ret = pthread_cond_init(&td->cnd, &ca); - if (ret != 0) { UNRESOLVED(ret, "Cond init failed"); } - - /* initialize the mutex */ - ret = pthread_mutex_init(&td->mtx, &ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex init failed"); } - - /* Destroy the attributes */ - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var attribute object"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - #if VERBOSE > 2 - output("[parent] Starting test %s\n", scenarii[scenar].descr); - #endif - - td->count=0; - /* Create all the children */ - for (ch=0; ch < NTHREADS; ch++) - { - if (td->fork==0) - { - ret = pthread_create(&t_child[ch], NULL, child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to create a child thread"); } - } - else - { - p_child[ch]=fork(); - if (p_child[ch] == -1) - { - ret = errno; - for (--ch; ch>=0; ch--) - kill(p_child[ch], SIGKILL); - UNRESOLVED(ret, "Failed to create a child process"); - } - - if (p_child[ch] == 0) /* We are the child */ - { - child(NULL); - exit(0); - } - } - } - #if VERBOSE > 4 - output("[parent] All children are running\n"); - #endif - - /* Make sure all children are waiting */ - ret = pthread_mutex_lock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex", p_child); } - ch = td->count; - while (ch < NTHREADS) - { - ret = pthread_mutex_unlock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex",p_child); } - sched_yield(); - ret = pthread_mutex_lock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to lock mutex",p_child); } - ch = td->count; - } - - #if VERBOSE > 4 - output("[parent] All children are waiting\n"); - #endif - - - /* create the timeout thread */ - ret = pthread_create(&t_timer, NULL, timer, p_child); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Unable to create timer thread",p_child); } - - /* Wakeup the children */ - td->predicate=1; - ret = pthread_cond_signal(&td->cnd); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to signal the condition.", p_child); } - - #if VERBOSE > 4 - output("[parent] Condition was signaled\n"); - #endif - - ret = pthread_mutex_unlock(&td->mtx); - if (ret != 0) { UNRESOLVED_KILLALL(ret, "Failed to unlock mutex",p_child); } - - #if VERBOSE > 4 - output("[parent] Joining the children\n"); - #endif - - /* join the children */ - for (ch=(NTHREADS - 1); ch >= 0 ; ch--) - { - if (td->fork==0) - { - ret = pthread_join(t_child[ch], NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to join a child thread"); } - } - else - { - pid = waitpid(p_child[ch], &status, 0); - if (pid != p_child[ch]) - { - ret = errno; - output("Waitpid failed (expected: %i, got: %i)\n", p_child[ch], pid); - for (; ch>=0; ch--) - { - kill(p_child[ch], SIGKILL); - } - UNRESOLVED(ret, "Waitpid failed"); - } - if (WIFEXITED(status)) - { - /* the child should return only failed or unresolved or passed */ - if (ret != PTS_FAIL) - ret |= WEXITSTATUS(status); - } - } - } - if (ret != 0) - { - output_fini(); - exit(ret); - } - #if VERBOSE > 4 - output("[parent] All children terminated\n"); - #endif - - - /* cancel the timeout thread */ - ret = pthread_cancel(t_timer); - if (ret != 0) - { - /* Strange error here... the thread cannot be terminated (app would be killed) */ - UNRESOLVED(ret, "Failed to cancel the timeout handler"); - } - - /* join the timeout thread */ - ret = pthread_join(t_timer, NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to join the timeout handler"); } - - /* Destroy the datas */ - ret = pthread_cond_destroy(&td->cnd); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the condvar"); } - - ret = pthread_mutex_destroy(&td->mtx); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - } - - /* exit */ - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/2-1.c deleted file mode 100644 index e76ae1f994..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/2-1.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_signal() - * When each thread unblocked as a result of pthread_cond_signal() - * returns from its call to pthread_cond_wait(), the thread shall - * own the mutex with which it called pthread_cond_wait(). - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 3 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -pthread_t thread[THREAD_NUM]; - -int start_num = 0; -int waken_num = 0; - -/* Alarm handler */ -void alarm_handler(int signo) -{ - int i; - printf("Error: failed to wakeup all threads\n"); - for (i=0; i -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 3 -#define TIMEOUT THREAD_NUM * 2 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -int start_num = 0; -int waken_num = 0; - -void *thr_func(void *arg) -{ - int rc; - struct timespec timeout; - struct timeval curtime; - pthread_t self = pthread_self(); - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] failed to acquire the mutex\n", (void*)self); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"[Thread 0x%p] started and locked the mutex\n", (void*)self); - start_num ++; - - if (gettimeofday(&curtime, NULL) !=0 ) { - fprintf(stderr,"Fail to get current time\n"); - exit(PTS_UNRESOLVED); - } - timeout.tv_sec = curtime.tv_sec + TIMEOUT; - timeout.tv_nsec = curtime.tv_usec * 1000; - - fprintf(stderr,"[Thread 0x%p] is waiting for the cond for at most %d secs\n", - (void*)self, TIMEOUT); - rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout); - if(rc != 0) { - fprintf(stderr,"[Thread 0x%p] pthread_cond_wait returned %d\n", - (void*)self, rc); - exit(PTS_UNRESOLVED); - } - - if (pthread_mutex_trylock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] should be able to lock the recursive mutex again\n", - (void*)self); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr,"[Thread 0x%p] was wakened and acquired the mutex again\n", (void*)self); - waken_num ++; - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] failed to release the mutex\n", (void*)self); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"[Thread 0x%p] did not owned the mutex after the cond wait\n", (void*)self); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr,"[Thread 0x%p] released the mutex\n", (void*)self); - return NULL; -} - -int main() -{ - int i; - pthread_t thread[THREAD_NUM]; - pthread_mutexattr_t ma; - - if (pthread_mutexattr_init(&ma) != 0) { - fprintf(stderr,"Fail to initialize mutex attribute\n"); - return PTS_UNRESOLVED; - } - if (pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE) != 0) { - fprintf(stderr,"Fail to set the mutex attribute\n"); - return PTS_UNRESOLVED; - } - - if (pthread_mutex_init(&td.mutex, &ma) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - for (i=0; i -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 5 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -pthread_t thread[THREAD_NUM]; - -int start_num = 0; -int waken_num = 0; - -/* Alarm handler */ -void alarm_handler(int signo) -{ - int i; - printf("Error: failed to wakeup all threads\n"); - for (i=0; i Create a thread which wait in a condition. - * -> Create a second thread which signals this condition. - * -> Another thread which loops on sending a signal to the second thread. - * - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#define WITH_SYNCHRO -#ifndef VERBOSE -#define VERBOSE 2 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -char do_it=1; -char woken=0; -unsigned long count_cnd_sig=0, count_cnd_wup=0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -struct -{ - pthread_mutex_t mtx; - pthread_cond_t cnd; -} data; - -/* the following function keeps on sending the signal to the process */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - pid_t process; - - process=getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - ret = kill(process, thearg->sig); - if (ret != 0) { UNRESOLVED(errno, "Kill in sendsig"); } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -/* This one is registered for signal SIGUSR2 */ -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* The following function will wait on the cond - * it does check that no error code of EINTR is returned */ -void * waiter(void * arg) -{ - int ret; - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - ret = pthread_mutex_lock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock mutex in waiter thread"); } - - do - { - ret = pthread_cond_wait(&(data.cnd),&(data.mtx)); - count_cnd_wup++; - } while ((ret == 0) && (do_it != 0)); - if (ret != 0) - { - UNRESOLVED(ret, "pthread_cond_wait returned an unexpected error"); - } - - woken++; - - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock mutex in waiter thread"); } - - return NULL; -} - - -/* The next function will signal the condition */ -void * worker (void * arg) -{ - int ret=0; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_UNBLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread"); } - - while (woken==0) - { - ret = pthread_cond_signal(&(data.cnd)); - if (ret == EINTR) { FAILED("pthread_cond_signal returned EINTR"); } - if (ret != 0) { UNRESOLVED(ret, "Failed to signal the condition"); } - count_cnd_sig++; - } - - return NULL; -} - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_waiter, th_worker, th_sig1, th_sig2; - thestruct arg1, arg2; - struct sigaction sa; - - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset(&usersigs); - ret = sigaddset(&usersigs, SIGUSR1); - ret |= sigaddset(&usersigs, SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Unable to add SIGUSR1 or 2 to a signal set"); } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread"); } - - - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - if ((ret = pthread_create(&th_waiter, NULL, waiter, NULL))) - { UNRESOLVED(ret, "Waiter thread creation failed"); } - - if ((ret = pthread_create(&th_worker, NULL, worker, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - /* Let's wait for a while now */ - sleep(1); - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - if ((ret = pthread_join(th_waiter, NULL))) - { UNRESOLVED(ret, "Waiter thread join failed"); } - if ((ret = pthread_join(th_worker, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" Condition was signaled %d times.\n", count_cnd_sig); - output(" pthread_cond_wait exited %d times.\n", count_cnd_wup); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/assertions.xml deleted file mode 100644 index 0ea824bbd4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/assertions.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - The function - int pthread_cond_signal(pthread_cond_t *cond); - shall unblock at least one of the threads currently blocked on - the specified condition variable cond. - - - - When each thread unblocked as a result of a - pthread_cond_signal() returns from its call to pthread_cond_wait() or - pthread_cond_timedwait(), the thread shall own the mutex with which it called - pthread_cond_wait() or pthread_cond_timedwait(). - - - - The pthread_cond_signal() functions shall have no effect if there are - no threads currently blocked on cond. - - - - If successful, the pthread_cond_signal() function shall return zero; - - - - The pthread_cond_signal() function may fail if: - [EINVAL] The value cond does not refer to an initialized condition variable. - These functions shall not return an error code of [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/coverage.txt deleted file mode 100644 index 4f0220d551..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_cond_signal function: - -Assertion Tested? -1 YES -2 YES -3 NO -4 YES -5 NO * When it specifies it 'may' fail and not 'shall' fail, - it will always return PASS, but will return a - PASS and print out a warning if it fails. -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_signal/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/1-1.c deleted file mode 100644 index 7df2debbd5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/1-1.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_timedwait() - * shall block on a condition variable. It shall be called with mutex locked - * by the calling thread or undefined behavior results. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 5 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -int t1_start = 0; -int signaled = 0; - -void *t1_func(void *arg) -{ - int rc; - struct timespec timeout; - struct timeval curtime; - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Thread1: Fail to acquire mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 started\n"); - t1_start = 1; /* let main thread continue */ - - if (gettimeofday(&curtime, NULL) !=0 ) { - fprintf(stderr,"Fail to get current time\n"); - exit(PTS_UNRESOLVED); - } - timeout.tv_sec = curtime.tv_sec; - timeout.tv_nsec = curtime.tv_usec * 1000; - timeout.tv_sec += TIMEOUT; - - fprintf(stderr,"Thread1 is waiting for the cond\n"); - rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout); - if(rc != 0) { - if (rc == ETIMEDOUT) { - fprintf(stderr,"Thread1 stops waiting when time is out\n"); - exit(PTS_UNRESOLVED); - } - else { - fprintf(stderr,"pthread_cond_timedwait return %d\n", rc); - exit(PTS_UNRESOLVED); - } - } - - fprintf(stderr,"Thread1 wakened up\n"); - if(signaled == 0) { - fprintf(stderr,"Thread1 did not block on the cond at all\n"); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - pthread_mutex_unlock(&td.mutex); - return NULL; -} - -int main() -{ - pthread_t thread1; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { - fprintf(stderr,"Fail to create thread 1\n"); - return PTS_UNRESOLVED; - } - while(!t1_start) /* wait for thread1 started */ - usleep(100); - - /* acquire the mutex released by pthread_cond_wait() within thread 1 */ - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Main: Fail to acquire mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"Main: Fail to release mutex\n"); - return PTS_UNRESOLVED; - } - sleep(1); - - fprintf(stderr,"Time to wake up thread1 by signaling a condition\n"); - signaled = 1; - if (pthread_cond_signal(&td.cond) != 0) { - fprintf(stderr,"Main: Fail to signal cond\n"); - return PTS_UNRESOLVED; - } - - pthread_join(thread1, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-1.c deleted file mode 100644 index 3fa47201b7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-1.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_timedwait() - * shall be equivalent to pthread_cond_wait(), except that an error is returned - * if the absolute time specified by abstime passes before the condition cond is - * signaled or broadcasted, or if the absolute time specified by abstime has - * already been passed at the time of the call. - * - * Case 2-1 - * Upon successful return, the mutex shall have been locked and shall - * be owned by the calling thread. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define INTERVAL 1 -#define TIMEOUT 5 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -int t1_start = 0; -int signaled = 0; - -void *t1_func(void *arg) -{ - int rc; - struct timespec timeout; - struct timeval curtime; - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to acquire the mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 started\n"); - t1_start = 1; /* let main thread continue */ - - if (gettimeofday(&curtime, NULL) !=0 ) { - fprintf(stderr,"Fail to get current time\n"); - exit(PTS_UNRESOLVED); - } - timeout.tv_sec = curtime.tv_sec + TIMEOUT; - timeout.tv_nsec = curtime.tv_usec * 1000; - - fprintf(stderr,"Thread1 is waiting for the cond\n"); - rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout); - if(rc != 0) { - if (rc == ETIMEDOUT) { - fprintf(stderr,"Thread1 stops waiting when time is out\n"); - exit(PTS_UNRESOLVED); - } - else { - fprintf(stderr,"pthread_cond_timedwait return %d\n", rc); - exit(PTS_UNRESOLVED); - } - } - - fprintf(stderr,"Thread1 wakened\n"); - if(signaled == 0) { - fprintf(stderr,"Thread1 did not block on the cond at all\n"); - exit(PTS_UNRESOLVED); - } - - if (pthread_mutex_trylock(&td.mutex) == 0) { - fprintf(stderr,"Thread1 should not be able to lock the mutex again\n"); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr,"Thread1 failed to trylock the mutex (as expected)\n"); - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to release the mutex\n"); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr,"Thread1 released the mutex\n"); - return NULL; -} - -int main() -{ - pthread_t thread1; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { - fprintf(stderr,"Fail to create thread 1\n"); - return PTS_UNRESOLVED; - } - while(!t1_start) /* wait for thread1 started */ - usleep(100); - - /* acquire the mutex released by pthread_cond_wait() within thread 1 */ - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Main failed to acquire mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"Main failed to release mutex\n"); - return PTS_UNRESOLVED; - } - sleep(INTERVAL); - - fprintf(stderr,"Time to wake up thread1 by signaling a condition\n"); - signaled = 1; - if (pthread_cond_signal(&td.cond) != 0) { - fprintf(stderr,"Main failed to signal the condition\n"); - return PTS_UNRESOLVED; - } - - pthread_join(thread1, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-2.c deleted file mode 100644 index 4825ff6f22..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-2.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_timedwait() - * shall be equivalent to pthread_cond_wait(), except that an error is returned - * if the absolute time specified by abstime passes before the condition cond is - * signaled or broadcasted. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define INTERVAL 5 -#define TIMEOUT 1 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - - -int t1_start = 0; - -void *t1_func(void *arg) -{ - int rc; - struct timeval curtime; - struct timespec timeout; - - fprintf(stderr,"Thread1 started\n"); - - /* Lock the mutex */ - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to acquire the mutex\n"); - exit(PTS_UNRESOLVED); - } - - /* Tell main it may continue running now that the thread started. */ - t1_start = 1; - - /* Set time for pthread_cond_timedwait to wait */ - if (gettimeofday(&curtime, NULL) !=0 ) { - fprintf(stderr,"Fail to get current time\n"); - exit(PTS_UNRESOLVED); - } - timeout.tv_sec = curtime.tv_sec + TIMEOUT; - timeout.tv_nsec = curtime.tv_usec * 1000; - - /* Thread will now release the mutex and wait on the condition variable */ - /* The condition variable will not be signaled until AFTER the timeout - * period, so we should receive an ETIMEDOUT error. */ - fprintf(stderr,"Thread1 is waiting for the cond\n"); - rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout); - if (rc == ETIMEDOUT) { - fprintf(stderr,"Thread1 stops waiting when time is out\n"); - pthread_exit((void*)PTS_PASS); - } - else { - fprintf(stderr,"Test FAILED: pthread_cond_timedwait return %d instead of ETIMEDOUT\n", rc); - pthread_exit((void*)PTS_FAIL); - } - - return NULL; -} - -int main() -{ - pthread_t thread1; - int th_ret; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { - fprintf(stderr,"Fail to create thread 1\n"); - return PTS_UNRESOLVED; - } - - while(!t1_start) /* wait for thread1 started */ - usleep(100); - - /* acquire the mutex released by pthread_cond_wait() within thread 1 */ - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Main failed to acquire mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"Main failed to release mutex\n"); - return PTS_UNRESOLVED; - } - - /* Set an alarm signal in case the thread never returns probably because - * pthread_cond_timedwait functioned incorrectly and waited too long. */ - alarm(INTERVAL); - - /* Wait for the thread to return. */ - if(pthread_join(thread1, (void*)&th_ret) != 0) - { - fprintf(stderr, "Could not join the thread.\n"); - return PTS_UNRESOLVED; - } - - if(th_ret == PTS_PASS) - { - printf("Test PASSED\n"); - return PTS_PASS; - } else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-3.c deleted file mode 100644 index d2b219a12f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-3.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_timedwait() - * shall be equivalent to pthread_cond_wait(), except that an error is returned - * if the absolute time specified by abstime has already been passed at the time - * of the call. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define INTERVAL 2 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -int t1_start = 0; - -void *t1_func(void *arg) -{ - int rc; - struct timeval curtime; - struct timespec timeout; - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to acquire the mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 started\n"); - t1_start = 1; /* let main thread continue */ - - if (gettimeofday(&curtime, NULL) !=0 ) { - fprintf(stderr,"Fail to get current time\n"); - exit(PTS_UNRESOLVED); - } - timeout.tv_sec = curtime.tv_sec; - timeout.tv_nsec = 0; - - fprintf(stderr,"Thread1 is waiting for the cond\n"); - rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout); - if (rc == ETIMEDOUT) { - fprintf(stderr,"Thread1 stops waiting when time is out\n"); - pthread_exit((void*)PTS_PASS); - } - else { - fprintf(stderr,"pthread_cond_timedwait return %d instead of ETIMEDOUT\n", rc); - exit(PTS_FAIL); - } - - return NULL; -} - -int main() -{ - pthread_t thread1; - int rc, th_ret; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { - fprintf(stderr,"Fail to create thread 1\n"); - return PTS_UNRESOLVED; - } - - /* If the thread hasn't ended in 5 seconds, then most probably - * pthread_cond_timedwait is failing to function correctly. */ - alarm(5); - - /* Wait for thread to end execution. */ - if(pthread_join(thread1, (void*)&th_ret) != 0) - { - fprintf(stderr, "Could not join the thread. \n"); - return PTS_UNRESOLVED; - } - - /* Make sure pthread_cond_timedwait released and re-acquired the mutex - * as it should. */ - rc=pthread_mutex_trylock(&td.mutex); - if (rc == 0) { - fprintf(stderr,"Test FAILED: Did not re-acquire mutex after timedout out call to pthread_cond_timedwait\n"); - return PTS_FAIL; - } - - if(th_ret == PTS_PASS) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else if(th_ret == PTS_FAIL) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } else - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-4.c deleted file mode 100644 index d103e77d4a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-4.c +++ /dev/null @@ -1,601 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * When the function returns successfully, everything is as if - * the thread had locked the mutex. - * - - * The steps are: - * -> For each mutex type; - * -> with and without process-shared primitive if this is supported; - * -> with different clocks if this is supported, - * -> Initialize a condvar and a mutex. - * -> Create a new thread (or process for process-shared condvars & mutex) - * -> The new thread (process) locks the mutex, then enters a timedwait which will expire far later. - * -> The parent thread (process) then locks the mutex, ensures that the child is waiting, - * then signals the condition; and checks the child does not leave the wait function. - * -> The parent unlocks the mutex then waits for the child. - * -> The child checks that it owns the mutex; then it leaves. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes - and the mkstemp() routine */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#ifndef WITHOUT_ALTCLK -#define USE_ALTCLK /* make tests with MONOTONIC CLOCK if supported */ -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN - -typedef struct -{ - pthread_mutex_t mtx; - pthread_cond_t cnd; - clockid_t cid; /* Clock id used by the cond var */ - int type; /* Mutex type */ - int ctrl; /* checkpoints */ - int bool; /* Boolean predicate for the condition */ - int status; /* error code */ -} testdata_t; - -struct _scenar -{ - int m_type; /* Mutex type to use */ - int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */ - int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */ - int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_DEFAULT, 0, 0, 0, "Default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 0, 0, 0, "Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 0, 0, "Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 0, 0, "Recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, 0, "PShared default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 1, 0, 0, "Pshared normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, 0, "Pshared errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, 0, "Pshared recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, 1, "Pshared default mutex across processes"} - ,{PTHREAD_MUTEX_NORMAL, 1, 0, 1, "Pshared normal mutex across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, 1, "Pshared errorcheck mutex across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, 1, "Pshared recursive mutex across processes"} - -#ifdef USE_ALTCLK - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, 1, "Pshared default mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_NORMAL, 1, 1, 1, "Pshared normal mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, 1, "Pshared errorcheck mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, 1, "Pshared recursive mutex and alt clock condvar across processes"} - - ,{PTHREAD_MUTEX_DEFAULT, 0, 1, 0, "Default mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_NORMAL, 0, 1, 0, "Normal mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 1, 0, "Errorcheck mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 1, 0, "Recursive mutex and alt clock condvar"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, 0, "PShared default mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_NORMAL, 1, 1, 0, "Pshared normal mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, 0, "Pshared errorcheck mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, 0, "Pshared recursive mutex and alt clock condvar"} -#endif -}; - -void * tf(void * arg) -{ - int ret=0; - struct timespec ts; - - testdata_t * td = (testdata_t *)arg; - - /* Lock the mutex */ - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) - { - td->status = ret; - UNRESOLVED(ret, "[child] Unable to lock the mutex"); - } - - /* Tell the parent the mutex is locked */ - td->ctrl = 1; - - /* Prepare the timeout parameter */ - ret = clock_gettime(td->cid, &ts); - if (ret != 0) - { - td->status = ret; - UNRESOLVED(errno, "[child] Unable get clock time"); - } - - ts.tv_sec += 10; - #if VERBOSE > 1 - output("[child] Will timeout at %i.%09i\n", ts.tv_sec, ts.tv_nsec); - #endif - - /* Enter the timed wait */ - do - { - ret = pthread_cond_timedwait(&(td->cnd), &(td->mtx), &ts); - td->ctrl = 2; - } while ((ret == 0) && (td->bool == 0)); - - td->ctrl = 3; - - if (ret != 0) - { - td->status = ret; - UNRESOLVED(ret, "[child] Cond timedwait returned an error"); - } - - /* Make sure we are owning the mutex */ - ret = pthread_mutex_trylock(&(td->mtx)); - if (td->type == PTHREAD_MUTEX_RECURSIVE) - { - #if VERBOSE > 1 - output("[child] Recursive mutex. Test if we are able to re-lock.\n"); - #endif - if (ret != 0) - { - td->status = ret; - FAILED("[child] Unable to relock the recursive mutex"); - } - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) - { - td->status = ret; - UNRESOLVED(ret, "[child] Failed to unlock the mutex"); - } - } - else /* This was not a recursive mutex; the call must have failed */ - { - if (ret == 0) - { - td->status = -1; - FAILED("[child] Thread did not owned the mutex after the timedwait return."); - } - if (ret != EBUSY) - { - td-> status = ret; - UNRESOLVED(ret, "[child] Mutex trylock did not return EBUSY"); - } - #if VERBOSE > 1 - output("[child] The mutex was busy (normal).\n"); - #endif - } - - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) - { - td->status=ret; - output("[child] Got error %i: %s\n", ret, strerror(ret)); - FAILED("[child] Failed to unlock the mutex - owned by another thread?"); - } - - td->ctrl = 4; - return NULL; -} - - -int main(int argc, char * argv[]) -{ - int ret, i; - pthread_mutexattr_t ma; - pthread_condattr_t ca; - - testdata_t * td; - testdata_t alternativ; - - int do_fork; - - pid_t child_pr=0, chkpid; - int status; - pthread_t child_th; - - long pshared, monotonic, cs, mf; - - output_init(); - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - cs = sysconf(_SC_CLOCK_SELECTION); - monotonic = sysconf(_SC_MONOTONIC_CLOCK); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TPS : %li\n", pshared); - output(" CS : %li\n", cs); - output(" MON : %li\n", monotonic); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - if ((cs < 0) || (monotonic < 0)) - output("Alternative clock won't be tested\n"); - #endif - - /* We are not interested in testing the clock if we have no other clock available.. */ - if (monotonic < 0) - cs = -1; - -#ifndef USE_ALTCLK - if (cs > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file, we use an alternative method */ - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/cond_timedwait_3-2-XXXXXX"; - size_t sz; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - sz= (size_t)sysconf(_SC_PAGESIZE); - - tmp = calloc(1, sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory.\n"); - #endif - } - - -/********** - * For each test scenario, initialize the attributes and other variables. - */ - for ( i=0; i< (sizeof(scenarii) / sizeof(scenarii[0])); i++) - { - #if VERBOSE > 1 - output("[parent] Preparing attributes for: %s\n", scenarii[i].descr); - #endif - /* set / reset everything */ - do_fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the cond attribute object"); } - - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[i].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #if VERBOSE > 1 - output("[parent] Mutex type : %i\n", scenarii[i].m_type); - #endif - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[i].mc_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the cond var process-shared"); } - #if VERBOSE > 1 - output("[parent] Mutex & cond are process-shared\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Mutex & cond are process-private\n"); - } - #endif - - /* Set the alternative clock, if supported */ - #ifdef USE_ALTCLK - if ((cs > 0) && (scenarii[i].c_clock != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the monotonic clock for the cond"); } - #if VERBOSE > 1 - output("[parent] Cond uses the Monotonic clock\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Cond uses the default clock\n"); - } - #endif - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[i].fork != 0)) - { - do_fork = 1; - #if VERBOSE > 1 - output("[parent] Child will be a new process\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Child will be a new thread\n"); - } - #endif - - -/********** - * Initialize the testdata_t structure with the previously defined attributes - */ - /* Initialize the mutex */ - ret = pthread_mutex_init(&(td->mtx), &ma); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Mutex init failed"); } - - /* initialize the condvar */ - ret = pthread_cond_init(&(td->cnd), &ca); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Cond init failed"); } - - /* Initialize the other datas from the test structure */ - #ifdef USE_ALTCLK - ret = pthread_condattr_getclock(&ca, &(td->cid)); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Unable to read cond clock attribute"); } - #else - td->cid = CLOCK_REALTIME; - #endif - - ret = pthread_mutexattr_gettype(&ma, &(td->type)); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Unable to read mutex type attribute"); } - - td->ctrl=0; - td->bool=0; - td->status=0; - -/********** - * Proceed to the actual testing - */ - - /* Create the child */ - if (do_fork != 0) - { - /* We are testing across two processes */ - child_pr = fork(); - if (child_pr == -1) - { UNRESOLVED(errno, "[parent] Fork failed"); } - - if (child_pr == 0) - { - #if VERBOSE > 1 - output("[child] Child process starting...\n"); - #endif - - if (tf((void *)td) != NULL) - { - UNRESOLVED( -1, "[child] Got an unexpected return value from test function"); - } - else - { - /* We cannot use the PASSED macro here since it would terminate the output */ - exit (0); - } - } - /* Only the parent process goes further */ - } - else /* do_fork == 0 */ - { - /* We are testing across two threads */ - ret = pthread_create(&child_th, NULL, tf, td); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to create the child thread."); } - } - - /* Note: in case of an error, the child process will be alive for 10 sec then exit. */ - - /* Child is now running and will enter the timedwait */ - /* We are waiting for this; and we have to monitor the status value as well. */ - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to lock the mutex"); } - - while ((td->ctrl == 0) && (td->status == 0)) - { - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to unlock the mutex"); } - sched_yield(); - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to lock the mutex"); } - } - - if ((td->ctrl == 2) && (td->status == 0)) /* Spurious wakeups hapenned */ - { - output("Spurious wake ups have happened. Maybe pthread_cond_timedwait is broken?\n"); - td->ctrl = 1; - } - - if (td->ctrl == 1)/* The child is inside the cond timedwait */ - { - ret = pthread_cond_signal(&(td->cnd)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to signal the condition"); } - - /* Let the child leave the wait function if something is broken */ - usleep(100); - - if (td->ctrl != 1) - { - FAILED("[parent] Child went out from pthread_cond_timedwait without locking the mutex"); - } - - /* Allow the child to continue */ - td->bool=1; - } - - /* Let the child do its checking */ - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to unlock the mutex"); } - - /* Wait for the child to terminate */ - if (do_fork != 0) - { - /* We were testing across two processes */ - chkpid = waitpid(child_pr, &status, 0); - if (chkpid != child_pr) - { - output("Expected pid: %i. Got %i\n", (int)child_pr, (int)chkpid); - UNRESOLVED(errno, "Waitpid failed"); - } - if (WIFSIGNALED(status)) - { - output("Child process killed with signal %d\n",WTERMSIG(status)); - UNRESOLVED( td->status , "Child process was killed"); - } - - if (WIFEXITED(status)) - { - ret = WEXITSTATUS(status); - } - else - { - UNRESOLVED( td->status, "Child process was neither killed nor exited"); - } - - if (ret != 0) - { - exit(ret); /* Output has already been closed in child */ - } - } - else /* child was a thread */ - { - ret = pthread_join(child_th, NULL); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to join the thread"); } - } - -/********** - * Destroy the data - */ - ret = pthread_cond_destroy(&(td->cnd)); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var"); } - - ret = pthread_mutex_destroy(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var attribute object"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - } /* Proceed to the next scenario */ - - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-5.c deleted file mode 100644 index a062f56274..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-5.c +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * While a thread is blocked on a conditionnal variable, - * a dynamic binding exists between this conditionnal variable - * and the mutex which was the second argument. - * This dynamic binding stops existing when the last thread is unblocked. - * Even if the conditionnal variable can then be reused with another mutex, - * the threads which have been unblocked must still acquire - * the mutex they had associated with the conditionnal variable at call time. - * - - * The steps are: - * -> Create two mutexes m1 and m2 (errorcheck or recursive) - * -> Create a condition variable c depending on a bootlean b - * -> create N threads which will - * -> lock m1 - * -> wait or timedwait c, m1 (while b is false) - * -> check it owns m1 (check depends on the mutex type) - * -> lock m2 - * -> wait or timedwait c, m2 (while b is false) - * -> check it owns m2 - * -> mark this thread as terminate - * -> Once all threads are waiting on (c,m1), - * mark b as true then broadcast c until all threads are terminated. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define NTHREADS (100) - -#ifndef WITHOUT_ALTCLK -#define USE_ALTCLK /* make tests with MONOTONIC CLOCK if supported */ -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN - -struct _td -{ - pthread_mutex_t mtx1, mtx2; /* The two mutex m1 and m2 */ - pthread_cond_t cnd; /* The cond var c */ - char boolcnd; /* The boolean predicate b associated with c */ - int type; /* Type of mutex */ - clockid_t cid; /* Clock used by cond c */ - int started; /* # of threads which are already waiting */ - int stopped; /* # of threads which are terminated */ -} data; - -void * threaded ( void * arg ) -{ - int ret; - - struct timespec ts; - - /* Prepare the timeout parameter */ - ret = clock_gettime(data.cid, &ts); - if (ret != 0) { UNRESOLVED(ret, "Unable to get time from clock"); } - ts.tv_sec += 30; - - /* Lock m1 */ - ret = pthread_mutex_lock(&(data.mtx1)); - if (ret != 0) { UNRESOLVED(ret, "Unable tu lock m1 in thread"); } - - /* Tell the parent this thread is started */ - data.started++; - - /* wait for the cond - bind the cond to the mutex m1 */ - do - { - if (arg == (void *)0) - ret = pthread_cond_wait(&(data.cnd), &(data.mtx1)); - else - ret = pthread_cond_timedwait(&(data.cnd), &(data.mtx1), &ts); - } while ((ret == 0) && (data.boolcnd == 0)); - if (ret != 0) { UNRESOLVED(ret, "First wait failed in thread"); } - - /* Test ownership and unlock m1 */ - if (data.type == PTHREAD_MUTEX_RECURSIVE) - { - ret = pthread_mutex_trylock(&(data.mtx1)); - if (ret != 0) { FAILED("Unable to re-lock recursive mutex after cond wait"); } - ret = pthread_mutex_unlock(&(data.mtx1)); - if (ret != 0) { UNRESOLVED(ret, "Mutex unlock failed"); } - } - ret = pthread_mutex_unlock(&(data.mtx1)); - if (ret != 0) { FAILED("Unable to unlock m1 in thread - not owner?"); } - ret = pthread_mutex_unlock(&(data.mtx1)); - if (ret == 0) { FAILED("Unlocking an unlocked mutex succeeded"); } /* Failed while this is not a default mutex */ - - /* Lock m2 */ - ret = pthread_mutex_lock(&(data.mtx2)); - if (ret != 0) { UNRESOLVED(ret, "Unable tu lock m2 in thread"); } - - /* wait for the cond - bind the cond to the mutex m2 */ - do - { - if (arg == (void *)0) - ret = pthread_cond_wait(&(data.cnd), &(data.mtx2)); - else - ret = pthread_cond_timedwait(&(data.cnd), &(data.mtx2), &ts); - } while ((ret == 0) && (data.boolcnd == 0)); - if (ret != 0) { UNRESOLVED(ret, "Second wait failed in thread"); } - - /* Mark the thread as terminated while we are protected by m2 */ - data.stopped++; - - /* Test ownership and unlock m2*/ - if (data.type == PTHREAD_MUTEX_RECURSIVE) - { - ret = pthread_mutex_trylock(&(data.mtx2)); - if (ret != 0) { FAILED("Unable to re-lock recursive mutex after cond wait"); } - ret = pthread_mutex_unlock(&(data.mtx2)); - if (ret != 0) { UNRESOLVED(ret, "Mutex unlock failed"); } - } - ret = pthread_mutex_unlock(&(data.mtx2)); - if (ret != 0) { FAILED("Unable to unlock m2 in thread - not owner?"); } - ret = pthread_mutex_unlock(&(data.mtx2)); - if (ret == 0) { FAILED("Unlocking an unlocked mutex succeeded"); } /* Failed while this is not a default mutex */ - - return NULL; -} - - -int main(int argc, char * argv[]) -{ - int ret, i, j; - pthread_mutexattr_t ma; - pthread_condattr_t ca; - pthread_t th[NTHREADS]; - int loc_started, loc_stopped; - - long altclk_ok, pshared_ok; - - struct - { - char altclk; /* Want to use alternative clock */ - char pshared; /* Want to use process-shared primitives */ - int type; /* mutex type */ - char * descr; /* Description of the case */ - - } scenar[] = - { {0, 0, PTHREAD_MUTEX_RECURSIVE , "Recursive mutex" } - ,{0, 0, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck mutex" } - #ifdef USE_ALTCLK - ,{1, 0, PTHREAD_MUTEX_RECURSIVE , "Recursive mutex + altclock cond" } - ,{1, 0, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck mutex + altclock cond" } - ,{1, 1, PTHREAD_MUTEX_RECURSIVE , "Recursive pshared mutex + altclock cond" } - ,{1, 1, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck pshared mutex + altclock cond" } - #endif - ,{0, 1, PTHREAD_MUTEX_RECURSIVE , "Recursive pshared mutex" } - ,{0, 1, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck pshared mutex" } - }; - - output_init(); - - /* Initialize the constants */ - altclk_ok = sysconf(_SC_CLOCK_SELECTION); - if (altclk_ok > 0) - altclk_ok = sysconf(_SC_MONOTONIC_CLOCK); - -#ifndef USE_ALTCLK - if (altclk_ok > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - - - pshared_ok = sysconf(_SC_THREAD_PROCESS_SHARED); - - #if VERBOSE > 0 - output("Test starting\n"); - output(" Process-shared primitive %s be tested\n", (pshared_ok>0)?"will":"won't"); - output(" Alternative clock for cond %s be tested\n", (altclk_ok>0)?"will":"won't"); - #endif - - for (i=0; i< (sizeof(scenar) / sizeof(scenar[0])); i++) - { - #if VERBOSE > 1 - output("Starting test for %s\n", scenar[i].descr); - #endif - - /* Initialize the data structure */ - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex attribute object init failed"); } - - ret = pthread_mutexattr_settype(&ma, scenar[i].type); - if (ret != 0) { UNRESOLVED(ret, "Unable to set mutex type"); } - - if ((pshared_ok > 0) && (scenar[i].pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set mutex process-shared"); } - } - - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "Cond attribute object init failed"); } - - if ((pshared_ok > 0) && (scenar[i].pshared != 0)) - { - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set cond process-shared"); } - } - - #ifdef USE_ALTCLK - if ((altclk_ok > 0) && (scenar[i].altclk != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "Unable to set alternative (monotonic) clock for cond"); } - } - #endif - - ret = pthread_mutex_init(&(data.mtx1), &ma); - if (ret != 0) { UNRESOLVED(ret, "Unable to init mutex 1"); } - - ret = pthread_mutex_init(&(data.mtx2), &ma); - if (ret != 0) { UNRESOLVED(ret, "Unable to init mutex 2"); } - - ret = pthread_cond_init(&(data.cnd), &ca); - if (ret != 0) { UNRESOLVED(ret, "Unable to initialize condvar"); } - - data.boolcnd = 0; - - ret = pthread_mutexattr_gettype(&ma, &(data.type)); - if (ret != 0) { UNRESOLVED(ret, "Unable to get type from mutex attr"); } - - #ifdef USE_ALTCLK - ret = pthread_condattr_getclock(&ca, &(data.cid)); - if (ret != 0) { UNRESOLVED(ret, "Unable to get clock ID from cond attr"); } - #else - data.cid = CLOCK_REALTIME; - #endif - - data.started = 0; - data.stopped = 0; - - /* Start the threads */ - #if VERBOSE > 1 - output("Initialization OK, starting threads\n"); - #endif - for (j = 0; j < NTHREADS; j++) - { - ret = pthread_create(&th[j], NULL, threaded, (void *)(long)(j & 1)); - if (ret != 0) { UNRESOLVED(ret, "Thread creation failed"); } - } - - /* Wait for the threads to be started */ - do { - ret = pthread_mutex_lock(&(data.mtx1)); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock m1 in parent"); } - loc_started = data.started; - ret = pthread_mutex_unlock(&(data.mtx1)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock m1 in parent"); } - } while (loc_started < NTHREADS); - - /* Broadcast the condition until all threads are terminated */ - data.boolcnd = 1; - do { - ret = pthread_cond_broadcast(&(data.cnd)); - if (ret != 0) { UNRESOLVED(ret, "Unable to broadcast cnd"); } - sched_yield(); - ret = pthread_mutex_lock(&(data.mtx2)); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock m2 in parent"); } - loc_stopped = data.stopped; - ret = pthread_mutex_unlock(&(data.mtx2)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock m2 in parent"); } - } while (loc_stopped < NTHREADS); - - /* Join the threads */ - for (j = 0; j < NTHREADS; j++) - { - ret = pthread_join(th[j], NULL); - if (ret != 0) { UNRESOLVED(ret, "Thread join failed"); } - } - - #if VERBOSE > 1 - output("Test passed for %s\n", scenar[i].descr); - #endif - - /* Destroy data */ - ret = pthread_cond_destroy(&(data.cnd)); - if (ret != 0) { UNRESOLVED(ret, "Cond destroy failed"); } - - ret = pthread_mutex_destroy(&(data.mtx1)); - if (ret != 0) { UNRESOLVED(ret, "Mutex 1 destroy failed"); } - - ret = pthread_mutex_destroy(&(data.mtx2)); - if (ret != 0) { UNRESOLVED(ret, "Mutex 2 destroy failed"); } - - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Cond attribute destroy failed"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex attr destroy failed"); } - } /* Proceed to next case */ - - - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-6.c deleted file mode 100644 index 78c3e4b6b8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-6.c +++ /dev/null @@ -1,395 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * This function is a cancelation point: when cancelability - * is PTHREAD_CANCEL_DEFERRED and a cancel request falls, the thread - * must relock the mutex before the first (if any) clean up handler is called. - - * The steps are: - * -> Create a thread - * -> this thread locks a mutex then waits for a condition - * -> cancel the thread - * -> the cancelation handler will test if the thread owns the mutex. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#ifndef WITHOUT_ALTCLK -#define USE_ALTCLK /* make tests with MONOTONIC CLOCK if supported */ -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -struct -{ - pthread_mutex_t mtx; - pthread_cond_t cnd; - int type; - clockid_t cid; - sem_t semA; - sem_t semB; - int bool; -} data; - - -/**** First handler that will be poped - * This one works only with recursive mutexes - */ -void clnp1 (void * arg) -{ - int ret; - if (data.type == PTHREAD_MUTEX_RECURSIVE) - { - ret = pthread_mutex_trylock(&(data.mtx)); - if (ret != 0) { FAILED("Unable to double-lock a recursive mutex in clean-up handler 1"); } - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock double-locked recursive mutex in clean-up handler 1"); } - } - return; -} - -/**** Second handler - * This one will trigger an action in main thread, while we are owning the mutex - */ -void clnp2 (void * arg) -{ - int ret; - do { - ret = sem_post(&(data.semA)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem post failed in cleanup handler 2"); } - - do { - ret = sem_wait(&(data.semB)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem wait failed in cleanup handler 2"); } - - return; -} - -/**** Third handler - * Will actually unlock the mutex, then try to unlock second time to check an error is returned - */ -void clnp3 (void * arg) -{ - int ret; - - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock mutex in clean-up handler 3"); } - - if ((data.type == PTHREAD_MUTEX_ERRORCHECK) || (data.type == PTHREAD_MUTEX_RECURSIVE)) - { - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret == 0) { UNRESOLVED(ret, "Was able to unlock unlocked mutex in clean-up handler 3"); } - } - - return; -} - - -/**** Thread function - * This function will lock the mutex, then install the cleanup handlers - * and wait for the cond. At this point it will be canceled. - */ -void * threaded (void * arg) -{ - int ret; - - struct timespec ts; - - ret = clock_gettime(data.cid, &ts); - if (ret != 0) { UNRESOLVED(ret, "Unable to get time from clock"); } - - ts.tv_sec += 30; - - ret= pthread_mutex_lock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to lock the mutex in thread"); } - - do { - ret = sem_post(&(data.semA)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem post failed in thread"); } - - pthread_cleanup_push ( clnp3, NULL); - pthread_cleanup_push ( clnp2, NULL); - pthread_cleanup_push ( clnp1, NULL); - - do { - ret = pthread_cond_timedwait(&(data.cnd), &(data.mtx), &ts); - } while ((ret == 0) && (data.bool == 0)); - - if (ret != 0) { UNRESOLVED(ret , "Timedwait failed"); } /* We will exit even if the error is timedwait */ - - /* If we are here, the thread was not canceled */ - FAILED("The thread has not been canceled"); - - pthread_cleanup_pop(0); - pthread_cleanup_pop(0); - pthread_cleanup_pop(1); - - return NULL; -} - -int main(int argc, char * argv[]) -{ - int ret, i; - void * rc; - - pthread_mutexattr_t ma; - pthread_condattr_t ca; - pthread_t th; - - long altclk_ok, pshared_ok; - - struct - { - char altclk; /* Want to use alternative clock */ - char pshared; /* Want to use process-shared primitives */ - int type; /* mutex type */ - char * descr; /* Description of the case */ - - } scenar[] = - { {0, 0, PTHREAD_MUTEX_NORMAL, "Normal mutex" } -#ifdef USE_ALTCLK - ,{1, 0, PTHREAD_MUTEX_NORMAL, "Normal mutex + altclock cond" } - ,{1, 1, PTHREAD_MUTEX_NORMAL, "PShared mutex + altclock cond" } -#endif - ,{0, 1, PTHREAD_MUTEX_NORMAL, "Pshared mutex" } -#ifndef WITHOUT_XOPEN - ,{0, 0, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck mutex" } - ,{0, 0, PTHREAD_MUTEX_RECURSIVE , "Recursive mutex" } -#ifdef USE_ALTCLK - ,{1, 0, PTHREAD_MUTEX_RECURSIVE , "Recursive mutex + altclock cond" } - ,{1, 0, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck mutex + altclock cond" } - ,{1, 1, PTHREAD_MUTEX_RECURSIVE , "Recursive pshared mutex + altclock cond" } - ,{1, 1, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck pshared mutex + altclock cond" } -#endif - ,{0, 1, PTHREAD_MUTEX_RECURSIVE , "Recursive pshared mutex" } - ,{0, 1, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck pshared mutex" } -#endif - }; - - output_init(); - - /* Initialize the constants */ - altclk_ok = sysconf(_SC_CLOCK_SELECTION); - if (altclk_ok > 0) - altclk_ok = sysconf(_SC_MONOTONIC_CLOCK); -#ifndef USE_ALTCLK - if (altclk_ok > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - - pshared_ok = sysconf(_SC_THREAD_PROCESS_SHARED); - - #if VERBOSE > 0 - output("Test starting\n"); - output(" Process-shared primitive %s be tested\n", (pshared_ok>0)?"will":"won't"); - output(" Alternative clock for cond %s be tested\n", (altclk_ok>0)?"will":"won't"); - #endif - - ret = sem_init(&(data.semA), 0, 0); - if (ret != 0) { UNRESOLVED(errno, "Unable to init sem A"); } - - ret = sem_init(&(data.semB), 0, 0); - if (ret != 0) { UNRESOLVED(errno, "Unable to init sem B"); } - - for (i=0; i< (sizeof(scenar) / sizeof(scenar[0])); i++) - { - #if VERBOSE > 1 - output("Starting test for %s\n", scenar[i].descr); - #endif - - /* Initialize the data structure */ - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex attribute object init failed"); } - - ret = pthread_mutexattr_settype(&ma, scenar[i].type); - if (ret != 0) { UNRESOLVED(ret, "Unable to set mutex type"); } - - if ((pshared_ok > 0) && (scenar[i].pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set mutex process-shared"); } - } - - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "Cond attribute object init failed"); } - - if ((pshared_ok > 0) && (scenar[i].pshared != 0)) - { - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set cond process-shared"); } - } - - #ifdef USE_ALTCLK - if ((altclk_ok > 0) && (scenar[i].altclk != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "Unable to set alternative (monotonic) clock for cond"); } - } - #endif - - ret = pthread_mutex_init(&(data.mtx), &ma); - if (ret != 0) { UNRESOLVED(ret, "Unable to init mutex"); } - - ret = pthread_cond_init(&(data.cnd), &ca); - if (ret != 0) { UNRESOLVED(ret, "Unable to initialize condvar"); } - - ret = pthread_mutexattr_gettype(&ma, &(data.type)); - if (ret != 0) { UNRESOLVED(ret, "Unable to get type from mutex attr"); } - - #ifdef USE_ALTCLK - ret = pthread_condattr_getclock(&ca, &(data.cid)); - if (ret != 0) { UNRESOLVED(ret, "Unable to get clock ID from cond attr"); } - #else - data.cid = CLOCK_REALTIME; - #endif - - data.bool = 0; - - /** Data is ready, create the thread */ - #if VERBOSE > 1 - output("Initialization OK, starting thread\n"); - #endif - - ret = pthread_create(&th, NULL, threaded, NULL); - if (ret != 0) { UNRESOLVED(ret, "Thread creation failed"); } - - /** Wait for the thread to be waiting */ - do { - ret = sem_wait(&(data.semA)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem wait failed in main"); } - - ret = pthread_mutex_lock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock mutex in main"); } - - data.bool = 1; - - /** Cancel the thread */ - ret = pthread_cancel(th); - if (ret != 0) { UNRESOLVED(ret, "Thread cancelation failed"); } - - sched_yield(); - #ifndef WITHOUT_XOPEN - usleep(100); - #endif - - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock mutex in main"); } - - /** Wait for the thread to be executing second cleanup handler */ - do { - ret = sem_wait(&(data.semA)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem wait failed in main"); } - - /** Here the child should own the mutex, we check this */ - ret = pthread_mutex_trylock(&(data.mtx)); - if (ret == 0) { FAILED("The child did not own the mutex inside the cleanup handler"); } - - /** Let the cleanups go on */ - do { - ret = sem_post(&(data.semB)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem post failed in main"); } - - /** Join the thread */ - ret = pthread_join(th, &rc); - if (ret != 0) { UNRESOLVED(ret, "Unable to join the thread"); } - if (rc != PTHREAD_CANCELED) { FAILED("thread was not canceled"); } - - #if VERBOSE > 1 - output("Test passed for %s\n", scenar[i].descr); - #endif - - /* Destroy datas */ - ret = pthread_cond_destroy(&(data.cnd)); - if (ret != 0) { UNRESOLVED(ret, "Cond destroy failed"); } - - ret = pthread_mutex_destroy(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Mutex destroy failed"); } - - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Cond attribute destroy failed"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex attr destroy failed"); } - } /* Proceed to next case */ - - ret = sem_destroy(&(data.semA)); - if (ret != 0) { UNRESOLVED(errno, "Sem destroy failed"); } - - ret = sem_destroy(&(data.semB)); - if (ret != 0) { UNRESOLVED(errno, "Sem destroy failed"); } - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-7.c deleted file mode 100644 index c43466632d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/2-7.c +++ /dev/null @@ -1,607 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * When the function fails because of a timeout, - * it must reacquire the mutex (as when it is successful) - - * The steps are: - * -> For each mutex type; - * -> with and without process-shared primitive if this is supported; - * -> with different clocks if this is supported, - * -> Initialize a condvar and a mutex. - * -> Create a new thread (or process for process-shared condvars & mutex) - * -> The new thread (process) locks the mutex, then enters a timedwait which will timeout soon. - * -> The parent thread (process) then locks the mutex, ensures that the child is waiting, - * then sleeps until the timeout is terminated; and checks the child does not leave the wait function. - * -> The parent unlocks the mutex then waits for the child. - * -> The child checks that it owns the mutex; then it leaves. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes - and the mkstemp() routine */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define TIMEOUT (20) /* Number of microseconds to wait */ - -#ifndef WITHOUT_ALTCLK -#define USE_ALTCLK /* make tests with MONOTONIC CLOCK if supported */ -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN - -typedef struct -{ - pthread_mutex_t mtx; - pthread_cond_t cnd; - clockid_t cid; /* Clock id used by the cond var */ - int type; /* Mutex type */ - int ctrl; /* checkpoints */ - int bool; /* Boolean predicate for the condition */ - int status; /* error code */ -} testdata_t; - -struct _scenar -{ - int m_type; /* Mutex type to use */ - int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */ - int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */ - int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_DEFAULT, 0, 0, 0, "Default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 0, 0, 0, "Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 0, 0, "Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 0, 0, "Recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, 0, "PShared default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 1, 0, 0, "Pshared normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, 0, "Pshared errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, 0, "Pshared recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, 1, "Pshared default mutex across processes"} - ,{PTHREAD_MUTEX_NORMAL, 1, 0, 1, "Pshared normal mutex across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, 1, "Pshared errorcheck mutex across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, 1, "Pshared recursive mutex across processes"} - -#ifdef USE_ALTCLK - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, 1, "Pshared default mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_NORMAL, 1, 1, 1, "Pshared normal mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, 1, "Pshared errorcheck mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, 1, "Pshared recursive mutex and alt clock condvar across processes"} - - ,{PTHREAD_MUTEX_DEFAULT, 0, 1, 0, "Default mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_NORMAL, 0, 1, 0, "Normal mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 1, 0, "Errorcheck mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 1, 0, "Recursive mutex and alt clock condvar"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, 0, "PShared default mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_NORMAL, 1, 1, 0, "Pshared normal mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, 0, "Pshared errorcheck mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, 0, "Pshared recursive mutex and alt clock condvar"} -#endif -}; - -void * tf(void * arg) -{ - int ret=0; - struct timespec ts; - - testdata_t * td = (testdata_t *)arg; - - /* Lock the mutex */ - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) - { - td->status = ret; - UNRESOLVED(ret, "[child] Unable to lock the mutex"); - } - - /* Tell the parent the mutex is locked */ - td->ctrl = 1; - - /* Prepare the timeout parameter */ - ret = clock_gettime(td->cid, &ts); - if (ret != 0) - { - td->status = ret; - UNRESOLVED(errno, "[child] Unable get clock time"); - } - - /* Compute the timeout */ - ts.tv_nsec += TIMEOUT * 1000; - if (ts.tv_nsec >= 1000000000) - { - ts.tv_sec++; - ts.tv_nsec -= 1000000000; - } - #if VERBOSE > 1 - output("[child] Will timeout at %i.%09i\n", ts.tv_sec, ts.tv_nsec); - #endif - - /* Enter the timed wait */ - do - { - ret = pthread_cond_timedwait(&(td->cnd), &(td->mtx), &ts); - td->ctrl = 2; - } while ((ret == 0) && (td->bool == 0)); - - td->ctrl = 3; - - if (ret != ETIMEDOUT) - { - td->status = ret; - UNRESOLVED(ret, "[child] Cond timedwait returned an error"); - } - - /* Make sure we are owning the mutex */ - ret = pthread_mutex_trylock(&(td->mtx)); - if (td->type == PTHREAD_MUTEX_RECURSIVE) - { - #if VERBOSE > 1 - output("[child] Recursive mutex. Test if we are able to re-lock.\n"); - #endif - if (ret != 0) - { - td->status = ret; - FAILED("[child] Unable to relock the recursive mutex"); - } - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) - { - td->status = ret; - UNRESOLVED(ret, "[child] Failed to unlock the mutex"); - } - } - else /* This was not a recursive mutex; the call must have failed */ - { - if (ret == 0) - { - td->status = -1; - FAILED("[child] Thread did not owned the mutex after the timedwait return."); - } - if (ret != EBUSY) - { - td-> status = ret; - UNRESOLVED(ret, "[child] Mutex trylock did not return EBUSY"); - } - #if VERBOSE > 1 - output("[child] The mutex was busy (normal).\n"); - #endif - } - - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) - { - td->status=ret; - output("[child] Got error %i: %s\n", ret, strerror(ret)); - FAILED("[child] Failed to unlock the mutex - owned by another thread?"); - } - - td->ctrl = 4; - return NULL; -} - - -int main(int argc, char * argv[]) -{ - int ret, i; - pthread_mutexattr_t ma; - pthread_condattr_t ca; - - testdata_t * td; - - int do_fork; - - pid_t child_pr=0, chkpid; - int status; - pthread_t child_th; - - long pshared, monotonic, cs, mf; - - output_init(); - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - cs = sysconf(_SC_CLOCK_SELECTION); - monotonic = sysconf(_SC_MONOTONIC_CLOCK); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TPS : %li\n", pshared); - output(" CS : %li\n", cs); - output(" MON : %li\n", monotonic); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - if ((cs < 0) || (monotonic < 0)) - output("Alternative clock won't be tested\n"); - #endif - - /* We are not interested in testing the clock if we have no other clock available.. */ - if (monotonic < 0) - cs = -1; -#ifndef USE_ALTCLK - if (cs > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file, we use an alternative method */ - testdata_t alternativ; - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/cond_timedwait_2-4-XXXXXX"; - size_t sz; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - sz= (size_t)sysconf(_SC_PAGESIZE); - - tmp = calloc(1, sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory.\n"); - #endif - } - - -/********** - * For each test scenario, initialize the attributes and other variables. - */ - for ( i=0; i< (sizeof(scenarii) / sizeof(scenarii[0])); i++) - { - #if VERBOSE > 1 - output("[parent] Preparing attributes for scenario %i\n", i); - #endif - /* set / reset everything */ - do_fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the cond attribute object"); } - - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[i].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #if VERBOSE > 1 - output("[parent] Mutex type : %i\n", scenarii[i].m_type); - #endif - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[i].mc_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the cond var process-shared"); } - #if VERBOSE > 1 - output("[parent] Mutex & cond are process-shared\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Mutex & cond are process-private\n"); - } - #endif - - /* Set the alternative clock, if supported */ - #ifdef USE_ALTCLK - if ((cs > 0) && (scenarii[i].c_clock != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the monotonic clock for the cond"); } - #if VERBOSE > 1 - output("[parent] Cond uses the Monotonic clock\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Cond uses the default clock\n"); - } - #endif - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[i].fork != 0)) - { - do_fork = 1; - #if VERBOSE > 1 - output("[parent] Child will be a new process\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Child will be a new thread\n"); - } - #endif - - -/********** - * Initialize the testdata_t structure with the previously defined attributes - */ - /* Initialize the mutex */ - ret = pthread_mutex_init(&(td->mtx), &ma); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Mutex init failed"); } - - /* initialize the condvar */ - ret = pthread_cond_init(&(td->cnd), &ca); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Cond init failed"); } - - /* Initialize the other datas from the test structure */ - #ifdef USE_ALTCLK - ret = pthread_condattr_getclock(&ca, &(td->cid)); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Unable to read cond clock attribute"); } - #else - td->cid=CLOCK_REALTIME; - #endif - - ret = pthread_mutexattr_gettype(&ma, &(td->type)); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Unable to read mutex type attribute"); } - - td->ctrl=0; - td->bool=0; - td->status=0; - -/********** - * Proceed to the actual testing - */ - - /* Create the child */ - if (do_fork != 0) - { - /* We are testing across two processes */ - child_pr = fork(); - if (child_pr == -1) - { UNRESOLVED(errno, "[parent] Fork failed"); } - - if (child_pr == 0) - { - #if VERBOSE > 1 - output("[child] Child process starting...\n"); - #endif - - if (tf((void *)td) != NULL) - { - UNRESOLVED( -1, "[child] Got an unexpected return value from test function"); - } - else - { - /* We cannot use the PASSED macro here since it would terminate the output */ - exit (0); - } - } - /* Only the parent process goes further */ - } - else /* do_fork == 0 */ - { - /* We are testing across two threads */ - ret = pthread_create(&child_th, NULL, tf, td); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to create the child thread."); } - } - - /* Note: in case of an error, the child process will be alive for 1 sec then exit. */ - - /* Child is now running and will enter the timedwait */ - /* We are waiting for this; and we have to monitor the status value as well. */ - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to lock the mutex"); } - - while ((td->ctrl == 0) && (td->status == 0)) - { - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to unlock the mutex"); } - sched_yield(); - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to lock the mutex"); } - } - - if ((td->ctrl == 2) && (td->status == 0)) /* Spurious wakeups hapenned */ - { - output("Spurious wake ups have happened. Maybe pthread_cond_timedwait is broken?\n"); - td->ctrl = 1; - } - - if (td->ctrl == 1)/* The child is inside the cond timedwait */ - { - #if VERBOSE > 1 - output("[parent] Child has not timedout yet, we will wait.\n"); - #endif - - /* Let the child leave the wait function if something is broken */ - usleep(TIMEOUT); - - - if (td->ctrl != 1) - { - FAILED("[parent] Child went out from pthread_cond_timedwait without locking the mutex"); - } - - } - - /* Let the child do its checking */ - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to unlock the mutex"); } - - /* Wait for the child to terminate */ - if (do_fork != 0) - { - /* We were testing across two processes */ - chkpid = waitpid(child_pr, &status, 0); - if (chkpid != child_pr) - { - output("Expected pid: %i. Got %i\n", (int)child_pr, (int)chkpid); - UNRESOLVED(errno, "Waitpid failed"); - } - if (WIFSIGNALED(status)) - { - output("Child process killed with signal %d\n",WTERMSIG(status)); - UNRESOLVED( td->status , "Child process was killed"); - } - - if (WIFEXITED(status)) - { - ret = WEXITSTATUS(status); - } - else - { - UNRESOLVED( td->status, "Child process was neither killed nor exited"); - } - - if (ret != 0) - { - exit(ret); /* Output has already been closed in child */ - } - } - else /* child was a thread */ - { - ret = pthread_join(child_th, NULL); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to join the thread"); } - } - -/********** - * Destroy the data - */ - ret = pthread_cond_destroy(&(td->cnd)); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var"); } - - ret = pthread_mutex_destroy(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var attribute object"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - } /* Proceed to the next scenario */ - - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/3-1.c deleted file mode 100644 index 0d4e356b02..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/3-1.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_timedwait() - * Upon successful completion, a value of zero shall be returned. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define INTERVAL 1 -#define TIMEOUT 5 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -int t1_start = 0; -int signaled = 0; - -void *t1_func(void *arg) -{ - int rc; - struct timespec timeout; - struct timeval curtime; - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to acquire the mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 started\n"); - t1_start = 1; /* let main thread continue */ - - if (gettimeofday(&curtime, NULL) !=0 ) { - fprintf(stderr,"Fail to get current time\n"); - exit(PTS_UNRESOLVED); - } - timeout.tv_sec = curtime.tv_sec + TIMEOUT; - timeout.tv_nsec = curtime.tv_usec * 1000; - - fprintf(stderr,"Thread1 is waiting for the cond\n"); - rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout); - if (rc != 0) { - if (rc == ETIMEDOUT) { - fprintf(stderr,"Thread1 stops waiting when time is out\n"); - exit(PTS_UNRESOLVED); - } - else { - fprintf(stderr,"pthread_cond_timedwait return %d\n", rc); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - } - - if (signaled == 0) { - fprintf(stderr,"Thread1 did not block on the cond at all\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 wakened and got returned value 0\n"); - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to release the mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 released the mutex\n"); - return NULL; -} - -int main() -{ - pthread_t thread1; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { - fprintf(stderr,"Fail to create thread 1\n"); - return PTS_UNRESOLVED; - } - while(!t1_start) /* wait for thread1 started */ - usleep(100); - - /* acquire the mutex released by pthread_cond_wait() within thread 1 */ - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Main failed to acquire mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"Main failed to release mutex\n"); - return PTS_UNRESOLVED; - } - sleep(INTERVAL); - - fprintf(stderr,"Time to wake up thread1 by signaling a condition\n"); - signaled = 1; - if (pthread_cond_signal(&td.cond) != 0) { - fprintf(stderr,"Main failed to signal the condition\n"); - return PTS_UNRESOLVED; - } - - pthread_join(thread1, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/4-1.c deleted file mode 100644 index 61cf2d8b00..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/4-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_timedwait() - * shall return ETIMEDOUT if the time specified by 'abstime' has passed. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 3 - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -void *t1_func(void *arg) -{ - int rc; - struct timespec timeout; - struct timeval curtime; - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to acquire the mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 started\n"); - - if (gettimeofday(&curtime, NULL) !=0 ) { - fprintf(stderr,"Fail to get current time\n"); - exit(PTS_UNRESOLVED); - } - timeout.tv_sec = curtime.tv_sec + TIMEOUT; - timeout.tv_nsec = curtime.tv_usec * 1000; - - fprintf(stderr,"Thread1 is waiting for the cond for %d seconds\n", TIMEOUT); - rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout); - if (rc == ETIMEDOUT) { - fprintf(stderr,"Thread1 stops waiting when time is out\n"); - printf("Test PASSED\n"); - exit(PTS_PASS); - } - else { - fprintf(stderr,"pthread_cond_timedwait return %d instead of ETIMEDOUT\n", rc); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } -} - -int main() -{ - pthread_t thread1; - int th_ret; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { - fprintf(stderr,"Fail to create thread 1\n"); - return PTS_UNRESOLVED; - } - - fprintf(stderr,"Main: no condition is going to be met\n"); - - pthread_join(thread1, (void*)&th_ret); - return th_ret; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/4-2.c deleted file mode 100644 index e6a6507f8d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/4-2.c +++ /dev/null @@ -1,561 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * When the abstime parameter is invalid, - * the function must return EINVAL and - * the mutex state must not have changed during the call. - - * The steps are: - * -> parent (for each mutex type and each condvar options, across threads or processes) - * -> locks the mutex m - * -> sets ctrl = 0 - * -> creates a bunch of children, which: - * -> lock the mutex m - * -> if ctrl == 0, test has failed - * -> unlock the mutex then exit - * -> calls pthread_cond_timedwait with invalid values (nsec > 999999999) - * -> sets ctrl = non-zero value - * -> unlocks the mutex m - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes - and the mkstemp() routine */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define NCHILDREN (20) - -#ifndef WITHOUT_ALTCLK -#define USE_ALTCLK /* make tests with MONOTONIC CLOCK if supported */ -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN - -typedef struct -{ - pthread_mutex_t mtx; - int ctrl; /* Control value */ - int gotit; /* Thread locked the mutex while ctrl == 0 */ - int status; /* error code */ -} testdata_t; - -struct _scenar -{ - int m_type; /* Mutex type to use */ - int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */ - int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */ - int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_DEFAULT, 0, 0, 0, "Default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 0, 0, 0, "Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 0, 0, "Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 0, 0, "Recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, 0, "PShared default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 1, 0, 0, "Pshared normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, 0, "Pshared errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, 0, "Pshared recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, 1, "Pshared default mutex across processes"} - ,{PTHREAD_MUTEX_NORMAL, 1, 0, 1, "Pshared normal mutex across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, 1, "Pshared errorcheck mutex across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, 1, "Pshared recursive mutex across processes"} - -#ifdef USE_ALTCLK - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, 1, "Pshared default mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_NORMAL, 1, 1, 1, "Pshared normal mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, 1, "Pshared errorcheck mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, 1, "Pshared recursive mutex and alt clock condvar across processes"} - - ,{PTHREAD_MUTEX_DEFAULT, 0, 1, 0, "Default mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_NORMAL, 0, 1, 0, "Normal mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 1, 0, "Errorcheck mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 1, 0, "Recursive mutex and alt clock condvar"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, 0, "PShared default mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_NORMAL, 1, 1, 0, "Pshared normal mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, 0, "Pshared errorcheck mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, 0, "Pshared recursive mutex and alt clock condvar"} -#endif -}; - -struct { - long sec_val; /* Value for seconds */ - short sec_is_offset; /* Seconds value is added to current time or is absolute */ - long nsec_val; /* Value for nanoseconds */ - short nsec_is_offset; /* Nanoseconds value is added to current time or is absolute */ -} -junks_ts[]={ - { -2 , 1, 1000000000, 1 } - ,{ -2 , 1, -1, 0 } - ,{ -3 , 1, 2000000000, 0 } -}; - - -void * tf(void * arg) -{ - int ret=0; - - testdata_t * td = (testdata_t *)arg; - - /* Lock the mutex */ - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) - { - td->status = ret; - UNRESOLVED(ret, "[child] Unable to lock the mutex"); - } - - /* Checks whether the parent release the lock inside the timedwait function */ - if (td->ctrl == 0) - td->gotit += 1; - - /* Unlock and exit */ - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) - { - td->status=ret; - UNRESOLVED(ret, "[child] Failed to unlock the mutex."); - } - return NULL; -} - - -int main(int argc, char * argv[]) -{ - int ret, i, j, k; - pthread_mutexattr_t ma; - pthread_condattr_t ca; - pthread_cond_t cnd; - clockid_t cid = CLOCK_REALTIME; - struct timespec ts, ts_junk; - - testdata_t * td; - testdata_t alternativ; - - int do_fork; - - pid_t child_pr[NCHILDREN], chkpid; - int status; - pthread_t child_th[NCHILDREN]; - - long pshared, monotonic, cs, mf; - - output_init(); - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - cs = sysconf(_SC_CLOCK_SELECTION); - monotonic = sysconf(_SC_MONOTONIC_CLOCK); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TPS : %li\n", pshared); - output(" CS : %li\n", cs); - output(" MON : %li\n", monotonic); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - if ((cs < 0) || (monotonic < 0)) - output("Alternative clock won't be tested\n"); - #endif - - /* We are not interested in testing the clock if we have no other clock available.. */ - if (monotonic < 0) - cs = -1; - -#ifndef USE_ALTCLK - if (cs > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file, we use an alternative method */ - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/cond_timedwait_2-4-XXXXXX"; - size_t sz; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - sz= (size_t)sysconf(_SC_PAGESIZE); - - tmp = calloc(1, sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory.\n"); - #endif - } - - -/********** - * For each test scenario, initialize the attributes and other variables. - * Do the whole thing for each time to test. - */ - for ( i=0; i< (sizeof(scenarii) / sizeof(scenarii[0])); i++) - { - for ( j=0; j< (sizeof(junks_ts) / sizeof(junks_ts[0])); j++) - { - #if VERBOSE > 1 - output("[parent] Preparing attributes for: %s\n", scenarii[i].descr); - #endif - /* set / reset everything */ - do_fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the cond attribute object"); } - - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[i].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #if VERBOSE > 1 - output("[parent] Mutex type : %i\n", scenarii[i].m_type); - #endif - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[i].mc_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the cond var process-shared"); } - #if VERBOSE > 1 - output("[parent] Mutex & cond are process-shared\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Mutex & cond are process-private\n"); - } - #endif - - /* Set the alternative clock, if supported */ - #ifdef USE_ALTCLK - if ((cs > 0) && (scenarii[i].c_clock != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the monotonic clock for the cond"); } - #if VERBOSE > 1 - output("[parent] Cond uses the Monotonic clock\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Cond uses the default clock\n"); - } - #endif - ret = pthread_condattr_getclock(&ca, &cid); - if (ret != 0) { UNRESOLVED(ret, "Unable to get clock from cond attr"); } - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[i].fork != 0)) - { - do_fork = 1; - #if VERBOSE > 1 - output("[parent] Child will be a new process\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Child will be a new thread\n"); - } - #endif - - /* initialize the condvar */ - ret = pthread_cond_init(&cnd, &ca); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Cond init failed"); } - - -/********** - * Initialize the testdata_t structure with the previously defined attributes - */ - /* Initialize the mutex */ - ret = pthread_mutex_init(&(td->mtx), &ma); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Mutex init failed"); } - - /* Initialize the other datas from the test structure */ - td->ctrl=0; - td->gotit=0; - td->status=0; - -/********** - * Proceed to the actual testing - */ - /* Lock the mutex before creating children */ - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to lock the mutex"); } - - /* Create the children */ - if (do_fork != 0) - { - /* We are testing across processes */ - for (k=0; k 3 - output("[child] Child process %i starting...\n", k); - #endif - - if (tf((void *)td) != NULL) - { - UNRESOLVED( -1, "[child] Got an unexpected return value from test function"); - } - else - { - /* We cannot use the PASSED macro here since it would terminate the output */ - exit (0); - } - } - } - /* Only the parent process goes further */ - } - else /* do_fork == 0 */ - { - /* We are testing across two threads */ - for (k=0; k 2 - output("TS: s = %s%li ; ns = %s%li\n", - junks_ts[j].sec_is_offset?"n + ":" ", - junks_ts[j].sec_val, - junks_ts[j].nsec_is_offset?"n + ":" ", - junks_ts[j].nsec_val); - output("Now is: %i.%09li\n", ts.tv_sec, ts.tv_nsec); - output("Junk is: %i.%09li\n", ts_junk.tv_sec, ts_junk.tv_nsec); - #endif - - do { - ret = pthread_cond_timedwait(&cnd, &(td->mtx), &ts_junk); - } while (ret == 0); - #if VERBOSE > 2 - output("timedwait returns %d (%s) - gotit = %d\n", ret, strerror(ret), td->gotit); - #endif - - /* check that when EINVAL is returned, the mutex has not been released */ - if (ret == EINVAL) - { - if (td->gotit != 0) - { - FAILED("The mutex was released when an invalid timestamp was detected in the function"); - } - #if VERBOSE > 0 - } else { - output("Warning, struct timespec with tv_sec = %i and tv_nsec = %li was not invalid\n", ts_junk.tv_sec, ts_junk.tv_nsec); - } - #endif - - /* Finally unlock the mutex */ - td->ctrl = 1; - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to unlock the mutex"); } - - /* Wait for the child to terminate */ - if (do_fork != 0) - { - /* We were testing across processes */ - ret = 0; - for (k=0; k< NCHILDREN; k++) - { - chkpid = waitpid(child_pr[k], &status, 0); - if (chkpid != child_pr[k]) - { - output("Expected pid: %i. Got %i\n", (int)child_pr[k], (int)chkpid); - UNRESOLVED(errno, "Waitpid failed"); - } - if (WIFSIGNALED(status)) - { - output("Child process killed with signal %d\n",WTERMSIG(status)); - UNRESOLVED( -1 , "Child process was killed"); - } - - if (WIFEXITED(status)) - { - ret |= WEXITSTATUS(status); - } - else - { - UNRESOLVED( -1, "Child process was neither killed nor exited"); - } - } - if (ret != 0) - { - exit(ret); /* Output has already been closed in child */ - } - - } - else /* child was a thread */ - { - for (k=0; kmtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var attribute object"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - } /* Proceed to the next junk timedwait value */ - } /* Proceed to the next scenario */ - - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/4-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/4-3.c deleted file mode 100644 index 9c8e1ed0eb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/4-3.c +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * This sample test aims to check the following assertion: - * The function does not return an error code of EINTR - - - * The steps are: - * - * -> Create a thread which wait in a condition for a small time. - * -> Another thread will signal this condition from time to time. - * -> Another thread which loops on sending a signal to the first thread. - * - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#define WITH_SYNCHRO -#ifndef VERBOSE -#define VERBOSE 2 -#endif - -#define TIMEOUT (1000) /* ns, timeout parameter for pthread_cond_timedwait */ -#define INTERVAL (700) /* ns, frequency (actually, period) for the condition signaling */ - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -char do_it=1; -unsigned long count_cnd_sig=0, count_cnd_wup=0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -struct -{ - pthread_mutex_t mtx; - pthread_cond_t cnd; -} data; - -/* the following function keeps on sending the signal to the process */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - pid_t process; - - process=getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - ret = kill(process, thearg->sig); - if (ret != 0) { UNRESOLVED(errno, "Kill in sendsig"); } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -/* This one is registered for signal SIGUSR2 */ -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* The following function will timedwait on the cond - * it does check that no error code of EINTR is returned */ -void * waiter(void * arg) -{ - int ret; - struct timespec ts; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_UNBLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread"); } - - ret = pthread_mutex_lock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock mutex in waiter thread"); } - - while (do_it) - { - ret = clock_gettime(CLOCK_REALTIME, &ts); - if (ret != 0) { UNRESOLVED(ret, "Unable to get system time"); } - - ts.tv_nsec += TIMEOUT; - while (ts.tv_nsec >= 1000000000) - { - ts.tv_nsec -= 1000000000; - ts.tv_sec += 1; - } - - do - { - ret = pthread_cond_timedwait(&(data.cnd),&(data.mtx),&ts); - count_cnd_wup++; - } while (ret == 0); - - if (ret == EINTR) - { - FAILED("pthread_cond_timedwait returned EINTR"); - } - - if (ret != ETIMEDOUT) - { - UNRESOLVED(ret, "pthread_cond_timedwait returned an unexpected error"); - } - } - - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock mutex in waiter thread"); } - - return NULL; -} - - -/* The next function will signal the condition at periodic interval */ -void * worker (void * arg) -{ - int ret=0; - - struct timespec ts, tsrem; - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - ts.tv_sec=0; - ts.tv_nsec= INTERVAL; - while (ts.tv_nsec >= 1000000000) - { - ts.tv_nsec -= 1000000000; - ts.tv_sec +=1; - } - - while (do_it) - { - tsrem.tv_sec = ts.tv_sec; - tsrem.tv_nsec = ts.tv_nsec; - - do { ret = nanosleep(&tsrem, &tsrem); } - while ((ret != 0) && (errno == EINTR)); - - ret = pthread_cond_signal(&(data.cnd)); - if (ret != 0) { UNRESOLVED(ret, "Failed to signal the condition"); } - count_cnd_sig++; - } - - return NULL; -} - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_waiter, th_worker, th_sig1, th_sig2; - thestruct arg1, arg2; - struct sigaction sa; - - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset(&usersigs); - ret = sigaddset(&usersigs, SIGUSR1); - ret |= sigaddset(&usersigs, SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Unable to add SIGUSR1 or 2 to a signal set"); } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread"); } - - - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - if ((ret = pthread_create(&th_waiter, NULL, waiter, NULL))) - { UNRESOLVED(ret, "Waiter thread creation failed"); } - - if ((ret = pthread_create(&th_worker, NULL, worker, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - /* Let's wait for a while now */ - sleep(1); - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - if ((ret = pthread_join(th_worker, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - if ((ret = pthread_join(th_waiter, NULL))) - { UNRESOLVED(ret, "Waiter thread join failed"); } - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" Condition was signaled %d times.\n", count_cnd_sig); - output(" pthread_timed_wait exited %d times.\n", count_cnd_wup); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/assertions.xml deleted file mode 100644 index de648ec4d9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/assertions.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - The function - int pthread_cond_timedwait(pthread_cond_t *restrict cond, - pthread_mutex_t *restrict mutex); - const struct timespec *restrict abstime); - shall block on a condition variable. It shall be called with mutex locked - by the calling thread or undefined behavior results. - - - - The pthread_cond_timedwait() function shall be equivalent to pthread_cond_wait(), except that an - error is returned if the absolute time specified by abstime passes (that is, system time equals or - exceeds abstime) before the condition cond is signaled or broadcasted, or if the absolute time - specified by abstime has already been passed at the time of the call. - - - - Upon successful completion, a value of zero shall be returned; - - - - The pthread_cond_timedwait() function shall fail if: - [ETIMEDOUT] The time specified by 'abstime' has passed. - The pthread_cond_timedwait() function may fail if: - [EINVAL] The value specified by cond, mutex,or abstime is invalid. - [EINVAL] Different mutexes were supplied for concurrent pthread_cond_timedwait() or - pthread_cond_wait() operations on the same condition variable. - [EPERM] The mutex was not owned by the current thread at the time of the call. - These functions shall not return an error code of [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/coverage.txt deleted file mode 100644 index 86f41dd489..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/coverage.txt +++ /dev/null @@ -1,12 +0,0 @@ -This document defines the coverage for the pthread_cond_timedwait function: - -Assertion Tested? -1 YES -2 YES *2-2 and 2-3 seem to pass but hang on nptl 0.36 -3 YES -4 YES * When it specifies it 'may' fail and not 'shall' fail, - it will always return PASS, but will return a - PASS and print out a warning if it fails. - * Tested EINVAL when abs time spec is invalid - * Tested EINTR -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/testfrmw.c deleted file mode 100644 index 575dbe8c3e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/testfrmw.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - pthread_mutex_lock(&m_trace); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_timedwait/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/1-1.c deleted file mode 100644 index ca73489320..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/1-1.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_wait() - * shall block on a condition variable. It shall be called with mutex locked - * by the calling thread or undefined behavior results. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -pthread_t thread1; - -int t1_start = 0; -int signaled = 0; - -/* Alarm handler */ -void alarm_handler(int signo) -{ - printf("Error: failed to wakeup thread\n"); - pthread_cancel(thread1); - exit(PTS_UNRESOLVED); -} - -void *t1_func(void *arg) -{ - int rc; - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to acquire mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 started\n"); - t1_start = 1; /* let main thread continue */ - - fprintf(stderr,"Thread1 is waiting for the cond\n"); - rc = pthread_cond_wait(&td.cond, &td.mutex); - if (rc != 0) { - fprintf(stderr,"pthread_cond_wait return %d\n", rc); - exit(PTS_UNRESOLVED); - } - - fprintf(stderr,"Thread1 wakened\n"); - if (signaled == 0) { - fprintf(stderr,"Thread1 did not block on the cond at all\n"); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - pthread_mutex_unlock(&td.mutex); - return NULL; -} - -int main() -{ - struct sigaction act; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { - fprintf(stderr,"Fail to create thread 1\n"); - return PTS_UNRESOLVED; - } - while(!t1_start) /* wait for thread1 started */ - usleep(100); - - /* acquire the mutex released by pthread_cond_wait() within thread 1 */ - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Main: Fail to acquire mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"Main: Fail to release mutex\n"); - return PTS_UNRESOLVED; - } - sleep(2); - - /* Setup alarm handler */ - act.sa_handler=alarm_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - alarm(5); - - fprintf(stderr,"Time to wake up thread1 by signaling a condition\n"); - signaled = 1; - if (pthread_cond_signal(&td.cond) != 0) { - fprintf(stderr,"Main: Fail to signal cond\n"); - return PTS_UNRESOLVED; - } - - pthread_join(thread1, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/2-1.c deleted file mode 100644 index c3e13fdfe6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/2-1.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_wait() - * Upon successful return, the mutex shall have been locked and shall be owned - * by the calling thread. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -pthread_t thread1; - -int t1_start = 0; -int signaled = 0; - -/* Alarm handler */ -void alarm_handler(int signo) -{ - printf("Error: failed to wakeup thread\n"); - pthread_cancel(thread1); - exit(PTS_UNRESOLVED); -} - -void *t1_func(void *arg) -{ - int rc; - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to acquire the mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 started\n"); - t1_start = 1; /* let main thread continue */ - - fprintf(stderr,"Thread1 is waiting for the cond\n"); - rc = pthread_cond_wait(&td.cond, &td.mutex); - if(rc != 0) { - fprintf(stderr,"pthread_cond_wait return %d\n", rc); - exit(PTS_UNRESOLVED); - } - - fprintf(stderr,"Thread1 wakened\n"); - if(signaled == 0) { - fprintf(stderr,"Thread1 did not block on the cond at all\n"); - exit(PTS_UNRESOLVED); - } - - if (pthread_mutex_trylock(&td.mutex) == 0) { - fprintf(stderr,"Thread1 should not be able to lock the mutex again\n"); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr,"Thread1 failed to trylock the mutex (as expected)\n"); - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to release the mutex\n"); - printf("Test FAILED\n"); - exit(PTS_FAIL); - } - fprintf(stderr,"Thread1 released the mutex\n"); - return NULL; -} - -int main() -{ - - struct sigaction act; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { - fprintf(stderr,"Fail to create thread 1\n"); - return PTS_UNRESOLVED; - } - while(!t1_start) /* wait for thread1 started */ - usleep(100); - - /* acquire the mutex released by pthread_cond_wait() within thread 1 */ - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Main failed to acquire mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"Main failed to release mutex\n"); - return PTS_UNRESOLVED; - } - sleep(1); - - /* Setup alarm handler */ - act.sa_handler=alarm_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - alarm(5); - - fprintf(stderr,"Time to wake up thread1 by signaling a condition\n"); - signaled = 1; - if (pthread_cond_signal(&td.cond) != 0) { - fprintf(stderr,"Main failed to signal the condition\n"); - return PTS_UNRESOLVED; - } - - pthread_join(thread1, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/2-2.c deleted file mode 100644 index bde3894099..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/2-2.c +++ /dev/null @@ -1,586 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * When the function returns successfully, everything is as if - * the thread had locked the mutex. - * - - * The steps are: - * -> For each mutex type; - * -> with and without process-shared primitive if this is supported; - * -> with different clocks if this is supported, - * -> Initialize a condvar and a mutex. - * -> Create a new thread (or process for process-shared condvars & mutex) - * -> The new thread (process) locks the mutex, then waits for the condition . - * -> The parent thread (process) then locks the mutex, ensures that the child is waiting, - * then signals the condition; and checks the child does not leave the wait function. - * -> The parent unlocks the mutex then joins the child. - * -> The child checks that it owns the mutex; then it leaves. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes - and the mkstemp() routine */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#ifndef WITHOUT_ALTCLK -#define USE_ALTCLK /* make tests with MONOTONIC CLOCK if supported */ -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN - -typedef struct -{ - pthread_mutex_t mtx; - pthread_cond_t cnd; - clockid_t cid; /* Clock id used by the cond var */ - int type; /* Mutex type */ - int ctrl; /* checkpoints */ - int bool; /* Boolean predicate for the condition */ - int status; /* error code */ -} testdata_t; - -struct _scenar -{ - int m_type; /* Mutex type to use */ - int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */ - int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */ - int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_DEFAULT, 0, 0, 0, "Default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 0, 0, 0, "Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 0, 0, "Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 0, 0, "Recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, 0, "PShared default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 1, 0, 0, "Pshared normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, 0, "Pshared errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, 0, "Pshared recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, 1, "Pshared default mutex across processes"} - ,{PTHREAD_MUTEX_NORMAL, 1, 0, 1, "Pshared normal mutex across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, 1, "Pshared errorcheck mutex across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, 1, "Pshared recursive mutex across processes"} - -#ifdef USE_ALTCLK - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, 1, "Pshared default mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_NORMAL, 1, 1, 1, "Pshared normal mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, 1, "Pshared errorcheck mutex and alt clock condvar across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, 1, "Pshared recursive mutex and alt clock condvar across processes"} - - ,{PTHREAD_MUTEX_DEFAULT, 0, 1, 0, "Default mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_NORMAL, 0, 1, 0, "Normal mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 1, 0, "Errorcheck mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 1, 0, "Recursive mutex and alt clock condvar"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, 0, "PShared default mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_NORMAL, 1, 1, 0, "Pshared normal mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, 0, "Pshared errorcheck mutex and alt clock condvar"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, 0, "Pshared recursive mutex and alt clock condvar"} -#endif -}; - -void * tf(void * arg) -{ - int ret=0; - - testdata_t * td = (testdata_t *)arg; - - /* Lock the mutex */ - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) - { - td->status = ret; - UNRESOLVED(ret, "[child] Unable to lock the mutex"); - } - - /* Tell the parent the mutex is locked */ - td->ctrl = 1; - - /* Enter the wait */ - do - { - ret = pthread_cond_wait(&(td->cnd), &(td->mtx)); - td->ctrl = 2; - } while ((ret == 0) && (td->bool == 0)); - - td->ctrl = 3; - - if (ret != 0) - { - td->status = ret; - UNRESOLVED(ret, "[child] Cond wait returned an error"); - } - - /* Make sure we are owning the mutex */ - ret = pthread_mutex_trylock(&(td->mtx)); - if (td->type == PTHREAD_MUTEX_RECURSIVE) - { - #if VERBOSE > 1 - output("[child] Recursive mutex. Test if we are able to re-lock.\n"); - #endif - if (ret != 0) - { - td->status = ret; - FAILED("[child] Unable to relock the recursive mutex"); - } - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) - { - td->status = ret; - UNRESOLVED(ret, "[child] Failed to unlock the mutex"); - } - } - else /* This was not a recursive mutex; the call must have failed */ - { - if (ret == 0) - { - td->status = -1; - FAILED("[child] Thread did not owned the mutex after the wait return."); - } - if (ret != EBUSY) - { - td-> status = ret; - UNRESOLVED(ret, "[child] Mutex trylock did not return EBUSY"); - } - #if VERBOSE > 1 - output("[child] The mutex was busy (normal).\n"); - #endif - } - - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) - { - td->status=ret; - output("[child] Got error %i: %s\n", ret, strerror(ret)); - FAILED("[child] Failed to unlock the mutex - owned by another thread?"); - } - - td->ctrl = 4; - return NULL; -} - - -int main(int argc, char * argv[]) -{ - int ret, i; - pthread_mutexattr_t ma; - pthread_condattr_t ca; - - testdata_t * td; - testdata_t alternativ; - - int do_fork; - - pid_t child_pr=0, chkpid; - int status; - pthread_t child_th; - - long pshared, monotonic, cs, mf; - - output_init(); - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - cs = sysconf(_SC_CLOCK_SELECTION); - monotonic = sysconf(_SC_MONOTONIC_CLOCK); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TPS : %li\n", pshared); - output(" CS : %li\n", cs); - output(" MON : %li\n", monotonic); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - if ((cs < 0) || (monotonic < 0)) - output("Alternative clock won't be tested\n"); - #endif - - /* We are not interested in testing the clock if we have no other clock available.. */ - if (monotonic < 0) - cs = -1; - -#ifndef USE_ALTCLK - if (cs > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file, we use an alternative method */ - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/cond_wait_2-2-XXXXXX"; - size_t sz; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - sz= (size_t)sysconf(_SC_PAGESIZE); - - tmp = calloc(1, sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory.\n"); - #endif - } - - -/********** - * For each test scenario, initialize the attributes and other variables. - */ - for ( i=0; i< (sizeof(scenarii) / sizeof(scenarii[0])); i++) - { - #if VERBOSE > 1 - output("[parent] Preparing attributes for: %s\n", scenarii[i].descr); - #endif - /* set / reset everything */ - do_fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the cond attribute object"); } - - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[i].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #if VERBOSE > 1 - output("[parent] Mutex type : %i\n", scenarii[i].m_type); - #endif - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[i].mc_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the cond var process-shared"); } - #if VERBOSE > 1 - output("[parent] Mutex & cond are process-shared\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Mutex & cond are process-private\n"); - } - #endif - - /* Set the alternative clock, if supported */ - #ifdef USE_ALTCLK - if ((cs > 0) && (scenarii[i].c_clock != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the monotonic clock for the cond"); } - #if VERBOSE > 1 - output("[parent] Cond uses the Monotonic clock\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Cond uses the default clock\n"); - } - #endif - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[i].fork != 0)) - { - do_fork = 1; - #if VERBOSE > 1 - output("[parent] Child will be a new process\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Child will be a new thread\n"); - } - #endif - - -/********** - * Initialize the testdata_t structure with the previously defined attributes - */ - /* Initialize the mutex */ - ret = pthread_mutex_init(&(td->mtx), &ma); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Mutex init failed"); } - - /* initialize the condvar */ - ret = pthread_cond_init(&(td->cnd), &ca); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Cond init failed"); } - - /* Initialize the other datas from the test structure */ - #ifdef USE_ALTCLK - ret = pthread_condattr_getclock(&ca, &(td->cid)); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Unable to read cond clock attribute"); } - #else - td->cid = CLOCK_REALTIME; - #endif - - ret = pthread_mutexattr_gettype(&ma, &(td->type)); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Unable to read mutex type attribute"); } - - td->ctrl=0; - td->bool=0; - td->status=0; - -/********** - * Proceed to the actual testing - */ - - /* Create the child */ - if (do_fork != 0) - { - /* We are testing across two processes */ - child_pr = fork(); - if (child_pr == -1) - { UNRESOLVED(errno, "[parent] Fork failed"); } - - if (child_pr == 0) - { - #if VERBOSE > 1 - output("[child] Child process starting...\n"); - #endif - - if (tf((void *)td) != NULL) - { - UNRESOLVED( -1, "[child] Got an unexpected return value from test function"); - } - else - { - /* We cannot use the PASSED macro here since it would terminate the output */ - exit (0); - } - } - /* Only the parent process goes further */ - } - else /* do_fork == 0 */ - { - /* We are testing across two threads */ - ret = pthread_create(&child_th, NULL, tf, td); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to create the child thread."); } - } - - /* Note: in case of an error, the child process will be alive for 10 sec then exit. */ - - /* Child is now running and will enter the timedwait */ - /* We are waiting for this; and we have to monitor the status value as well. */ - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to lock the mutex"); } - - while ((td->ctrl == 0) && (td->status == 0)) - { - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to unlock the mutex"); } - sched_yield(); - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to lock the mutex"); } - } - - if ((td->ctrl == 2) && (td->status == 0)) /* Spurious wakeups hapenned */ - { - output("Spurious wake ups have happened. Maybe pthread_cond_wait is broken?\n"); - td->ctrl = 1; - } - - if (td->ctrl == 1)/* The child is inside the cond wait */ - { - ret = pthread_cond_signal(&(td->cnd)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to signal the condition"); } - - /* Let the child leave the wait function if something is broken */ - usleep(100); - - if (td->ctrl != 1) - { - FAILED("[parent] Child went out from pthread_cond_wait without locking the mutex"); - } - - /* Allow the child to continue */ - td->bool=1; - } - - /* Let the child do its checking */ - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to unlock the mutex"); } - - /* Wait for the child to terminate */ - if (do_fork != 0) - { - /* We were testing across two processes */ - chkpid = waitpid(child_pr, &status, 0); - if (chkpid != child_pr) - { - output("Expected pid: %i. Got %i\n", (int)child_pr, (int)chkpid); - UNRESOLVED(errno, "Waitpid failed"); - } - if (WIFSIGNALED(status)) - { - output("Child process killed with signal %d\n",WTERMSIG(status)); - UNRESOLVED( td->status , "Child process was killed"); - } - - if (WIFEXITED(status)) - { - ret = WEXITSTATUS(status); - } - else - { - UNRESOLVED( td->status, "Child process was neither killed nor exited"); - } - - if (ret != 0) - { - exit(ret); /* Output has already been closed in child */ - } - } - else /* child was a thread */ - { - ret = pthread_join(child_th, NULL); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to join the thread"); } - } - -/********** - * Destroy the data - */ - ret = pthread_cond_destroy(&(td->cnd)); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var"); } - - ret = pthread_mutex_destroy(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the cond var attribute object"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - } /* Proceed to the next scenario */ - - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/2-3.c deleted file mode 100644 index 613d05c105..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/2-3.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * This function is a cancelation point: when cancelability - * is PTHREAD_CANCEL_DEFERRED and a cancel request arrives, the thread - * must relock the mutex before the first (if any) clean up handler is called. - - * The steps are: - * -> Create a thread - * -> this thread locks a mutex then waits for a condition - * -> cancel the thread - * -> the cancelation handler will test if the thread owns the mutex. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#ifndef WITHOUT_ALTCLK -#define USE_ALTCLK /* make tests with MONOTONIC CLOCK if supported */ -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -struct -{ - pthread_mutex_t mtx; - pthread_cond_t cnd; - int type; - sem_t semA; - sem_t semB; - int bool; -} data; - - -/**** First handler that will be poped - * This one works only with recursive mutexes - */ -void clnp1 (void * arg) -{ - int ret; - if (data.type == PTHREAD_MUTEX_RECURSIVE) - { - ret = pthread_mutex_trylock(&(data.mtx)); - if (ret != 0) { FAILED("Unable to double-lock a recursive mutex in clean-up handler 1"); } - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock double-locked recursive mutex in clean-up handler 1"); } - } - return; -} - -/**** Second handler - * This one will trigger an action in main thread, while we are owning the mutex - */ -void clnp2 (void * arg) -{ - int ret; - do { - ret = sem_post(&(data.semA)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem post failed in cleanup handler 2"); } - - do { - ret = sem_wait(&(data.semB)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem wait failed in cleanup handler 2"); } - - return; -} - -/**** Third handler - * Will actually unlock the mutex, then try to unlock second time to check an error is returned - */ -void clnp3 (void * arg) -{ - int ret; - - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock mutex in clean-up handler 3"); } - - if ((data.type == PTHREAD_MUTEX_ERRORCHECK) || (data.type == PTHREAD_MUTEX_RECURSIVE)) - { - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret == 0) { UNRESOLVED(ret, "Was able to unlock unlocked mutex in clean-up handler 3"); } - } - - return; -} - - -/**** Thread function - * This function will lock the mutex, then install the cleanup handlers - * and wait for the cond. At this point it will be canceled. - */ -void * threaded (void * arg) -{ - int ret; - - ret= pthread_mutex_lock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to lock the mutex in thread"); } - - /* Tell the main thread we got the lock */ - do { - ret = sem_post(&(data.semA)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem post failed in cleanup handler 2"); } - - pthread_cleanup_push ( clnp3, NULL); - pthread_cleanup_push ( clnp2, NULL); - pthread_cleanup_push ( clnp1, NULL); - - do { - ret = pthread_cond_wait(&(data.cnd), &(data.mtx)); - } while ((ret == 0) && (data.bool == 0)); - - if (ret != 0) { UNRESOLVED(ret , "Wait failed"); } /* We will exit even if the error is timedwait */ - - /* If we are here, the thread was not canceled */ - FAILED("The thread has not been canceled"); - - pthread_cleanup_pop(0); - pthread_cleanup_pop(0); - pthread_cleanup_pop(1); - - return NULL; -} - -int main(int argc, char * argv[]) -{ - int ret, i; - void * rc; - - pthread_mutexattr_t ma; - pthread_condattr_t ca; - pthread_t th; - - long altclk_ok, pshared_ok; - - struct - { - char altclk; /* Want to use alternative clock */ - char pshared; /* Want to use process-shared primitives */ - int type; /* mutex type */ - char * descr; /* Description of the case */ - - } scenar[] = - { {0, 0, PTHREAD_MUTEX_NORMAL, "Normal mutex" } -#ifdef USE_ALTCLK - ,{1, 0, PTHREAD_MUTEX_NORMAL, "Normal mutex + altclock cond" } - ,{1, 1, PTHREAD_MUTEX_NORMAL, "PShared mutex + altclock cond" } -#endif - ,{0, 1, PTHREAD_MUTEX_NORMAL, "Pshared mutex" } -#ifndef WITHOUT_XOPEN - ,{0, 0, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck mutex" } - ,{0, 0, PTHREAD_MUTEX_RECURSIVE , "Recursive mutex" } -#ifdef USE_ALTCLK - ,{1, 0, PTHREAD_MUTEX_RECURSIVE , "Recursive mutex + altclock cond" } - ,{1, 0, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck mutex + altclock cond" } - ,{1, 1, PTHREAD_MUTEX_RECURSIVE , "Recursive pshared mutex + altclock cond" } - ,{1, 1, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck pshared mutex + altclock cond" } -#endif - ,{0, 1, PTHREAD_MUTEX_RECURSIVE , "Recursive pshared mutex" } - ,{0, 1, PTHREAD_MUTEX_ERRORCHECK, "Errorcheck pshared mutex" } -#endif - }; - - output_init(); - - /* Initialize the constants */ - altclk_ok = sysconf(_SC_CLOCK_SELECTION); - if (altclk_ok > 0) - altclk_ok = sysconf(_SC_MONOTONIC_CLOCK); -#ifndef USE_ALTCLK - if (altclk_ok > 0) - output("Implementation supports the MONOTONIC CLOCK but option is disabled in test.\n"); -#endif - - pshared_ok = sysconf(_SC_THREAD_PROCESS_SHARED); - - #if VERBOSE > 0 - output("Test starting\n"); - output(" Process-shared primitive %s be tested\n", (pshared_ok>0)?"will":"won't"); - output(" Alternative clock for cond %s be tested\n", (altclk_ok>0)?"will":"won't"); - #endif - - ret = sem_init(&(data.semA), 0, 0); - if (ret != 0) { UNRESOLVED(errno, "Unable to init sem A"); } - - ret = sem_init(&(data.semB), 0, 0); - if (ret != 0) { UNRESOLVED(errno, "Unable to init sem B"); } - - for (i=0; i< (sizeof(scenar) / sizeof(scenar[0])); i++) - { - #if VERBOSE > 1 - output("Starting test for %s\n", scenar[i].descr); - #endif - - /* Initialize the data structure */ - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex attribute object init failed"); } - - ret = pthread_mutexattr_settype(&ma, scenar[i].type); - if (ret != 0) { UNRESOLVED(ret, "Unable to set mutex type"); } - - if ((pshared_ok > 0) && (scenar[i].pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set mutex process-shared"); } - } - - ret = pthread_condattr_init(&ca); - if (ret != 0) { UNRESOLVED(ret, "Cond attribute object init failed"); } - - if ((pshared_ok > 0) && (scenar[i].pshared != 0)) - { - ret = pthread_condattr_setpshared(&ca, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set cond process-shared"); } - } - - #ifdef USE_ALTCLK - if ((altclk_ok > 0) && (scenar[i].altclk != 0)) - { - ret = pthread_condattr_setclock(&ca, CLOCK_MONOTONIC); - if (ret != 0) { UNRESOLVED(ret, "Unable to set alternative (monotonic) clock for cond"); } - } - #endif - - ret = pthread_mutex_init(&(data.mtx), &ma); - if (ret != 0) { UNRESOLVED(ret, "Unable to init mutex"); } - - ret = pthread_cond_init(&(data.cnd), &ca); - if (ret != 0) { UNRESOLVED(ret, "Unable to initialize condvar"); } - - ret = pthread_mutexattr_gettype(&ma, &(data.type)); - if (ret != 0) { UNRESOLVED(ret, "Unable to get type from mutex attr"); } - - data.bool = 0; - - /** Data is ready, create the thread */ - #if VERBOSE > 1 - output("Initialization OK, starting thread\n"); - #endif - - ret = pthread_create(&th, NULL, threaded, NULL); - if (ret != 0) { UNRESOLVED(ret, "Thread creation failed"); } - - /** Wait for the thread to be waiting */ - do { - ret = sem_wait(&(data.semA)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem wait failed in main"); } - - ret = pthread_mutex_lock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock mutex in main"); } - - data.bool = 1; - - /** Cancel the thread */ - ret = pthread_cancel(th); - if (ret != 0) { UNRESOLVED(ret, "Thread cancelation failed"); } - - sched_yield(); - #ifndef WITHOUT_XOPEN - usleep(100); - #endif - - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock mutex in main"); } - - /** Wait for the thread to be executing second cleanup handler */ - do { - ret = sem_wait(&(data.semA)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem wait failed in main"); } - - /** Here the child should own the mutex, we check this */ - ret = pthread_mutex_trylock(&(data.mtx)); - if (ret == 0) { FAILED("The child did not own the mutex inside the cleanup handler"); } - - /** Let the cleanups go on */ - do { - ret = sem_post(&(data.semB)); - } while ((ret != 0) && (errno == EINTR)); - if (ret != 0) { UNRESOLVED(errno, "Sem post failed in main"); } - - /** Join the thread */ - ret = pthread_join(th, &rc); - if (ret != 0) { UNRESOLVED(ret, "Unable to join the thread"); } - if (rc != PTHREAD_CANCELED) { FAILED("thread was not canceled"); } - - #if VERBOSE > 1 - output("Test passed for %s\n\n", scenar[i].descr); - #endif - - /* Destroy datas */ - ret = pthread_cond_destroy(&(data.cnd)); - if (ret != 0) { UNRESOLVED(ret, "Cond destroy failed"); } - - ret = pthread_mutex_destroy(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Mutex destroy failed"); } - - ret = pthread_condattr_destroy(&ca); - if (ret != 0) { UNRESOLVED(ret, "Cond attribute destroy failed"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Mutex attr destroy failed"); } - } /* Proceed to next case */ - - ret = sem_destroy(&(data.semA)); - if (ret != 0) { UNRESOLVED(errno, "Sem destroy failed"); } - - ret = sem_destroy(&(data.semB)); - if (ret != 0) { UNRESOLVED(errno, "Sem destroy failed"); } - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/3-1.c deleted file mode 100644 index d039664d5a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/3-1.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_cond_wait() - * Upon successful completion, a value of zero shall be returned. - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -struct testdata -{ - pthread_mutex_t mutex; - pthread_cond_t cond; -} td; - -pthread_t thread1; - -int t1_start = 0; -int signaled = 0; - -/* Alarm handler */ -void alarm_handler(int signo) -{ - printf("Error: failed to wakeup thread\n"); - pthread_cancel(thread1); - exit(PTS_UNRESOLVED); -} - -void *t1_func(void *arg) -{ - int rc; - - if (pthread_mutex_lock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to acquire the mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 started\n"); - t1_start = 1; /* let main thread continue */ - - fprintf(stderr,"Thread1 is waiting for the cond\n"); - rc = pthread_cond_wait(&td.cond, &td.mutex); - if(rc != 0) { - if (rc == EINVAL) { - fprintf(stderr,"pthread_cond_wait returns EINVAL\n"); - exit(PTS_UNRESOLVED); - } - else if (rc == EPERM) { - fprintf(stderr,"pthread_cond_wait returns EPERM\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"pthread_cond_wait returns %d\n", rc); - exit(PTS_UNRESOLVED); - } - - if(signaled == 0) { - fprintf(stderr,"Thread1 waked up before being notified\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 wakened up and got returned value 0\n"); - - if (pthread_mutex_unlock(&td.mutex) != 0) { - fprintf(stderr,"Thread1 failed to release the mutex\n"); - exit(PTS_UNRESOLVED); - } - fprintf(stderr,"Thread1 released the mutex\n"); - return NULL; -} - -int main() -{ - - struct sigaction act; - - if (pthread_mutex_init(&td.mutex, NULL) != 0) { - fprintf(stderr,"Fail to initialize mutex\n"); - return PTS_UNRESOLVED; - } - if (pthread_cond_init(&td.cond, NULL) != 0) { - fprintf(stderr,"Fail to initialize cond\n"); - return PTS_UNRESOLVED; - } - - if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { - fprintf(stderr,"Fail to create thread 1\n"); - return PTS_UNRESOLVED; - } - - sleep(2); - - /* Setup alarm handler */ - act.sa_handler=alarm_handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - alarm(5); - - fprintf(stderr,"To wake up thread1 by broadcasting its waited condition\n"); - signaled = 1; - if (pthread_cond_broadcast(&td.cond) != 0) { - fprintf(stderr,"Main failed to broadcast the condition\n"); - return PTS_UNRESOLVED; - } - - pthread_join(thread1, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/4-1.c deleted file mode 100644 index 0cf2ad38b1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/4-1.c +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * The function does not return an error code of EINTR - - - * The steps are: - * - * -> Create a thread which wait in a condition for a small time. - * -> Another thread will signal this condition from time to time. - * -> Another thread which loops on sending a signal to the first thread. - * - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#define WITH_SYNCHRO -#ifndef VERBOSE -#define VERBOSE 2 -#endif - -#define INTERVAL (700) /* ns, frequency (actually, period) for the condition signaling */ - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -char do_it=1; -char woken=0; -unsigned long count_cnd_sig=0, count_cnd_wup=0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -struct -{ - pthread_mutex_t mtx; - pthread_cond_t cnd; -} data; - -/* the following function keeps on sending the signal to the process */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - pid_t process; - - process=getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - ret = kill(process, thearg->sig); - if (ret != 0) { UNRESOLVED(errno, "Kill in sendsig"); } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -/* This one is registered for signal SIGUSR2 */ -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* The following function will wait on the cond - * it does check that no error code of EINTR is returned */ -void * waiter(void * arg) -{ - int ret; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_UNBLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread"); } - - ret = pthread_mutex_lock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to lock mutex in waiter thread"); } - - do - { - ret = pthread_cond_wait(&(data.cnd),&(data.mtx)); - count_cnd_wup++; - } while ((ret == 0) && (do_it != 0)); - - if (ret == EINTR) - { - FAILED("pthread_cond_wait returned EINTR"); - } - - if (ret != 0) - { - UNRESOLVED(ret, "pthread_cond_wait returned an unexpected error"); - } - - woken++; - - ret = pthread_mutex_unlock(&(data.mtx)); - if (ret != 0) { UNRESOLVED(ret, "Unable to unlock mutex in waiter thread"); } - - return NULL; -} - - -/* The next function will signal the condition at periodic interval */ -void * worker (void * arg) -{ - int ret=0; - - struct timespec ts, tsrem; - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - ts.tv_sec=0; - ts.tv_nsec= INTERVAL; - while (ts.tv_nsec >= 1000000000) - { - ts.tv_nsec -= 1000000000; - ts.tv_sec +=1; - } - - while (woken == 0) - { - tsrem.tv_sec = ts.tv_sec; - tsrem.tv_nsec = ts.tv_nsec; - - do { ret = nanosleep(&tsrem, &tsrem); } - while ((ret != 0) && (errno == EINTR)); - - ret = pthread_cond_signal(&(data.cnd)); - if (ret != 0) { UNRESOLVED(ret, "Failed to signal the condition"); } - count_cnd_sig++; - } - - return NULL; -} - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_waiter, th_worker, th_sig1, th_sig2; - thestruct arg1, arg2; - struct sigaction sa; - - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset(&usersigs); - ret = sigaddset(&usersigs, SIGUSR1); - ret |= sigaddset(&usersigs, SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Unable to add SIGUSR1 or 2 to a signal set"); } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread"); } - - - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - if ((ret = pthread_create(&th_waiter, NULL, waiter, NULL))) - { UNRESOLVED(ret, "Waiter thread creation failed"); } - - if ((ret = pthread_create(&th_worker, NULL, worker, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - /* Let's wait for a while now */ - sleep(1); - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - if ((ret = pthread_join(th_waiter, NULL))) - { UNRESOLVED(ret, "Waiter thread join failed"); } - if ((ret = pthread_join(th_worker, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" Condition was signaled %d times.\n", count_cnd_sig); - output(" pthread_cond_wait exited %d times.\n", count_cnd_wup); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/assertions.xml deleted file mode 100644 index c6fc0f503c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/assertions.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - The function - int pthread_cond_wait(pthread_cond_t *restrict cond, - pthread_mutex_t *restrict mutex); - shall block on a condition variable. It shall be called with mutex locked - by the calling thread or undefined behavior results. - - - - Upon successful return, the mutex shall have been locked and shall be owned - by the calling thread. - - - - Upon successful completion, a value of zero shall be returned; - - - - The pthread_cond_wait() function may fail if: - [EINVAL] The value specified by cond, mutex,or abstime is invalid. - [EINVAL] Different mutexes were supplied for concurrent pthread_cond_timedwait() or - pthread_cond_wait() operations on the same condition variable. - [EPERM] The mutex was not owned by the current thread at the time of the call. - These functions shall not return an error code of [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/coverage.txt deleted file mode 100644 index 4b23bf8eb6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/coverage.txt +++ /dev/null @@ -1,10 +0,0 @@ -This document defines the coverage for the pthread_cond_wait function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO * When it specifies it 'may' fail and not 'shall' fail, - it will always return PASS, but will return a - PASS and print out a warning if it fails. -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_cond_wait/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/1-1.c deleted file mode 100644 index 7f00494b82..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/1-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_destroy() - * shall destroy a condition variable attributes object. - * - * Steps: - * 1. Initialize a pthread_condattr_t object using pthread_condattr_init() - * 2. Destroy the attributes object using pthread_condattr_destroy() - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_condattr_t condattr; - int rc; - - /* Initialize a condition variable attributes object */ - if((rc=pthread_condattr_init(&condattr)) != 0) - { - fprintf(stderr,"Cannot initialize condition variable attributes object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy the condition variable attributes object */ - if(pthread_condattr_destroy(&condattr) != 0) - { - fprintf(stderr,"Error at pthread_condattr_destroy(), rc=%d\n", rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/2-1.c deleted file mode 100644 index 99fc451d06..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/2-1.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_condattr_destroy() - * A destroyed 'attr' attributes object can be reinitialized using - * pthread_condattr_init(); the results of otherwise referencing the - * object after it has been destroyed are undefined. - * - * Steps: - * 1. Initialize a pthread_condattr_t object using pthread_condattr_init() - * 2. Destroy that initialized attribute using pthread_condattr_destroy() - * 3. Initialize the pthread_condattr_t object again. This should not result - * in any error. - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_condattr_t condattr; - - /* Initialize a condition variable attributes object */ - if(pthread_condattr_init(&condattr) != 0) - { - fprintf(stderr,"Cannot initialize condition variable attributes object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy the condition variable attributes object */ - if(pthread_condattr_destroy(&condattr) != 0) - { - fprintf(stderr,"Cannot destroy the condition variable attributes object\n"); - return PTS_UNRESOLVED; - } - - /* Initialize the condition variable attributes object again. This shouldn't result in an error. */ - if(pthread_condattr_init(&condattr) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/3-1.c deleted file mode 100644 index ebb5cfa8cb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/3-1.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_condattr_destroy() - * Upon successful completion, pthread_condattr_destroy() shall - * return a value of 0. - * - * Steps: - * 1. Initialize a pthread_condattr_t object using pthread_condattr_init() - * 2. Destroy that initialized attribute using pthread_condattr_destroy(). - * This should return 0; - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_condattr_t condattr; - - /* Initialize a condition variable attributes object */ - if(pthread_condattr_init(&condattr) != 0) - { - fprintf(stderr,"Cannot initialize condition variable attributes object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy the condition variable attributes object */ - if(pthread_condattr_destroy(&condattr) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/4-1.c deleted file mode 100644 index f510317d48..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/4-1.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_condattr_destroy() - * If it fails, an error number shall be returned to indicate the error: - * [EINVAL] The value specified by 'attr' is invalid - * - * Steps: - * Try to destroy a NULL condition variable attributes object using pthread_condattr_destroy(). - * If it returns EINVAL, the test passes. - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_condattr_t *condattr=NULL; - int rc; - - /* Try to destroy a NULL condition variable attributes object using pthread_condattr_destroy() - * It should return EINVAL */ - if((rc=pthread_condattr_destroy(condattr)) == EINVAL) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - printf("Test PASSED: *NOTE: Expect %d(EINVAL), but return %d, though standard states 'may' fail\n", EINVAL, rc); - return PTS_PASS; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/assertions.xml deleted file mode 100644 index 2de6ffbb40..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/assertions.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - The function - int pthread_condattr_destroy(pthread_condattr_t *attr); - shall destroy a condition variable attributes object; the object becomes, - in effect, uninitialized. An implementation may cause pthread_condattr_destroy() - to set the object referenced by attr to an invalid value. - - - - A destroyed attr attributes object can be reinitialized using pthread_condattr_init(); - the results of otherwise referencing the object after it has been destroyed are undefined. - - - - If successful, it shall return zero; - - - - The pthread_condattr_destroy() function may fail if: - [EINVAL] The value specified by attr is invalid. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/coverage.txt deleted file mode 100644 index b09125c344..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_destroy/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_condattr_destroy function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES ** Keeping in mind it 'may' fail and not 'shall' fail, - so it will always return PASS, but will return a - PASS and print out a warning if it fails. - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/1-1.c deleted file mode 100644 index 133c0e6ce5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/1-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_getclock() - * shall get the 'clock' attribute in a condattr object - * - * Steps: - * 1. Initialize a pthread_condattr_t object - * 2. Get the clock attribute - * 3. Check that it was successful - * - */ - -# define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_condattr_t condattr; - clockid_t clockid; - int rc; - - /* Initialize a cond attributes object */ - if((rc=pthread_condattr_init(&condattr)) != 0) - { - fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - rc = pthread_condattr_getclock(&condattr, &clockid); - if(rc != 0) - { - printf("Test FAILED: Could not get the clock attribute\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/1-2.c deleted file mode 100644 index 5f16952eea..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/1-2.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_getclock() - * shall get the 'clock' attribute of a condattr object. - * - * Steps: - * 1. Initialize a pthread_condattr_t object - * 2. Set the clock attribute to CLOCK_REALTIME - * 3. Get the clock attribute - * 4. Check that it was successful - * - */ - -# define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_condattr_t condattr; - clockid_t clockid; - int rc; - - /* Initialize a cond attributes object */ - if((rc=pthread_condattr_init(&condattr)) != 0) - { - fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - rc = pthread_condattr_setclock(&condattr, CLOCK_REALTIME); - if(rc != 0) - { - perror("Error: Could not set clock to CLOCK_REALTIME\n"); - return PTS_UNRESOLVED; - } - - rc = pthread_condattr_getclock(&condattr, &clockid); - if(rc != 0) - { - printf("Test FAILED: Could not get the clock attribute\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/2-1.sh deleted file mode 100755 index a6924118b9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/2-1.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_condattr_getclock() returns 0 upon success, and fails with an error number -# is returned if: -# It may fail if: -# - [EINVAL] The value specified by 'attr' is invalid. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/assertions.xml deleted file mode 100644 index 6080b07969..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/assertions.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - The function - int pthread_condattr_getclock(pthread_condattr_t *restrict attr, - clockid_t *restrict clock_id); - shall get the 'clock' attribute from an attributes object referenced by - 'attr'. It will store the value of the clock attribute into clock_id and return 0. - - - - It returns 0 upon success, and an error code if it fails: - - It may fail if: - - [EINVAL] - the 'attr' value is invalid - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/coverage.txt deleted file mode 100644 index d4998d3f0e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getclock/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -This document defines the coverage for the pthread_condattr_getclock function: - -Assertion Tested? -1 YES -2 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/1-1.c deleted file mode 100644 index 176397cbf8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/1-1.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_getpshared() - * - * It shall obtain the value of the process-shared attribute from 'attr'. - * - * Steps: - * 1. In a loop, initialize a pthread_condattr_t object with pthread_condattr_init() - * 2. Set 'pshared' of the object to PTHREAD_PROCESS_PRIVATE. - * 3. Call pthread_condattr_getpshared() to check if the process-shared - * attribute is set as PTHREAD_PROCESS_PRIVATE. - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_CONDATTR 10 - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_condattr_t attr[NUM_OF_CONDATTR]; - int ret, i, pshared; - - for(i=0;i -#include -#include -#include "posixtest.h" - -#define NUM_OF_CONDATTR 10 - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_condattr_t attr[NUM_OF_CONDATTR]; - int ret, i, pshared; - - for(i=0;i -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_condattr_t attr; - int pshared; - - /* Initialize a mutex attributes object */ - if(pthread_condattr_init(&attr) != 0) - { - perror("Error at pthread_condattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* The default 'pshared' attribute should be PTHREAD_PROCESS_PRIVATE */ - if(pthread_condattr_getpshared(&attr, &pshared) != 0) - { - fprintf(stderr,"Error obtaining the attribute process-shared\n"); - return PTS_UNRESOLVED; - } - - if(pshared != PTHREAD_PROCESS_PRIVATE) - { - printf("Test FAILED: Incorrect default pshared value: %d\n", pshared); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/3-1.sh deleted file mode 100755 index 99d911715a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/3-1.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_condattr_getpshared() -# -# Upon success, it returns 0, and stores the value of the process-shared attribute of 'attr' -# into 'pshared'. -# - -# This is tested implicitly via assertion 1 and 2. - -echo "Tested implicitly via assertion 1 and 2. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/assertions.xml deleted file mode 100644 index 9e121d1ae0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/assertions.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - The function - int pthread_condattr_getpshared(const pthread_condattr_t *restrict attr, - int *restrict pshared); - shall obtain the value of the process-shared attribute from the attributes - object referenced by attr. - - - - The default value of the attribute is PTHREAD_PROCESS_PRIVATE. - - - - If successful, the pthread_condattr_getpshared() function shall return zero and store the - value of the process-shared attribute of attr into the object referenced by the pshared - parameter. - - The pthread_condattr_getpshared() function may fail if: - [EINVAL] The value specified by attr is invalid. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/coverage.txt deleted file mode 100644 index cbf822edbd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_getpshared/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_condattr_getpshared function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/1-1.c deleted file mode 100644 index 4b160a5395..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/1-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_init() - * shall initialize a condition variable attribute object 'attr' with the default - * value for all of the attributes defined by the implementation. - - * Steps: - * 1. Initialize a pthread_condattr_t object with pthread_condattr_init() - * 2. Call pthread_condattr_getpshared() to check if the process-shared - * attribute is set as the default value PTHREAD_PROCESS_PRIVATE. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_condattr_t condattr; - int rc; - -#ifdef PTHREAD_PROCESS_SHARED - int pshared; -#endif - /* Initialize a cond attributes object */ - if((rc=pthread_condattr_init(&condattr)) != 0) - { - fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - -#ifdef PTHREAD_PROCESS_SHARED - /* If the symbol {PTHREAD_PROCESS_SHARED} is defined, the attribute - * process-shared should be provided and its default value should be - * PTHREAD_PROCESS_PRIVATE */ - if(pthread_condattr_getpshared(&condattr, &pshared) != 0) - { - fprintf(stderr,"Error obtaining the attribute process-shared\n"); - return PTS_UNRESOLVED; - } - - if(pshared == PTHREAD_PROCESS_PRIVATE) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -#endif - - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/3-1.c deleted file mode 100644 index 4d7389021a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/3-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_init() - * Upon successful completion, pthread_condattr_init() shall return a value of 0. - - * Steps: - * 1. Initialize a pthread_condattr_t object with pthread_condattr_init() - * 2. ENOMEM is the only error it returns, so if it doesn't return that error, - * the return number should be 0. - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_condattr_t condattr; - int rc; - - /* Initialize a condition variable attributes object */ - if((rc=pthread_condattr_init(&condattr)) == 0) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - - /* Insufficient memory exists to initialize the condition variable attributes object */ - else if(rc == ENOMEM) - { - fprintf(stderr,"pthread_condattr_init() returns ENOMEM\n"); - return PTS_UNRESOLVED; - } - - /* Any other returned value means the test failed */ - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/assertions.xml deleted file mode 100644 index b324e8b746..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/assertions.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - The function - int pthread_condattr_init(pthread_condattr_t *attr); - shall initialize a condition variable attributes object attr with - the default value for all of the attributes defined by the implementation. - - - - After a condition variable attributes object has been used to initialize one or more condition - variables, any function affecting the attributes object (including destruction) shall not affect any - previously initialized condition variables. - - - - If successful, it shall return zero; - - - - The pthread_condattr_init() function shall fail if: - [ENOMEM] Insufficient memory exists to initialize the condition variable attributes object. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/coverage.txt deleted file mode 100644 index 7ba604df1c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_init/coverage.txt +++ /dev/null @@ -1,10 +0,0 @@ -This document defines the coverage for the pthread_condattr_init function: - -Assertion Tested? -1 YES -2 NO *Looking for a way to judge if initialized condition - variables are affected. -3 YES -4 NO * Looking for a way to produce the error conditions - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/1-1.c deleted file mode 100644 index b08b6f130b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/1-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_setclock() - * shall set the 'clock' attribute in an initialized attributes object referenced by - * 'attr'. - * - * Steps: - * 1. Initialize a pthread_condattr_t object - * 2. Set the clock to CLOCK_REALTIME - * 3. Check that it was set successfully - * - */ - -# define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_condattr_t condattr; - int rc; - - /* Initialize a cond attributes object */ - if((rc=pthread_condattr_init(&condattr)) != 0) - { - fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - rc = pthread_condattr_setclock(&condattr, CLOCK_REALTIME); - if(rc != 0) - { - printf("Test FAILED: Could not set clock to CLOCK_REALTIME\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/1-2.c deleted file mode 100644 index 21ec44f598..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/1-2.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_setclock() - * shall set the 'clock' attribute in an initialized attributes object referenced by - * 'attr'. - * - * Steps: - * 1. Initialize a pthread_condattr_t object - * 2. Set the clock to CLOCK_MONOTONIC (if the kernel has that capability) - * 3. Check that it was set successfully - * - * *FIX-ME: Need to find a better check on whether the kernel supports CLOCK_MONOTONIC - * clocks or not. - * - */ - -# define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_condattr_t condattr; - struct timespec ts; - int rc; - - /* Check whether kernel supports CLOCK_MONOTONIC */ - rc = clock_getres(CLOCK_MONOTONIC, &ts); - if(rc != 0) - { - printf("UNSUPPORTED: CLOCK_MONOTONIC is unsupported\n"); - return PTS_UNSUPPORTED; - } - - /* Initialize a cond attributes object */ - if((rc=pthread_condattr_init(&condattr)) != 0) - { - fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - rc = pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC); - if(rc != 0) - { - printf("Test FAILED: Could not set clock to CLOCK_MONOTONIC\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/1-3.c deleted file mode 100644 index 134ad3783d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/1-3.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_setclock() - * - * If it is called with a clock_id argument that refers to a CPU-time clock, the call - * shall fail. - * - * Steps: - * 1. Initialize a pthread_condattr_t object - * 2. Get the cpu clock id - * 3. Call pthread_condattr_setclock passing this clock id to it - * 4. It should fail. - * - */ - -# define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - #if _POSIX_CPUTIME == -1 - printf("_POSIX_CPUTIME unsupported\n"); - return PTS_UNSUPPORTED; - #endif - - pthread_condattr_t condattr; - clockid_t clockid; - int rc; - - if (sysconf(_SC_CPUTIME) == -1) { - printf("_POSIX_CPUTIME unsupported\n"); - return PTS_UNSUPPORTED; - } - - /* Initialize a cond attributes object */ - if((rc=pthread_condattr_init(&condattr)) != 0) - { - fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Get the cpu clock id */ - - if (clock_getcpuclockid(getpid(), &clockid) != 0) - { - printf("clock_getcpuclockid() failed\n"); - return PTS_FAIL; - } - - rc = pthread_condattr_setclock(&condattr, clockid); - if(rc != EINVAL) - { - printf("Test FAILED: Expected EINVAL when passing a cpu clock id, instead it returned: %d \n", rc); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/2-1.c deleted file mode 100644 index ec4e780582..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/2-1.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_setclock() - * It returns 0 upon success, and an error code if it fails: - * - * It may fail if: - * - * [EINVAL] - the 'attr' value is invalid - * [EINVAL] - 'clock_id' doesn't refer to a known clock or is a CPU-time clock. - * - * Steps: - * 1. Initialize a pthread_condattr_t object - * 2. Set the clock to an invalid value - * 3. It should fail - * - */ - -# define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -#define INVALID_CLOCKID -100 - -int main() -{ - pthread_condattr_t condattr; - int rc; - - /* Initialize a cond attributes object */ - if((rc=pthread_condattr_init(&condattr)) != 0) - { - fprintf(stderr,"Error at pthread_condattr_init(), rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - rc = pthread_condattr_setclock(&condattr, INVALID_CLOCKID); - if(rc != EINVAL) - { - printf("Test PASSED: *NOTE: Test passed while passing an invalid clockid, but the standard says 'may' fail\n"); - return PTS_PASS; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/assertions.xml deleted file mode 100644 index b87d417f20..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/assertions.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - The function - int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id); - shall set the 'clock' attribute in an initialized attributes object referenced by - 'attr'. - If it is called with a clock_id argument that refers to a CPU-time clock, the call - shall fail. - - - - It returns 0 upon success, and an error code if it fails: - - It may fail if: - - [EINVAL] - the 'attr' value is invalid - [EINVAL] - 'clock_id' doesn't refer to a known clock or is a CPU-time clock. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/coverage.txt deleted file mode 100644 index 327ee1bfb5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setclock/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -This document defines the coverage for the pthread_condattr_setclock function: - -Assertion Tested? -1 YES -2 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setpshared/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setpshared/1-1.c deleted file mode 100644 index b93cb3e86d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setpshared/1-1.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_condattr_setpshared() - * - * It shall obtain the value of the process-shared attribute from 'attr'. - * - * Explanation: To share a mutex between 2 processes, you need to map shared memory for - * the mutex. So whether the 'type' of the condattr is shared or private, it really will - * not make a difference since both processes will always have access to the shared memory - * as long as they the pointer to it. So all we check here is that you can actually call - * the pthread_condattr_setpshared() function, passing to it PTHREAD_PROCESS_SHARED and - * PTHREAD_PROCESS_PRIVATE. - * - * Steps: - * 1. In a loop, initialize a pthread_condattr_t object with pthread_condattr_init() - * 2. Set 'pshared' of the object to PTHREAD_PROCESS_PRIVATE using pthread_condattr_setpshared - * 3. Call pthread_condattr_getpshared() to check if the process-shared - * attribute is set as PTHREAD_PROCESS_PRIVATE. - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_CONDATTR 10 - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_condattr_t attr[NUM_OF_CONDATTR]; - int ret, i, pshared; - - for(i=0;i -#include -#include -#include "posixtest.h" - -#define NUM_OF_CONDATTR 10 - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_condattr_t attr[NUM_OF_CONDATTR]; - int ret, i, pshared; - - for(i=0;i -#include -#include -#include "posixtest.h" - -#define INVALID_PSHARED_VALUE -100 - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_condattr_t attr; - int ret; - - /* Initialize a cond attributes object */ - if(pthread_condattr_init(&attr) != 0) - { - perror("Error at pthread_condattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set 'pshared' to INVALID_PSHARED_VALUE. */ - ret=pthread_condattr_setpshared(&attr, INVALID_PSHARED_VALUE); - if(ret != 0) - { - if(ret == EINVAL) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED: Invalid return code, expected 0 or EINVAL, but got: %d\n", ret); - return PTS_FAIL; - } - - /* Destory the cond attributes object */ - if(pthread_condattr_destroy(&attr) != 0) - { - perror("Error at pthread_condattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED: NOTE*: Returned 0 when passed an invalid 'pshared', but standard says 'may' fail.\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setpshared/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setpshared/assertions.xml deleted file mode 100644 index e4d7f19564..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setpshared/assertions.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - The function - int pthread_condattr_setpshared(pthread_condattr_t *attr, - int pshared); - shall set the process-shared attribute in an initialized attributes object - referenced by attr. - - The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a condition - variable to be operated upon by any thread that has access to the memory where the - condition variable is allocated, even if the condition variale is allocated in memory - that is shared by multiple processes. If the process-shared attribute is set to - PTHREAD_PROCESS_PRIVATE, the condition variable shall only be operated upon by threads - create within the same process as the thread that initialized the condition varible; if - threads of differing processes attempt to operate on such a condition variable, the - behavior is undefined. - - - - If successful, the pthread_condattr_setpshared() function shall return zero; - The pthread_condattr_setpshared() function may fail if: - [EINVAL] The value specified by attr is invalid. - [EINVAL] The new value specified for the attribute is outside the range of legal values - for that attribute. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setpshared/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setpshared/coverage.txt deleted file mode 100644 index 9e443260dd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_condattr_setpshared/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -This document defines the coverage for the pthread_condattr_setpshared function: - -Assertion Tested? -1 YES -2 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-1.c deleted file mode 100644 index cfbfcae9cc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_create() creates a new thread with attributes specified - * by 'attr', within a process. - * - * Steps: - * 1. Create a thread using pthread_create() - * 2. Compare the thread ID of 'main' to the thread ID of the newly created - * thread. They should be different. - */ - -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t main_th, new_th; - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Obtain the thread ID of this main function */ - main_th=pthread_self(); - - /* Compare the thread ID of the new thread to the main thread. - * They should be different. If not, the test fails. */ - if(pthread_equal(new_th, main_th) != 0) - { - printf("Test FAILED: A new thread wasn't created\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-2.c deleted file mode 100644 index 723e2b5555..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-2.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_create() creates a new thread with attributes specified - * by 'attr', within a process. - * - * Steps: - * 1. Create a thread using pthread_create() - * 2. Cancel that thread with pthread_cancel() - * 3. If that thread doesn't exist, then it pthread_cancel() will return - * an error code. This would mean that pthread_create() did not create - * a thread successfully. - */ - -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - sleep(10); - - /* Shouldn't reach here. If we do, then the pthread_cancel() - * function did not succeed. */ - perror("Could not send cancel request correctly\n"); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) < 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Try to cancel the newly created thread. If an error is returned, - * then the thread wasn't created successfully. */ - if(pthread_cancel(new_th) != 0) - { - printf("Test FAILED: A new thread wasn't created\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-3.c deleted file mode 100644 index 017babfe52..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-3.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_create() creates a new thread with attributes specified - * by 'attr', within a process. - * - * Steps: - * 1. Create a new thread that will go into a never-ending while loop. - * 2. If the thread is truly asynchronise, then the main function will - * continue instead of waiting for the thread to return (which in never - * does in this test case). - * 3. An alarm is set to go off (i.e. send the SIGARLM signal) after 3 - * seconds. This is done for 'timeing-out' reasons, in case main DOES - * wait for the thread to return. This would also mean that the test - * failed. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void *a_thread_function(); -void alarm_handler(); - -pthread_t a; - -int main() -{ - - /* Set the action for SIGALRM to generate an error if it is - * reached. This is because if SIGALRM was sent, then the - * test timed out. */ - if (signal(SIGALRM, alarm_handler) == SIG_ERR) - { - printf("Error in signal()\n"); - return PTS_UNRESOLVED; - } - - /* SIGALRM will be sent in 5 seconds. */ - alarm(5); - - /* Create a new thread. */ - if(pthread_create(&a, NULL, a_thread_function, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - pthread_cancel(a); - /* If 'main' has reached here, then the test passed because it means - * that the thread is truly asynchronise, and main isn't waiting for - * it to return in order to move on. */ - printf("Test PASSED\n"); - return PTS_PASS; -} - -/* A never-ending thread function */ -void *a_thread_function() -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - - while(1) - sleep(1); - - pthread_exit(0); - return NULL; -} - -/* If this handler is called, that means that the test has failed. */ -void alarm_handler() -{ - printf("Test FAILED\n"); - exit(PTS_FAIL); -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-4.c deleted file mode 100644 index 053f46df5b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-4.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * pthread_create creates a new thread within the process - - * The steps are: - * - * -> get the thread ID and the process ID of the main thread. - * -> create a new thread, get the thread & process ID. - * -> check that the thread IDs are different but process IDs are the same - - * The test fails if the thread IDs are the same or the proces IDs are different. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -struct testdata -{ - pthread_t tid; - pid_t pid; - sem_t * sem; -}; - -int global; /* This value is used to check both threads share the same process memory (and not a copy) */ - -void * threaded (void * arg) -{ - struct testdata * td=(struct testdata *) arg; - pthread_t mytid; - pid_t mypid; - int ret = 0; - - /* Compare the process IDs */ - mypid=getpid(); - #if VERBOSE > 0 - output(" Main pid: %i thread pid: %i\n", td->pid, mypid); - #endif - - if (mypid != td->pid) - { - FAILED("New thread does not belong to the same process as its parent thread"); - } - - /* Compare the threads IDs */ - mytid = pthread_self(); - #if VERBOSE > 0 - /* pthread_t is a pointer with Linux/nptl. This output can be erroneous for other arcs */ - output(" Main tid: %p thread tid: %p\n", td->tid, mytid); - #endif - - if (pthread_equal(mytid, td->tid) != 0) - { - FAILED("The created thread has the same thread ID as its parent"); - } - - /* Change the global value */ - global++; - - /* Post the semaphore to unlock the main thread in case of a detached thread */ - do { ret = sem_post(td->sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - return arg; -} - -int main (int argc, char *argv[]) -{ - int ret=0; - struct testdata td; - void * rval; - pthread_t child; - int i; - - output_init(); - - td.tid=pthread_self(); - td.pid=getpid(); - - scenar_init(); - - for (i=0; i < NSCENAR; i++) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", i, scenarii[i].descr); - #endif - - td.sem = &scenarii[i].sem; - - global = 2*i; - - ret = pthread_create(&child, &scenarii[i].ta, threaded, &td); - switch (scenarii[i].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - if (scenarii[i].detached == 0) - { - ret = pthread_join(child, &rval); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - - if (rval != &td) - { - FAILED("Could not get the thread return value. Did it execute?"); - } - } - else - { - /* Just wait for the thread terminate */ - do { ret = sem_wait(td.sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - } - - if (global != (2*i + 1)) - { - /* Maybe a possible issue with CPU memory-caching here? */ - FAILED("The threads do not share the same process memory."); - } - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-5.c deleted file mode 100644 index 72902abbf0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-5.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * pthread_create creates a thread with attributes as specified in the attr parameter. - - * The steps are: - * - * -> Create a new thread with known parameters. - * -> Check the thread behavior conforms to these parameters. - * This checking consists in: - * -> If an alternative stack has been specified, check that the new thread stack is within this specified area. - * -> If stack size and guard size are known, check that accessing the guard size fails. (new process) - * -> If we are able to run threads with high priority and known sched policy, check that a high priority thread executes before a low priority thread. - (This will be done in another test has it fails with Linux kernel (2.6.8 at least) - * -> The previous test could be extended to cross-process threads to check the scope attribute behavior (postponned for now). - * (*) The detachstate attribute is not tested cause this would mean a speculative test. Moreover, it is already tested elsewhere. - - * The test fails if one of those tests fails. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ -#define STD_MAIN /* This allows main() to be defined in the included file */ -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -/* The overflow function is used to test the stack overflow */ -void * overflow(void * arg) -{ - void * current; - void * pad[50]; /* We want to consume the stack quickly */ - long stacksize = sysconf(_SC_THREAD_STACK_MIN); /* make sure we touch the current stack memory */ - int ret=0; - - pad[1]=NULL; /* so compiler stops complaining about unused variables */ - - if (arg == NULL) - { - /* first call */ - current = overflow(¤t); - - /* Terminate the overflow thread */ - /* Post the semaphore to unlock the main thread in case of a detached thread */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - return NULL; - } - - - /* we cast the pointers into long, which might be a problem on some architectures... */ - if ( ((long)arg) < ((long)¤t)) - { - /* the stack is growing up */ - if ( ((long)¤t) - ((long)arg) >= stacksize) - { - output("Growing up stack started below %p and we are currently up to %p\n", arg, ¤t); - return (void *)0; - } - } - else - { - /* the stack is growing down */ - if ( ((long)arg) - ((long)¤t) >= stacksize) - { - output("Growing down stack started upon %p and we are currently down to %p\n", arg, ¤t); - return (void *)0; - } - } - - /* We are not yet overflowing, so we loop */ - { - return overflow(arg); - } -} - - -void * threaded (void * arg) -{ - int ret = 0; - - #if VERBOSE > 4 - output("Thread %i starting...\n", sc); - #endif - - /* Alternate stack test */ - if (scenarii[sc].bottom != NULL) - { - #ifdef WITHOUT_XOPEN - output("Unable to test the alternate stack feature; need an integer pointer cast\n"); - #else - intptr_t stack_start, stack_end, current_pos; - - stack_start = (intptr_t) scenarii[sc].bottom; - stack_end = stack_start + (intptr_t)sysconf(_SC_THREAD_STACK_MIN); - current_pos = (intptr_t)&ret; - - #if VERBOSE > 2 - output("Stack bottom: %p\n", scenarii[sc].bottom); - output("Stack end : %p (stack is 0x%lx bytes)\n", (void *)stack_end, stack_end - stack_start); - output("Current pos : %p\n", &ret); - #endif - if ((stack_start > current_pos) || (current_pos > stack_end)) - { FAILED("The specified stack was not used.\n"); } - - #endif // WITHOUT_XOPEN - } - - - /* Guard size test */ - if ((scenarii[sc].bottom == NULL) /* no alternative stack was specified */ - && (scenarii[sc].guard == 2) /* guard area size is 1 memory page */ - && (scenarii[sc].altsize == 1))/* We know the stack size */ - { - pid_t child, ctrl; - int status; - - child=fork(); /* We'll test the feature in another process as this test may segfault */ - - if (child == -1) { UNRESOLVED(errno, "Failed to fork()"); } - - if (child != 0) /* father */ - { - /* Just wait for the child and check its return value */ - ctrl = waitpid(child, &status, 0); - if (ctrl != child) { UNRESOLVED(errno, "Failed to wait for process termination"); } - - if (WIFEXITED(status)) /* The process exited */ - { - if (WEXITSTATUS(status) == 0) - { FAILED("Overflow into the guard area did not fail"); } - if (WEXITSTATUS(status) == PTS_UNRESOLVED) - { UNRESOLVED(-1, "The child process returned unresolved status"); } - #if VERBOSE > 4 - else - { output("The child process returned: %i\n", WEXITSTATUS(status)); } - } - else - { - output("The child process did not returned\n"); - if (WIFSIGNALED(status)) - output("It was killed with signal %i\n", WTERMSIG(status)); - else - output("neither was it killed. (status = %i)\n", status); - #endif - } - } - - if (child == 0) /* this is the new process */ - { - pthread_t th; - - ret = pthread_create(&th, &scenarii[sc].ta, overflow, NULL); /* Create a new thread with the same attributes */ - if (ret != 0) { UNRESOLVED(ret, "Unable to create another thread with the same attributes in the new process"); } - - if (scenarii[sc].detached == 0) - { - ret = pthread_join(th, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - else - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - - /* Terminate the child process here */ - exit(0); - } - } - - - /* Post the semaphore to unlock the main thread in case of a detached thread */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - return arg; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-6.c deleted file mode 100644 index 8793db0751..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-6.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * pthread_create creates a thread with attributes as specified in the attr parameter. - - * The steps are: - * - * -> See test 1-5.c for details - * -> This one will test the scheduling behavior is correct. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/* The value below shall be >= to the # of CPU on the test architecture */ -#define NCPU (4) - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ -#define STD_MAIN /* This allows main() to be defined in the included file */ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - - -/* The 2 following functions are used for the scheduling tests */ -void * lp_func(void * arg) -{ - int * ctrl = (int *) arg; - *ctrl=2; - return NULL; -} - -void * hp_func(void * arg) -{ - int *ctrl = (int *) arg; - int dummy=0, i; - do - { - /* some dummy task */ - dummy += 3; - dummy %= 17; - dummy *= 47; - for (i=0; i<1000000000; i++); - #if VERBOSE > 6 - output("%p\n", pthread_self()); - #endif - } - while (*ctrl == 0); - return NULL; -} - - -void * threaded (void * arg) -{ - int ret = 0; - - #if VERBOSE > 4 - output("Thread %i starting...\n", sc); - #endif - - /* Scheduling (priority) tests */ - if ((sysconf(_SC_THREAD_PRIORITY_SCHEDULING) > 0) - && (scenarii[sc].explicitsched != 0) - && (scenarii[sc].schedpolicy != 0) - && (scenarii[sc].schedparam == 1)) - { - /* We will create NCPU threads running with a high priority with the same sched policy policy - and one with a low-priority. - The low-priority thread should not run until the other threads stop running, - unless the machine has more than NCPU processors... */ - - pthread_t hpth[NCPU]; /* High priority threads */ - pthread_t lpth; /* Low Priority thread */ - int ctrl; /* Check value */ - pthread_attr_t ta; - struct sched_param sp; - int policy; - int i=0; - struct timespec now, timeout; - - /* Start with checking we are executing with the required parameters */ - ret = pthread_getschedparam(pthread_self(), &policy, &sp); - if (ret != 0) { UNRESOLVED(ret , "Failed to get current thread policy"); } - - if (((scenarii[sc].schedpolicy == 1) && (policy != SCHED_FIFO)) - || ((scenarii[sc].schedpolicy == 2) && (policy != SCHED_RR))) - { - FAILED("The thread is not using the scheduling policy that was required"); - } - if (((scenarii[sc].schedparam == 1) && (sp.sched_priority != sched_get_priority_max(policy))) - || ((scenarii[sc].schedparam ==-1) && (sp.sched_priority != sched_get_priority_min(policy)))) - { - - FAILED("The thread is not using the scheduling parameter that was required"); - } - - ctrl = 0; /* Initial state */ - - /* Get the policy information */ - ret = pthread_attr_getschedpolicy(&scenarii[sc].ta, &policy); - if (ret != 0) { UNRESOLVED(ret, "Failed to read sched policy"); } - - /* We put a timeout cause the test might lock the machine when it runs */ - alarm(60); - - /* Create the high priority threads */ - ret = pthread_attr_init(&ta); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a thread attribute object"); } - - ret = pthread_attr_setinheritsched(&ta, PTHREAD_EXPLICIT_SCHED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set inheritsched attribute"); } - - ret = pthread_attr_setschedpolicy(&ta, policy); - if (ret != 0) { UNRESOLVED(ret, "Unable to set the sched policy"); } - - sp.sched_priority = sched_get_priority_max(policy) - 1; - - ret = pthread_attr_setschedparam(&ta, &sp); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the sched param"); } - - #if VERBOSE > 1 - output("Starting %i high- and 1 low-priority threads.\n", NCPU); - #endif - for (i=0; i 5 - output("The %i high-priority threads are running\n", NCPU); - #endif - - /* Create the low-priority thread */ - sp.sched_priority = sched_get_priority_min(policy); - - ret = pthread_attr_setschedparam(&ta, &sp); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the sched param"); } - - ret = pthread_create(&lpth, &ta, lp_func, &ctrl); - if (ret != 0) { UNRESOLVED(ret, "Failed to create enough threads"); } - - /* Keep going */ - ret = clock_gettime(CLOCK_REALTIME, &now); - if (ret != 0) { UNRESOLVED(errno, "Failed to read current time"); } - - timeout.tv_sec = now.tv_sec; - timeout.tv_nsec = now.tv_nsec + 500000000; - while (timeout.tv_nsec >= 1000000000) - { - timeout.tv_sec++; - timeout.tv_nsec -= 1000000000; - } - - do - { - if (ctrl != 0) - { - output("The low priority thread executed. This might be normal if you have more than %i CPU.\n", NCPU + 1); - FAILED("Low priority thread executed -- the sched parameters are ignored?"); - } - ret = clock_gettime(CLOCK_REALTIME, &now); - if (ret != 0) { UNRESOLVED(errno, "Failed to read current time"); } - #if VERBOSE > 5 - output("Time: %d.%09d (to: %d.%09d)\n", now.tv_sec, now.tv_nsec, timeout.tv_sec, timeout.tv_nsec); - #endif - } - while ((now.tv_sec <= timeout.tv_sec) && (now.tv_nsec <= timeout.tv_nsec)); - - /* Ok the low priority thread did not execute :) */ - - /* tell the other high priority to terminate */ - ctrl = 1; - - for (i=0; i 1 - output("The scheduling parameter was set accordingly to the thread attribute.\n"); - #endif - - /* We're done. */ - ret = pthread_attr_destroy(&ta); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy a thread attribute object"); } - } - - /* Post the semaphore to unlock the main thread in case of a detached thread */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - return arg; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/10-1.c deleted file mode 100644 index 5d5a6afce0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/10-1.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_create(). - * - * If pthread_create() fails, no new thread is created and the contents of the - * location referenced by 'thread' is undefined. - * - * EXPLANATION: 3 ways that pthread_create can fail is if (1) The system lacked memory - * resources. (2) The caller did not have the appropriate permissions. (3) An invalid - * attributes object was passed. Since the last situation is the easiest to implement, that - * is the one I chose to use in order to make pthread_create fail. - * - * The problem with that is that accessing an uninitialized attributes object will cause a - * segmentation fault (since it usually points to garbage). So the idea here is to catch - * the SIGSEGV signal (segmentation faults), and to see if the thread was ever created, by - * setting a flag in the thread's starting routine. - * - * I recognize that causing pthread_create() to fail gracefully is a very difficult task, - * especially taking into consideration that a lot of it is implementation-specific. I did - * try to manually set the members of a pthread_attr_t object to invalid values, but that didn't - * seem to make pthread_create() fail at all, in any of the implementations I tested on. So for - * now, this is what we have. - * - * - * Steps: - * 1. Create a thread using pthread_create() with an invalid attributes object (uninitialized). - * 2. Catch the SIGSEGV (seg fault) signal. In the signal handler, check to make sure that - * the start routine for the thread was never reached, meaning the thread was never created. - * 3. If SIGSEGV was not caught in 10 seconds, the test times out and fails. If the signal - * was caught, but the thread start routine was called at some point, the test also fails. - * - * - * - adam.li@intel.com: 2004-04-30 - * This case will end with segmentation fault. - * I happened to find on NPTL pthread_create() can fail is - * pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_INHERIT), while - * does not call pthread_attr_setschedparam() to set the prority. (since - * by default the priority will be 0. But this is implementation specific. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int created_thread; /* Flag indicating that the thread start routine was reached, and - therefore, the thread was created. */ -int segfault_flag; /* Flag indicating that a segmentation fault occured. */ - -/* Thread's start routine. */ -void *a_thread_func() -{ - /* Indicate that the thread start routine was reached. If it was reached, the test - * fails, as the thread should have not been created in the first place. */ - created_thread = 1; - pthread_exit(0); - return NULL; -} - -/* Signal handler for SIGSEGV (segmentation fault signal) */ -void sig_handler(int sig) -{ - /* If a segmentation fault occured when it was supposed to (i.e. when pthread_create() - * was called with the invalid attributes object). */ - if(segfault_flag == 1) - { - /* check if the thread start routine was called. If yes, then the thread was - * created, meaning the test fails. */ - if(created_thread == 1) - { - printf("Test FAILED: Created thread though an invalid attribute was passed to pthread_create().\n"); - pthread_exit((void*)PTS_FAIL); - } - - printf("Test PASSED\n"); - pthread_exit((void*)PTS_PASS); - return; - } - - printf("Test FAILED: Did not receive segmentation fault signal, waited 10 seconds.\n"); - pthread_exit((void*)PTS_FAIL); - return; -} - -/* MAIN */ -int main() -{ - pthread_t new_th; - pthread_attr_t inv_attr; - struct sigaction act; - - /* Inializing flags. */ - segfault_flag = 1; - created_thread = 0; - - /* Set signal handler for SIGSEGV (seg fault) */ - act.sa_handler = sig_handler; - act.sa_flags = 0; - sigaction(SIGSEGV, &act, NULL); - - /* Create the thread with the invalid, uninitialized attributes object. */ - pthread_create(&new_th, &inv_attr, a_thread_func, NULL); - - /* Should not reach here if process correctly seg-faulted. */ - segfault_flag = 0; - - /* Timeout after 10 seconds if a segfault was not encountered. The test then fails. */ - sleep(10); - - /* Manually send the SIGSEGV signal to the signal handler. If this point is reached, - * the test fails. */ - if(raise(SIGSEGV) != 0) - { - perror("Error in raise()\n"); - return PTS_UNRESOLVED; - } - - printf("Test FAILED.\n"); - return PTS_FAIL; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/11-1.c deleted file mode 100644 index 9b62db0066..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/11-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * adam.li@intel.com - * - * if _POSIX_THREAD_CPUTIME is defined, the new thread shall have a CPU-time - * clock accessible, and the initial value of this clock shall be set to 0. - */ - /* Create a new thread and get the time of the thread CUP-time clock - * using clock_gettime(). - * Note, the tv_nsec cannot be exactly 0 at the time of calling - * clock_gettime() since the thread has executed some time. */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - clockid_t cpuclock; - struct timespec ts = {.tv_sec = 1, .tv_nsec = 1}; - pthread_getcpuclockid(pthread_self(), &cpuclock); - clock_gettime(cpuclock, &ts); - /* Just test the tv_sec field here. */ - if (ts.tv_sec != 0) - { - printf("ts.tv_sec: %ld, ts.tv_nsec: %ld\n", - ts.tv_sec, ts.tv_nsec); - exit(PTS_FAIL); - } - pthread_exit(0); - return NULL; -} - -int main() -{ -#if _POSIX_THREAD_CPUTIME == -1 - printf("_POSIX_THREAD_CPUTIME not supported\n"); - return PTS_UNSUPPORTED; -#endif - pthread_t new_th; - - if (sysconf(_SC_THREAD_CPUTIME) == -1) { - printf("_POSIX_THREAD_CPUTIME not supported\n"); - return PTS_UNSUPPORTED; - } - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - pthread_join(new_th, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/12-1.c deleted file mode 100644 index e6b7662494..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/12-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_create() - * - * If success, pthread_create() returns zero. - * - * Steps: - * 1. Create a thread using pthread_create(), passing to it all valid values. - * 2. If the return code was not EGAIN, EPERM or EINVAL, it should return 0. - */ - -#include -#include -#include -#include "posixtest.h" - -/* Thread starting routine that really does nothing. */ -void *a_thread_func() -{ - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int ret; - - /* Create new thread and check the return value. */ - ret = pthread_create(&new_th, NULL, a_thread_func, NULL); - if(ret != 0) - { - if((ret != EINVAL) && (ret != EAGAIN) && (ret != EPERM)) - - printf("Test FAILED: Wrong return code: %d\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/13.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/13.sh deleted file mode 100755 index 3e3d2c9906..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/13.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_create() fails and an error number is returned if: - -# - [EAGAIN] The system lacked the resources to create another thread, -# or the system-imposed limit on the total number of threads -# in a process {PTHREAD_THREADS_MAX} would be exceeded. -# - [EINVAL] The value specified by 'attr' is invalid. -# - [EPERM] The caller does not have the appropriate permission to set -# the required scheduling parameters or scheduling policy. - -# This is tested implicitly via assertion 10. Note: only EINVAL is tested because the other -# 2 conditions are hard to emmulate. - -echo "Tested implicitly via assertion 10. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/14-1.c deleted file mode 100644 index 5448b359fc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/14-1.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The function does not return EINTR - - * The steps are: - * -> pthread_kill a thread which creates threads - * -> check that EINTR is never returned - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -char do_it=1; -char woken=0; -unsigned long count_ope=0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - pid_t process; - - process=getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - ret = kill(process, thearg->sig); - if (ret != 0) { UNRESOLVED(errno, "Kill in sendsig"); } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -/* This one is registered for signal SIGUSR2 */ -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* Thread function -- almost does nothing */ -void * threaded(void * arg) -{ - int ret; - - /* Signal we're done (especially in case of a detached thread) */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - /* return */ - return arg; -} - -/* Test function -- creates the threads and check that EINTR is never returned. */ -void * test(void * arg) -{ - int ret=0; - pthread_t child; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_UNBLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread"); } - - sc = 0; - - while (do_it) - { - #if VERBOSE > 5 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - count_ope++; - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, NULL); - if (ret == EINTR) { FAILED("pthread_create returned EINTR"); } - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 5 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - ; - } - if (ret == 0) /* The new thread is running */ - { - if (scenarii[sc].detached == 0) - { - ret = pthread_join(child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - else - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - } - - /* Change thread attribute for the next loop */ - sc++; - sc %= NSCENAR; - } - return NULL; -} - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* Initialize thread attribute objects */ - scenar_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset(&usersigs); - ret = sigaddset(&usersigs, SIGUSR1); - ret |= sigaddset(&usersigs, SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Unable to add SIGUSR1 or 2 to a signal set"); } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread"); } - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - if ((ret = pthread_create(&th_work, NULL, test, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - /* Let's wait for a while now */ - sleep(1); - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - - if ((ret = pthread_join(th_work, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - scenar_fini(); - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" %d thread creations.\n", count_ope); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/15-1.c deleted file mode 100644 index 2dcd59c542..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/15-1.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * If the current thread has an alternate stack, the new thread does not inherit - * this stack - - * The steps are: - * -> Create a thread with an alternate stack. - * -> From this thread, create another thread. - * -> Check that the new thread does not use the same stack. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#define STD_MAIN -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -void * teststack(void * arg) -{ - int ret=0; - *(int **)arg = &ret; - return NULL; -} - -/* Thread function */ -void * threaded(void * arg) -{ - int ret; - int * child_stack; - pthread_t gchild; - - int sz = sysconf(_SC_THREAD_STACK_MIN); - - if (scenarii[sc].bottom != NULL) - { - #if VERBOSE > 1 - output("Processing test\n"); - #endif - - /* Create a new thread and get a location inside its stack */ - ret = pthread_create(&gchild, NULL, teststack, &child_stack); - if (ret != 0) { UNRESOLVED(ret, "Failed to create a thread with default attribute"); } - - ret = pthread_join(gchild, NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to join the test thread"); } - - /* Check the new thread stack location was outside of the current thread location */ - /* We convert all the @ to longs */ - #if VERBOSE > 4 - output("Current stack : %p -> %p\n", scenarii[sc].bottom, sz + (long)scenarii[sc].bottom); - output("Child location: %p\n", child_stack); - #endif - - if ( (((long)scenarii[sc].bottom) < ((long)child_stack)) - && (((long)child_stack) < (((long)scenarii[sc].bottom) + sz))) - { - FAILED("The new thread inherited th alternate stack from its parent"); - } - } - - /* Signal we're done (especially in case of a detached thread) */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - /* return */ - return arg; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/2-1.c deleted file mode 100644 index f2075f3eb0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/2-1.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test If 'attr' is NULL, the default attributes shall be used. - * The attribute that will be tested is the detached state, because that is - * the only state that has a default listed in the specification. - * - * default: PTHREAD_CREATE_JOINABLE - * Other valid values: PTHREAD_CREATE_DETACHED - - * - * Steps: - * 1. Create a thread using pthread_create() and passing 'NULL' for 'attr'. - * 2. Check to see if the thread is joinable, since that is the default. - * 3. We do this by calling pthread_join() and pthread_detach(). If - * they fail, then the thread is not joinable, and the test fails. - */ - -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Create a new thread. The default attribute should be that - * it is joinable. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* The new thread should be able to be joined. */ - if(pthread_join(new_th, NULL) == EINVAL) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* The new thread should be able to be detached. */ - if(pthread_detach(new_th) == EINVAL) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-1.c deleted file mode 100644 index 0e03f0d8d2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-1.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test if the attributes specified by 'attr' are modified later, the thread's - * attributes shall not be affected. - * The attribute that will be tested is the detached state. - * - * - * Steps: - * 1. Set a pthread_attr_t object to be PTHREAD_CREATE_JOINABLE. - * 2. Create a new thread using pthread_create() and passing this attribute - * object. - * 3. Change the attribute object to be in a detached state rather than - * joinable. - * 4. Doing this should not effect the fact that the thread that was created - * is joinable, and so calling the functions pthread_detach() should not fail. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define TIMEOUT 10 /* Timeout value of 10 seconds. */ -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ - -void *a_thread_func() -{ - /* Indicate to main() that the thread was created. */ - sem1=INTHREAD; - - /* Wait for main to detach change the attribute object and try and detach this thread. - * Wait for a timeout value of 10 seconds before timing out if the thread was not able - * to be detached. */ - sleep(TIMEOUT); - - printf("Test FAILED: Did not detach the thread, main still waiting for it to end execution.\n"); - pthread_exit((void*)PTS_FAIL); - return NULL; -} - -int main() -{ - pthread_t new_th; - pthread_attr_t new_attr; - int ret; - - /* Initializing */ - sem1 = INMAIN; - if(pthread_attr_init(&new_attr) != 0) - { - perror("Error intializing attribute object\n"); - return PTS_UNRESOLVED; - - } - - /* Make the new attribute object joinable */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_JOINABLE) != 0) - { - perror("Error setting the detached state of the attribute\n"); - return PTS_UNRESOLVED; - } - - /* Create a new thread and pass it the attribute object that will - * make it joinable. */ - if(pthread_create(&new_th, &new_attr, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - while(sem1==INMAIN) - sleep(1); - - /* Now change the attribute object to be in a detached state */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_DETACHED) != 0) - { - perror("Error setting the detached state of the attribute\n"); - return PTS_UNRESOLVED; - } - - /* The new thread should still be able to be detached. */ - if((ret=pthread_detach(new_th)) == EINVAL) - { - printf("Test FAILED: pthread_detach failed on joinable thread. Return value is %d\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-2.c deleted file mode 100644 index 3c3d8768dd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-2.c +++ /dev/null @@ -1,649 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * Once the thread has been created, subsequent changes to the - * thread attribute object don't affect the running thread. - - * The steps are: - * -> stack grow - * -> create a thread with minimal stack size - * -> change the stack size to a bigger value - * -> check that the thread stack size did not change. - * -> stack decrease - * -> create a thread with a known stack size (> minimum) - * -> change the stack size to the min value - * -> check that the thread stack size did not change. - * -> sched policy/param change - * -> create a new thread with a known policy - * -> change the policy in the thread attribute and check the thread policy did not change - * -> change the schedparam in the thread attribute and check the thread priority did not change - * -> change the policy in the running thread and check the thread attribute did not change. - * -> change the priority in the running thread and check the thread attribute did not change. - - * The test fails if one of the checking fails - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -sem_t semsync[2]; /* These semaphores will only be used in child process! */ - -/* The overflow function is used to test the stack overflow */ -void * overflow(void * arg) -{ - void * current; - void * pad[50]; /* We want to consume the stack quickly */ - long stacksize = sysconf(_SC_THREAD_STACK_MIN); /* make sure we touch the current stack memory */ - - pad[1]=NULL; /* so compiler stops complaining about unused variables */ - int ret = 0; - - if (arg == NULL) - { - /* first call */ - - /* Synchronize with the parent */ - do { ret = sem_wait(&semsync[0]); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - - /* Go to recursion */ - current = overflow(¤t); - - /* Terminated */ - do { ret = sem_post(&semsync[1]); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - /* Terminate the overflow thread */ - return current; - } - - /* we cast the pointers into long, which might be a problem on some architectures... */ - if ( ((long)arg) < ((long)¤t)) - { - /* the stack is growing up */ - if ( ((long)¤t) - ((long)arg) >= stacksize) - { - output("Growing up stack started below %p and we are currently up to %p\n", arg, ¤t); - return (void *)0; - } - } - else - { - /* the stack is growing down */ - if ( ((long)arg) - ((long)¤t) >= stacksize) - { - output("Growing down stack started upon %p and we are currently down to %p\n", arg, ¤t); - return (void *)0; - } - } - - /* We are not yet overflowing, so we loop */ - return overflow(arg); -} - -/* The following function will return - 0 if a thread created with the attribute ta is able to fill the stack up to {minstacksize}. - 1 if the operation failed. - 2 if an error prevented the test to complete - - If newsize is not 0, the stack size in ta will be set to this value once the thread is created. - -*/ -int test_stack(pthread_attr_t * ta, size_t newsize) -{ - pid_t child, ctrl; - int status; - int ret; - - child=fork(); /* We'll test the feature in another process as this test may segfault */ - - if (child == -1) - { - output("Failed to fork (%s)\n", strerror(errno)); - return 2; - } - - if (child != 0) /* father */ - { - /* Just wait for the child and check its return value */ - ctrl = waitpid(child, &status, 0); - if (ctrl != child) - { - output("Failed to wait for process termination (%s)\n", strerror(errno)); - return 2; - } - - if (WIFEXITED(status)) /* The process exited */ - { - if (WEXITSTATUS(status) == 0) - { return 0; } /* We were able to fill the stack */ - if (WEXITSTATUS(status) == PTS_UNRESOLVED) - { - output("The child process returned unresolved status\n"); - return 2; - } - else - { - output("The child process returned: %i\n", WEXITSTATUS(status)); - return 2; - } - } - else - { - #if VERBOSE > 4 - output("The child process did not return\n"); - if (WIFSIGNALED(status)) - output("It was killed with signal %i\n", WTERMSIG(status)); - else - output("neither was it killed. (status = %i)\n", status); - #endif - } - - return 1; - } - - /* else */ - /* this is the new process */ - { - pthread_t th; - void * rc; - int detach; - - /* Semaphore to force the child to wait */ - ret = sem_init(&semsync[0], 0,0); - if (ret == -1) { UNRESOLVED(errno, "Unable to init a semaphore"); } - /* Semaphore to detect thread ending */ - ret = sem_init(&semsync[1], 0,0); - if (ret == -1) { UNRESOLVED(errno, "Unable to init a semaphore"); } - - ret = pthread_create(&th, ta, overflow, NULL); /* Create a new thread with the same attributes */ - if (ret != 0) { UNRESOLVED(ret, "Unable to create a thread in the new process"); } - - /* If we were asked to perform a change on ta, do it now. */ - if (newsize) - { - ret = pthread_attr_setstacksize(ta, newsize); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the new stack size"); } - } - - /* Ok the child can run now */ - do { ret = sem_post(&semsync[0]); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - - /* Wait for its termination */ - do { ret = sem_wait(&semsync[1]); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - if (ta != NULL) - { - ret = pthread_attr_getdetachstate(ta, &detach); - if (ret != 0) { UNRESOLVED(ret, "Failed to get detach state from the thread attribute"); } - } - else - { - detach = PTHREAD_CREATE_JOINABLE; /* default */ - } - - if (detach == PTHREAD_CREATE_JOINABLE) - { - ret = pthread_join(th, &rc); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - if (rc != (void *)0) - { UNRESOLVED((int)(long)rc, "The overflow function returned an unexpected value"); } - } - - - /* Terminate the child process here */ - exit(0); - } -} - - -typedef struct -{ - pthread_barrier_t bar; - int policy; - struct sched_param param; -} testdata_t; - -void * schedtest(void * arg) -{ - testdata_t * td = (testdata_t *)arg; - int newpol, ret=0; - struct sched_param newparam; - - /* Read the current sched policy & param */ - ret = pthread_getschedparam(pthread_self(), &(td->policy), &(td->param)); - if (ret != 0) { UNRESOLVED(ret, "Failed to read current thread policy / param"); } - - /* sync 1 */ - ret = pthread_barrier_wait(&(td->bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* sync 2 */ - ret = pthread_barrier_wait(&(td->bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* Read the current sched policy & param */ - ret = pthread_getschedparam(pthread_self(), &(td->policy), &(td->param)); - if (ret != 0) { UNRESOLVED(ret, "Failed to read current thread policy / param"); } - - /* sync 3 */ - ret = pthread_barrier_wait(&(td->bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* sync 4 */ - ret = pthread_barrier_wait(&(td->bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* Change the current sched policy & param */ - if (td->policy == SCHED_RR) - newpol = SCHED_FIFO; - else - newpol = SCHED_RR; - - newparam.sched_priority = sched_get_priority_max(newpol); - - if (newparam.sched_priority == td->param.sched_priority) - newparam.sched_priority--; - - ret = pthread_setschedparam(pthread_self(), newpol, &newparam); - #if VERBOSE > 0 - if (ret != 0) - output("Changing the current thread sched policy failed with error: %s\n", strerror(ret)); - #endif - #if VERBOSE > 2 - else - output("Executing thread scheduling policy changed\n"); - #endif - - /* sync 5 */ - ret = pthread_barrier_wait(&(td->bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* Post the sem in case of a detached thread */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - return NULL; -} - - - -int main (int argc, char *argv[]) -{ - int ret=0; - int do_stack_tests; - int do_sched_tests; - - /* Initialize output routine */ - output_init(); - - /* Test abilities */ - do_sched_tests = (sysconf(_SC_THREAD_PRIORITY_SCHEDULING)>0?1:0); - do_stack_tests = (test_stack(NULL,0)==0?1:0); - #if VERBOSE > 0 - output("Test starting\n Stack tests %s be executed.\n Sched tests %s be executed.\n", - do_stack_tests?"will":"won't", - do_sched_tests?"will":"won't"); - #endif - - /* Initialize thread attribute objects */ - scenar_init(); - - for (sc=0; sc < NSCENAR; sc++) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - if (do_stack_tests) - { - /* stack grow test */ - /* We need the thread attribute to specify a minimal stack */ - if ((scenarii[sc].altstack == 0) && (scenarii[sc].altsize == 1)) - { - #if VERBOSE > 2 - output("Processing stack grow test\n"); - #endif - - ret = test_stack(&scenarii[sc].ta, 2*sysconf(_SC_THREAD_STACK_MIN)); - - if (ret == 0) - { - if (scenarii[sc].guard == 2) - { - FAILED("Changing the stacksize after the thread was created changed the running thread stack size"); - } - #if VERBOSE > 2 - else - output("We were able to overflow the stack, but the guard area is unknow or null\n"); - #endif - - } - - if ((ret != 2) && (scenarii[sc].result == 1)) - { - UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); - } - - #if VERBOSE > 2 - if ((ret == 1)) - { - output("Stack grow test passed\n"); - } - - if ((ret == 2) && (scenarii[sc].result == 2)) - { - output("Something went wrong -- we don't care in this case\n"); - } - #endif - - if ((ret == 2) && (scenarii[sc].result == 0)) - { - UNRESOLVED(-1, "An unexpected error occured\n"); - } - - /* Ok, set back the thread attribute object to a correct value */ - ret = pthread_attr_setstacksize(&scenarii[sc].ta, sysconf(_SC_THREAD_STACK_MIN)); - if (ret != 0) { UNRESOLVED(ret, "Failed to set stacksize back"); } - } - - - /* stack decrease test */ - if ((scenarii[sc].altstack == 0) && (scenarii[sc].altsize == 0)) - { - #if VERBOSE > 2 - output("Processing stack decrease test\n"); - #endif - - ret = test_stack(&scenarii[sc].ta, sysconf(_SC_THREAD_STACK_MIN)); - - if (ret == 1) { FAILED("Decreasing the stack size after thread is created had an influence on the thread"); } - - if ((ret == 0) && (scenarii[sc].result == 1)) - { - UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); - } - - if ((ret == 2) && (scenarii[sc].result == 0)) - { - UNRESOLVED(-1, "An unexpected error occured\n"); - } - - #if VERBOSE > 2 - if (ret == 0) - output("Stack decrease test passed.\n"); - else - output("Something failed but we don't care here.\n"); - #endif - } - - - } /* if do_stack_tests */ - - if (do_sched_tests) - { - /* Sched policy/param change test */ - if (scenarii[sc].explicitsched != 0) /* We need a specified policy */ - { - pthread_t child; - int policy_ori, newpol_max; - struct sched_param param_ori, tmp; - - testdata_t td; - - #if VERBOSE > 2 - output("Processing sched policy/param change test\n"); - #endif - - /* Backup the scenario object */ - ret = pthread_attr_getschedpolicy(&(scenarii[sc].ta), &policy_ori); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched policy from thread attribute"); } - ret = pthread_attr_getschedparam(&(scenarii[sc].ta), ¶m_ori); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched param from thread attribute"); } - - /* Initialize the barrier */ - ret = pthread_barrier_init(&(td.bar), NULL, 2); - if (ret != 0) { UNRESOLVED(ret, "Unable to initialize the barrier"); } - - /* Create a new thread with this scenario attribute */ - ret = pthread_create(&child, &(scenarii[sc].ta), schedtest, &td); - if (ret != 0) - { - if (scenarii[sc].result == 0) - { UNRESOLVED(ret , "Failed to create a thread"); } - - #if VERBOSE > 2 - if (scenarii[sc].result == 2) - { - output("The thread creation failed -- we don't care\n"); - } - if (scenarii[sc].result == 1) - { - output("The thread creation failed as expected\n"); - } - #endif - } - else /* Thread created */ - { - if (scenarii[sc].result == 1) - { UNRESOLVED(-1, "The thread was created where an error was expected"); } - - #if VERBOSE > 2 - if (scenarii[sc].result == 2) - output("Thread is created\n"); - #endif - - /* sync 1 */ - ret = pthread_barrier_wait(&(td.bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* Check the new thread reports the attributes */ - if (td.policy != policy_ori) - { FAILED("The new thread does not report the scheluling policy that was specified"); } - - if (td.param.sched_priority != param_ori.sched_priority) - { FAILED("The new thread does not report the scheduling priority that was specified at creation"); } - - /* Change the thread attribute object policy & param */ - if (policy_ori == SCHED_RR) - { - ret = pthread_attr_setschedpolicy(&(scenarii[sc].ta), SCHED_FIFO); - newpol_max = sched_get_priority_max(SCHED_FIFO); - } - else - { - ret = pthread_attr_setschedpolicy(&(scenarii[sc].ta), SCHED_RR); - newpol_max = sched_get_priority_max(SCHED_RR); - } - if (ret != 0) { UNRESOLVED(ret, "Failed to change the attribute object"); } - - if (newpol_max == param_ori.sched_priority) - newpol_max--; - - tmp.sched_priority = newpol_max; - - ret = pthread_attr_setschedparam(&(scenarii[sc].ta), &tmp); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the attribute sched param"); } - - /* sync 2 */ - ret = pthread_barrier_wait(&(td.bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* sync 3 */ - ret = pthread_barrier_wait(&(td.bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* Check if the thread saw the change (should not) */ - if (td.policy != policy_ori) - { FAILED("The new thread does not report the scheluling policy that was specified"); } - - if (td.param.sched_priority != param_ori.sched_priority) - { FAILED("The new thread does not report the scheduling priority that was specified at creation"); } - - /* Check what we can see for the child thread from here */ - ret = pthread_getschedparam(child, &(td.policy), &(td.param)); - if (ret != 0) { UNRESOLVED(ret, "Failed to read child thread policy / param"); } - - if (td.policy != policy_ori) - { FAILED("The child thread does not report the scheduling policy that was specified at creation"); } - - if (td.param.sched_priority != param_ori.sched_priority) - { FAILED("The child thread does not report the scheduling priority that was specified at creation"); } - - /* Restore the thread attribute */ - ret = pthread_attr_setschedpolicy(&(scenarii[sc].ta), policy_ori); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched policy from thread attribute"); } - ret = pthread_attr_setschedparam(&(scenarii[sc].ta), ¶m_ori); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched param from thread attribute"); } - - /* sync 4*/ - ret = pthread_barrier_wait(&(td.bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* sync 5*/ - ret = pthread_barrier_wait(&(td.bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* check if the thread attribute reports a change (should not) */ - ret = pthread_attr_getschedpolicy(&(scenarii[sc].ta), &(td.policy)); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched policy from thread attribute"); } - ret = pthread_attr_getschedparam(&(scenarii[sc].ta), &(td.param)); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched param from thread attribute"); } - - if (td.policy != policy_ori) - { FAILED("The child thread does not report the scheduling policy that was specified at creation"); } - - if (td.param.sched_priority != param_ori.sched_priority) - { FAILED("The child thread does not report the scheduling priority that was specified at creation"); } - - /* Wait for the sem and join eventually the thread */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - if (scenarii[sc].detached == 0) - { - ret = pthread_join(child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - - #if VERBOSE > 2 - output("Sched policy/param change test passed\n"); - #endif - } /* thread created */ - } - - /* We could also test if the inheritsched does not influence the new thread */ - - } /* if do_sched_tests */ - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/4-1.c deleted file mode 100644 index cdd6601f3b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/4-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test upon successful completion, pthread_create() shall store the ID of the - * the created thread in the location referenced by 'thread'. - * - * Steps: - * 1. Create a thread using pthread_create() - * 2. Save the thread ID resulting from pthread_create() - * 3. Get the thread ID from the new thread by calling - * pthread_self(). - * 4. These 2 values should be equal. (i.e. the one from pthread_create() - * and the one from pthread_self()). - */ - -#include -#include -#include "posixtest.h" - -void *a_thread_func(); - -pthread_t self_th; /* Save the value of the function call pthread_self() - within the thread. Keeping it global so 'main' can - see it too. */ - -int main() -{ - pthread_t new_th; - - /* Create a new thread */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for the thread function to return to make sure we got - * the thread ID value from pthread_self(). */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error calling pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* If the value of pthread_self() and the return value from - * pthread_create() is equal, then the test passes. */ - if(pthread_equal(new_th, self_th) == 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - -/* The thread function that calls pthread_self() to obtain its thread ID */ -void *a_thread_func() -{ - self_th=pthread_self(); - pthread_exit(0); - return NULL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/5-1.c deleted file mode 100644 index 087faa4dc9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/5-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_create() - * The thread is created executing 'start_routine' with 'arg' as its only - * argument. - * - * Steps: - * 1. Create 5 separete threads using pthread_create() passing to it a single int 'arg'. - * 2. Use that passed int argument in the thread function start routine and make sure no - * errors occur. - */ - -#include -#include -#include -#include "posixtest.h" - -#define NUM_THREADS 5 - -/* The thread start routine. */ -void *a_thread_func(void* num) -{ - intptr_t i = (intptr_t) num; - printf("Passed argument for thread: %d\n", (int)i); - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - long i; - - for(i=1;i -#include -#include "posixtest.h" - -#define NUM_THREADS 5 - -/* The thread start routine. */ -void *a_thread_func(void* num) -{ - int *i, j; - - i = (int *)num; - - for(j=0;j -#include -#include -#include "posixtest.h" - -sigset_t th_pendingset, th_sigmask; - -void *a_thread_func() -{ - /* Obtain the signal mask of this thread. */ - pthread_sigmask(SIG_SETMASK, NULL, &th_sigmask); - - /* Obtain the pending signals of this thread. It should be empty. */ - if (sigpending(&th_pendingset) != 0) { - printf("Error calling sigpending()\n"); - return (void *)PTS_UNRESOLVED; - } - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - sigset_t main_sigmask, main_pendingset; - int ret; - - /* Empty set of signal mask and blocked signals */ - if ( (sigemptyset(&main_sigmask) != 0) || - (sigemptyset(&main_pendingset) != 0) ) - { - perror("Error in sigemptyset()\n"); - return PTS_UNRESOLVED; - } - - /* Add SIGCONT, SIGUSR1 and SIGUSR2 to the set of blocked signals */ - if (sigaddset(&main_sigmask, SIGUSR1) != 0) - { - perror("Error in sigaddset()\n"); - return PTS_UNRESOLVED; - } - - if (sigaddset(&main_sigmask, SIGUSR2) != 0) - { - perror("Error in sigaddset()\n"); - return PTS_UNRESOLVED; - } - - /* Block those signals. */ - if (pthread_sigmask(SIG_SETMASK, &main_sigmask, NULL) != 0) - { - printf("Error in pthread_sigmask()\n"); - return PTS_UNRESOLVED; - } - - /* Raise those signals so they are now pending. */ - if (raise(SIGUSR1) != 0) { - printf("Could not raise SIGALRM\n"); - return -1; - } - if (raise(SIGUSR2) != 0) { - printf("Could not raise SIGALRM\n"); - return -1; - } - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait until the thread has finished execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check to make sure that the sigmask of the thread is the same as the main thread */ - ret = sigismember(&th_sigmask, SIGUSR1); - if(ret != 1) - { - if(ret == 0) - { - printf("Error: Thread did not inherit main()s signal mask. SIGUSR1 not a member of the signal set.\n"); - return PTS_FAIL; - } - - perror("Error is sigismember()\n"); - return PTS_UNRESOLVED; - } - - ret = sigismember(&th_sigmask, SIGUSR2); - if(ret != 1) - { - if(ret == 0) - { - printf("Test FAILED: Thread did not inherit main()s signal mask. SIGUSR2 not a member of the signal set.\n"); - return PTS_FAIL; - } - - perror("Error is sigismember()\n"); - return PTS_UNRESOLVED; - } - - /* Check to make sure that the pending set of the thread does not contain SIGUSR1 or - * SIGUSR2. */ - - ret = sigismember(&th_pendingset, SIGUSR1); - if(ret != 0) - { - if(ret == 1) - { - printf("Error: Thread did not inherit main()s signal mask. SIGUSR1 not a member of the signal set.\n"); - return PTS_FAIL; - } - - perror("Error is sigismember()\n"); - return PTS_UNRESOLVED; - } - - ret = sigismember(&th_pendingset, SIGUSR2); - if(ret != 0) - { - if(ret == 1) - { - printf("Test FAILED: Thread did not inherit main()s signal mask. SIGUSR2 not a member of the signal set.\n"); - return PTS_FAIL; - } - - perror("Error is sigismember()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/8-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/8-2.c deleted file mode 100644 index c23a8e2bfd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/8-2.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The new thread inherits is signal mask from the calling thread, - * and has no pending signal at creation time. - - * The steps are: - * 1. In main(), create a signal mask with a few signals in the set (SIGUSR1 and SIGUSR2). - * 2. Raise those signals in main. These signals now should be pending. - * 3. Create a thread using pthread_create(). - * 4. The thread should have the same signal mask, but no signals should be pending. - - * Parts of this test are copied from 8-1.c (author: rolla.n.selbak REMOVE-THIS AT intel DOT com) - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -typedef struct -{ - sigset_t mask; - sigset_t pending; -} testdata_t; - - -/* Thread function; which will check the signal mask and pending signals */ -void * threaded(void * arg) -{ - int ret; - testdata_t * td=(testdata_t *)arg; - - /* Obtain the signal mask of this thread. */ - ret = pthread_sigmask(SIG_SETMASK, NULL, &(td->mask)); - if (ret != 0) { UNRESOLVED(ret, "Failed to get the signal mask of the thread"); } - - /* Obtain the pending signals of this thread. It should be empty. */ - ret = sigpending(&(td->pending)); - if (ret != 0) { UNRESOLVED(errno, "Failed to get pending signals from the thread"); } - - /* Signal we're done (especially in case of a detached thread) */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - /* return */ - return arg; -} - -int main (int argc, char *argv[]) -{ - int ret=0; - pthread_t child; - - testdata_t td_parent, td_thread; - - /* Initialize output routine */ - output_init(); - - /* Initialize thread attribute objects */ - scenar_init(); - - /* Initialize the signal state */ - ret = sigemptyset(&(td_parent.mask)); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a signal set"); } - - ret = sigemptyset(&(td_parent.pending)); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a signal set"); } - - /* Add SIGCONT, SIGUSR1 and SIGUSR2 to the set of blocked signals */ - ret = sigaddset(&(td_parent.mask), SIGUSR1); - if (ret != 0) { UNRESOLVED(ret, "Failed to add SIGUSR1 to the signal set"); } - - ret = sigaddset(&(td_parent.mask), SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Failed to add SIGUSR2 to the signal set"); } - - /* Block those signals. */ - ret = pthread_sigmask(SIG_SETMASK, &(td_parent.mask), NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to mask the singals in main"); } - - /* Raise those signals so they are now pending. */ - ret = raise(SIGUSR1); - if (ret != 0) { UNRESOLVED(errno, "Failed to raise SIGUSR1"); } - ret = raise(SIGUSR2); - if (ret != 0) { UNRESOLVED(errno, "Failed to raise SIGUSR2"); } - - /* Do the testing for each thread */ - for (sc=0; sc < NSCENAR; sc++) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - /* (re)initialize thread signal sets */ - ret = sigemptyset(&(td_thread.mask)); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a signal set"); } - - ret = sigemptyset(&(td_thread.pending)); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a signal set"); } - - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, &td_thread); - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - if (scenarii[sc].detached == 0) - { - ret = pthread_join(child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - else - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - - /* The thread has terminated its work, so we can now control */ - ret = sigismember(&(td_thread.mask), SIGUSR1); - if (ret != 1) - { - if (ret == 0) { FAILED("The thread did not inherit the signal mask"); } - /* else */ - UNRESOLVED(ret, "sigismember() failed"); - } - - ret = sigismember(&(td_thread.mask), SIGUSR2); - if (ret != 1) - { - if (ret == 0) { FAILED("The thread did not inherit the signal mask"); } - /* else */ - UNRESOLVED(ret, "sigismember() failed"); - } - - ret = sigismember(&(td_thread.pending), SIGUSR1); - if (ret != 0) - { - if (ret == 1) { FAILED("The thread inherited the pending signal SIGUSR1"); } - /* else */ - UNRESOLVED(ret, "sigismember() failed"); - } - - ret = sigismember(&(td_thread.pending), SIGUSR2); - if (ret != 0) - { - if (ret == 1) { FAILED("The thread inherited the pending signal SIGUSR2"); } - /* else */ - UNRESOLVED(ret, "sigismember() failed"); - } - - - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/assertions.xml deleted file mode 100644 index b010d2c3f8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/assertions.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - The - - int pthread_create(pthread_t *restrict thread, const pthread_attr_t - *restrict attr, void *(*start_routine) (void*), void *restrict arg); - - creates a new thread, with attributes specified - by 'attr', within a process. - - - If 'attr' is NULL, the default attributes shall be used. - The attribute that will be tested is the detached state, because that is - the only state that has a default listed in the specification. - - default: PTHREAD_CREATE_JOINABLE - Other valid values: PTHREAD_CREATE_DETACHED - - - - If the attributes specified by 'attr' are modified later after the thread - is create, the thread's attributes should not be affected. - - - If success, pthread_create() will store the ID of the - the created thread in the location referenced by 'thread'. - - - The thread is created executing 'start_routine' with 'arg' as its only - argument. - - - If the 'start_routine' returns, the effect shall be as if there was an - implicit call to pthread_exit() using the return value of 'start_routine' - as the exit status. - NOTE: that the thread in which main() was originally invoked is different - from this - - - When it returns from main(), the effect shall be as if there was an implicit - call to exit() using the return value of main() as the exit status. - - - The signal state of the new thread will be initialized as so: - - - The signal mask shall be inherited from the created thread - - The set of signals pending for the new thread shall be empty. - - - The floating point environment shall be inherited from the created thread. - - - If pthread_create() fails, no new thread is created and the contents of the - location referenced by 'thread' is undefined. - - - if _POSIX_THREAD_CPUTIME is defined, the new thread shall have a CPU-time - clock accessible, and the initial value of this clock shall be set to 0. - - - If success, pthread_create() returns zero. - - - If pthread_create() fails, an error number is returned: - - - [EAGAIN] The system lacked the resources to create another thread, - or the system-imposed limit on the total number of threads - in a process {PTHREAD_THREADS_MAX} would be exceeded. - - [EINVAL] The value specified by 'attr' is invalid. - - [EPERM] The caller does not have the appropriate permission to set - the required scheduling parameters or scheduling policy. - - - [EINTR] must not be returned. - - - If the current thread uses an alternate stack, the new thread does not inherit this stack. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/coverage.txt deleted file mode 100644 index 59db4d9b37..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/coverage.txt +++ /dev/null @@ -1,19 +0,0 @@ -This document defines the coverage for the pthread_create function: - -Assertion Tested? -1 YES - Also, need to test 'attr' values. -2 YES -3 YES -4 YES -5 YES -6 NO - Skipping. -7 NO - Skipping. -8 YES -9 NO - Skipping. (Floating point environment?) -10 YES - Peculiar behavior of passing the test and then freezing on the - linuxthreads implementation. -11 YES -12 YES -13 YES - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/threads_scenarii.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/threads_scenarii.c deleted file mode 100644 index 68d8b05fbe..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/threads_scenarii.c +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This file is a helper file for the pthread_create tests - * It defines the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - * - */ - - -struct __scenario -{ - /* Object to hold the given configuration, and which will be used to create the threads */ - pthread_attr_t ta; - /* General parameters */ - int detached; /* 0 => joinable; 1 => detached */ - /* Scheduling parameters */ - int explicitsched; /* 0 => sched policy is inherited; 1 => sched policy from the attr param */ - int schedpolicy; /* 0 => default; 1=> SCHED_FIFO; 2=> SCHED_RR */ - int schedparam; /* 0 => default sched param; 1 => max value for sched param; -1 => min value for sched param */ - int altscope; /* 0 => default contension scope; 1 => alternative contension scope */ - /* Stack parameters */ - int altstack; /* 0 => system manages the stack; 1 => stack is provided */ - int guard; /* 0 => default guardsize; 1=> guardsize is 0; 2=> guard is 1 page -- this setting only affect system stacks (not user's). */ - int altsize; /* 0 => default stack size; 1 => stack size specified (min value) -- ignored when stack is provided */ - /* Additionnal information */ - char * descr; /* object description */ - void * bottom; /* Stores the stack start when an alternate stack is required */ - int result; /* This thread creation is expected to: 0 => succeed; 1 => fail; 2 => unknown */ - sem_t sem; /* This semaphore is used to signal the end of the detached threads execution */ -} scenarii[]= - -#define CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,res) \ - { \ - .detached=det, \ - .explicitsched=expl, \ - .schedpolicy=scp, \ - .schedparam=spa, \ - .altscope=sco, \ - .altstack=sta, \ - .guard=gua, \ - .altsize=ssi, \ - .descr=desc, \ - .bottom=NULL, \ - .result=res } - -#define CASE_POS(det,expl,scp,spa,sco,sta,gua,ssi,desc) CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,0) -#define CASE_NEG(det,expl,scp,spa,sco,sta,gua,ssi,desc) CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,1) -#define CASE_UNK(det,expl,scp,spa,sco,sta,gua,ssi,desc) CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,2) - - /* - * This array gives the different combinations of threads attributes for the testcases. - * - * Some combinations must be avoided. - * -> Do not have a detached thread use an alternative stack; - * as we don't know when the thread terminates to free the stack memory - * -> ... (to be completed) - * - */ - -{ - /* Unary tests */ -/* 0*/ CASE_POS( 0, 0, 0, 0, 0, 0, 0, 0, "default") -/* 1*/ ,CASE_POS( 1, 0, 0, 0, 0, 0, 0, 0, "detached") -/* 2*/ ,CASE_POS( 0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched") -/* 3*/ ,CASE_UNK( 0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy") -/* 4*/ ,CASE_UNK( 0, 0, 2, 0, 0, 0, 0, 0, "RR Policy") -/* 5*/ ,CASE_UNK( 0, 0, 0, 1, 0, 0, 0, 0, "Max sched param") -/* 6*/ ,CASE_UNK( 0, 0, 0,-1, 0, 0, 0, 0, "Min sched param") -/* 7*/ ,CASE_POS( 0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope") -/* 8*/ ,CASE_POS( 0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack") -/* 9*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 0, "No guard size") -/*10*/ ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 0, "1p guard size") -/*11*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 1, "Min stack size") - - /* Stack play */ - ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard") - ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard") - ,CASE_POS( 1, 0, 0, 0, 0, 1, 0, 0, "Detached, Alternative stack") - ,CASE_POS( 1, 0, 0, 0, 0, 0, 1, 1, "Detached, Min stack size, no guard") - ,CASE_UNK( 1, 0, 0, 0, 0, 0, 2, 1, "Detached, Min stack size, 1p guard") - - /* Scheduling play -- all results are unknown since it might depend on the user priviledges */ - ,CASE_UNK( 0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param") - ,CASE_UNK( 0, 1, 2, 1, 0, 0, 0, 0, "Explicit RR max param") - ,CASE_UNK( 0, 1, 1,-1, 0, 0, 0, 0, "Explicit FIFO min param") - ,CASE_UNK( 0, 1, 2,-1, 0, 0, 0, 0, "Explicit RR min param") - ,CASE_UNK( 0, 1, 1, 1, 1, 0, 0, 0, "Explicit FIFO max param, alt scope") - ,CASE_UNK( 0, 1, 2, 1, 1, 0, 0, 0, "Explicit RR max param, alt scope") - ,CASE_UNK( 0, 1, 1,-1, 1, 0, 0, 0, "Explicit FIFO min param, alt scope") - ,CASE_UNK( 0, 1, 2,-1, 1, 0, 0, 0, "Explicit RR min param, alt scope") - ,CASE_UNK( 1, 1, 1, 1, 0, 0, 0, 0, "Detached, explicit FIFO max param") - ,CASE_UNK( 1, 1, 2, 1, 0, 0, 0, 0, "Detached, explicit RR max param") - ,CASE_UNK( 1, 1, 1,-1, 0, 0, 0, 0, "Detached, explicit FIFO min param") - ,CASE_UNK( 1, 1, 2,-1, 0, 0, 0, 0, "Detached, explicit RR min param") - ,CASE_UNK( 1, 1, 1, 1, 1, 0, 0, 0, "Detached, explicit FIFO max param, alt scope") - ,CASE_UNK( 1, 1, 2, 1, 1, 0, 0, 0, "Detached, explicit RR max param, alt scope") - ,CASE_UNK( 1, 1, 1,-1, 1, 0, 0, 0, "Detached, explicit FIFO min param, alt scope") - ,CASE_UNK( 1, 1, 2,-1, 1, 0, 0, 0, "Detached, explicit RR min param, alt scope") - -}; - -#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0])) - -/* This function will initialize every pthread_attr_t object in the scenarii array */ -void scenar_init() -{ - int ret=0; - int i; - int old; - long pagesize, minstacksize; - long tsa, tss, tps; - - pagesize =sysconf(_SC_PAGESIZE); - minstacksize =sysconf(_SC_THREAD_STACK_MIN); - tsa =sysconf(_SC_THREAD_ATTR_STACKADDR); - tss =sysconf(_SC_THREAD_ATTR_STACKSIZE); - tps =sysconf(_SC_THREAD_PRIORITY_SCHEDULING); - - #if VERBOSE > 0 - output("System abilities:\n"); - output(" TSA: %li\n", tsa); - output(" TSS: %li\n", tss); - output(" TPS: %li\n", tps); - output(" pagesize: %li\n", pagesize); - output(" min stack size: %li\n", minstacksize); - #endif - - - if (minstacksize % pagesize) - { - UNTESTED("The min stack size is not a multiple of the page size"); - } - - for (i=0; i 2 - output("Initializing attribute for scenario %i: %s\n", i, scenarii[i].descr); - #endif - - ret = pthread_attr_init(&scenarii[i].ta); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a thread attribute object"); } - - /* Set the attributes according to the scenario */ - if (scenarii[i].detached == 1) - { - ret = pthread_attr_setdetachstate(&scenarii[i].ta, PTHREAD_CREATE_DETACHED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set detachstate"); } - } - else - { - ret = pthread_attr_getdetachstate(&scenarii[i].ta, &old); - if (ret != 0) { UNRESOLVED(ret, "Unable to get detachstate from initialized attribute"); } - if (old != PTHREAD_CREATE_JOINABLE) { FAILED("The default attribute is not PTHREAD_CREATE_JOINABLE"); } - } - #if VERBOSE > 4 - output("Detach state was set sucessfully\n"); - #endif - - /* Sched related attributes */ - if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */ - { - if (scenarii[i].explicitsched == 1) - ret = pthread_attr_setinheritsched(&scenarii[i].ta, PTHREAD_EXPLICIT_SCHED); - else - ret = pthread_attr_setinheritsched(&scenarii[i].ta, PTHREAD_INHERIT_SCHED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set inheritsched attribute"); } - #if VERBOSE > 4 - output("inheritsched state was set sucessfully\n"); - #endif - } - #if VERBOSE > 4 - else - output("TPS unsupported => inheritsched parameter untouched\n"); - #endif - - if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */ - { - if (scenarii[i].schedpolicy == 1) - { - ret = pthread_attr_setschedpolicy(&scenarii[i].ta, SCHED_FIFO); - } - if (scenarii[i].schedpolicy == 2) - { - ret = pthread_attr_setschedpolicy(&scenarii[i].ta, SCHED_RR); - } - if (ret != 0) { UNRESOLVED(ret, "Unable to set the sched policy"); } - #if VERBOSE > 4 - if (scenarii[i].schedpolicy) - output("Sched policy was set sucessfully\n"); - else - output("Sched policy untouched\n"); - #endif - } - #if VERBOSE > 4 - else - output("TPS unsupported => sched policy parameter untouched\n"); - #endif - - if (scenarii[i].schedparam != 0) - { - struct sched_param sp; - - ret = pthread_attr_getschedpolicy(&scenarii[i].ta, &old); - if (ret != 0) { UNRESOLVED(ret, "Unable to get sched policy from attribute"); } - - if (scenarii[i].schedparam == 1) - sp.sched_priority = sched_get_priority_max(old); - if (scenarii[i].schedparam == -1) - sp.sched_priority = sched_get_priority_min(old); - - ret = pthread_attr_setschedparam(&scenarii[i].ta, &sp); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the sched param"); } - - #if VERBOSE > 4 - output("Sched param was set sucessfully to %i\n", sp.sched_priority); - } - else - { - output("Sched param untouched\n"); - #endif - } - - if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */ - { - ret = pthread_attr_getscope(&scenarii[i].ta, &old); - if (ret != 0) { UNRESOLVED(ret, "Failed to get contension scope from thread attribute"); } - - if (scenarii[i].altscope != 0) - { - if (old == PTHREAD_SCOPE_PROCESS) - old = PTHREAD_SCOPE_SYSTEM; - else - old = PTHREAD_SCOPE_PROCESS; - - ret = pthread_attr_setscope(&scenarii[i].ta, old); - //if (ret != 0) { UNRESOLVED(ret, "Failed to set contension scope"); } - if (ret != 0) { output("WARNING: The TPS option is claimed to be supported but setscope fails\n"); } - - #if VERBOSE > 4 - output("Contension scope set to %s\n", old==PTHREAD_SCOPE_PROCESS?"PTHREAD_SCOPE_PROCESS":"PTHREAD_SCOPE_SYSTEM"); - } - else - { - output("Contension scope untouched (%s)\n", old==PTHREAD_SCOPE_PROCESS?"PTHREAD_SCOPE_PROCESS":"PTHREAD_SCOPE_SYSTEM"); - #endif - } - } - #if VERBOSE > 4 - else - output("TPS unsupported => sched contension scope parameter untouched\n"); - #endif - - /* Stack related attributes */ - if ((tss>0) && (tsa>0)) /* This routine is dependent on the Thread Stack Address Attribute - and Thread Stack Size Attribute options */ - { - if (scenarii[i].altstack != 0) - { - /* This is slightly more complicated. We need to alloc a new stack - and free it upon test termination */ - /* We will alloc with a simulated guardsize of 1 pagesize */ - scenarii[i].bottom = malloc(minstacksize + pagesize); - if (scenarii[i].bottom == NULL) { UNRESOLVED(errno,"Unable to alloc enough memory for alternative stack"); } - - ret = pthread_attr_setstack(&scenarii[i].ta, scenarii[i].bottom, minstacksize); - if (ret != 0) { UNRESOLVED(ret, "Failed to specify alternate stack"); } - - #if VERBOSE > 1 - output("Alternate stack created successfully. Bottom=%p, Size=%i\n", scenarii[i].bottom, minstacksize); - #endif - } - } - #if VERBOSE > 4 - else - output("TSA or TSS unsupported => No alternative stack\n"); - #endif - - #ifndef WITHOUT_XOPEN - if (scenarii[i].guard != 0) - { - if (scenarii[i].guard == 1) - ret = pthread_attr_setguardsize(&scenarii[i].ta, 0); - if (scenarii[i].guard == 2) - ret = pthread_attr_setguardsize(&scenarii[i].ta, pagesize); - if (ret != 0) { UNRESOLVED(ret, "Unable to set guard area size in thread stack"); } - #if VERBOSE > 4 - output("Guard size set to %i\n", (scenarii[i].guard==1)?1:pagesize); - #endif - } - #endif - - if (tss>0) /* This routine is dependent on the Thread Stack Size Attribute option */ - { - if (scenarii[i].altsize != 0) - { - ret = pthread_attr_setstacksize(&scenarii[i].ta, minstacksize); - if (ret != 0) { UNRESOLVED(ret, "Unable to change stack size"); } - #if VERBOSE > 4 - output("Stack size set to %i (this is the min)\n", minstacksize); - #endif - } - } - #if VERBOSE > 4 - else - output("TSS unsupported => stack size unchanged\n"); - #endif - - ret = sem_init(&scenarii[i].sem, 0,0); - if (ret == -1) { UNRESOLVED(errno, "Unable to init a semaphore"); } - - } - #if VERBOSE > 0 - output("All %i thread attribute objects were initialized\n\n", NSCENAR); - #endif -} - -/* This function will free all resources consumed in the scenar_init() routine */ -void scenar_fini(void) -{ - int ret = 0, i; - - for (i=0; i 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, NULL); - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - if (scenarii[sc].detached == 0) - { - ret = pthread_join(child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - else - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/1-2.c deleted file mode 100644 index 6336dbd26d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/1-2.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * pthread_detach() will indicate that the thread resources - * can be reclaimed as soon as the thread terminates. - * This means that pthread_join() will fail on such a thread. - - * The steps are: - * - * -> create a thread with a joinable state - * -> detach the thread, either from inside the thread or from outside - * -> try and join the thread, and check an error is returned. - - * The test fails if pthread_join succeeds. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -void * threaded (void * arg) -{ - int ret=0; - - if (arg != NULL) - { - ret = pthread_detach(pthread_self()); - if (ret != 0) { UNRESOLVED(ret, "Failed to detach the thread"); } - } - - /* Post the semaphore to unlock the main thread in case of a detached thread */ - do { ret = sem_post(&(scenarii[sc].sem)); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - return arg; -} - -int main (int argc, char *argv[]) -{ - int ret=0; - pthread_t child; - - output_init(); - - scenar_init(); - - for (sc=0; sc < NSCENAR; sc++) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - if (scenarii[sc].detached != 0) /* only joinable threads can be detached */ - { - ret = pthread_attr_setdetachstate(&scenarii[sc].ta, PTHREAD_CREATE_JOINABLE); - if (ret != 0) { UNRESOLVED(ret, "Unable to set detachstate back to joinable"); } - } - - /* for detached scenarii, we will call pthread_detach from inside the thread. - for joinable scenarii, we'll call pthread_detach from this thread. */ - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, (scenarii[sc].detached != 0)?&ret:NULL); - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - #if VERBOSE > 0 - break; - - case 2: /* We did not know the expected result */ - default: - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&(scenarii[sc].sem)); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - /* If we must detach from here, we do it now. */ - if (scenarii[sc].detached == 0) - { - ret = pthread_detach(child); - if (ret != 0) { UNRESOLVED(ret, "Failed to detach the child thread."); } - } - - /* now check that the thread resources are freed. */ - ret = pthread_join(child, NULL); - if (ret == 0) { FAILED("We were able to join a detached thread."); } - - /* Let the thread an additionnal row to cleanup */ - sched_yield(); - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/2-1.c deleted file mode 100644 index 17c5c4c55e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/2-1.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_detach() - * - * If 'thread' has not terminated, pthread_detach() shall not cause it to - * terminate. The effect of multiple pthread_detach() calls on the same - * - * STEPS: - * 1.Create a joinable thread - * 2.Detach that thread - * 3.Verify that the thread did not terminate because of this - * - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - - -void *a_thread_func() -{ - - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - /* If the thread wasn't canceled in 10 seconds, time out */ - sleep(10); - - printf("Thread couldn't be canceled (at cleanup time), timing out\n"); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_attr_t new_attr; - pthread_t new_th; - int ret; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - printf("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute object to be joinable */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_JOINABLE) != 0) - { - printf("Error in pthread_attr_setdetachstate()\n"); - return PTS_UNRESOLVED; - } - - /* Create the thread */ - if(pthread_create(&new_th, &new_attr, a_thread_func, NULL) != 0) - { - printf("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Detach the thread. */ - if(pthread_detach(new_th) != 0) - { - printf("Error detaching thread\n"); - return PTS_FAIL; - } - - /* Verify that it hasn't terminated the thread */ - ret=pthread_cancel(new_th); - - if(ret != 0) - { - if(ret==ESRCH) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - printf("Error canceling thread: %s\n", strerror(ret)); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/2-2.c deleted file mode 100644 index 13402ecd7a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/2-2.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * pthread_detach() does not force a thread to terminate. - - * The steps are: - * - * -> Create a thread - * -> detach the thread - * -> wait for the thread to post a semaphore. - - * The test fails if the semaphore is not posted within a certain duration. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define TIMEOUT 5 - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -sem_t sem_sync; - -void * threaded (void * arg) -{ - int ret=0; - - if (arg != NULL) - { - ret = pthread_detach(pthread_self()); - if (ret != 0) { UNRESOLVED(ret, "Failed to detach the thread"); } - } - /* Wait for this semaphore which indicates that pthread_detach has been called */ - do { ret = sem_wait(&sem_sync); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - /* Post the semaphore to indicate the main thread we're alive */ - do { ret = sem_post(&(scenarii[sc].sem)); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - return arg; -} - -int main (int argc, char *argv[]) -{ - int ret=0; - pthread_t child; - struct timespec ts; - - output_init(); - - scenar_init(); - - ret = sem_init(&sem_sync, 0, 0); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a semaphore"); } - - for (sc=0; sc < NSCENAR; sc++) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - if (scenarii[sc].detached != 0) /* only joinable threads can be detached */ - { - ret = pthread_attr_setdetachstate(&scenarii[sc].ta, PTHREAD_CREATE_JOINABLE); - if (ret != 0) { UNRESOLVED(ret, "Unable to set detachstate back to joinable"); } - } - - /* for detached scenarii, we will call pthread_detach from inside the thread. - for joinable scenarii, we'll call pthread_detach from this thread. */ - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, (scenarii[sc].detached != 0)?&ret:NULL); - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - #if VERBOSE > 0 - break; - - case 2: /* We did not know the expected result */ - default: - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - /* If we must detach from here, we do it now. */ - if (scenarii[sc].detached == 0) - { - ret = pthread_detach(child); - if (ret != 0) { UNRESOLVED(ret, "Failed to detach the child thread."); } - } - - /* Now, allow the thread to terminate */ - do { ret = sem_post(&sem_sync); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - /* Just wait for the thread to terminate */ - ret = clock_gettime(CLOCK_REALTIME, &ts); - if (ret != 0) { UNRESOLVED(ret, "Failed to get time"); } - - ts.tv_sec += TIMEOUT; - - do { ret = sem_timedwait(&(scenarii[sc].sem), &ts); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) - { - if (errno == ETIMEDOUT) { FAILED("pthread_detach made the thread terminate"); } - /* else */ - UNRESOLVED(errno, "Failed to wait for the semaphore"); - } - - /* Let the thread an additionnal row to cleanup */ - sched_yield(); - } - } - - ret = sem_destroy(&sem_sync); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the semaphore"); } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/3-1.c deleted file mode 100644 index 1b44bf932a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/3-1.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_detach() - * - * Upon succesful completion, it shall return a 0; - * - * STEPS: - * 1.Create a joinable thread - * 2.Detach that thread - * 3.Check the return value - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -/* Thread function */ -void *a_thread_func() -{ - - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - /* If the thread wasn't canceled in 10 seconds, time out */ - sleep(10); - - perror("Thread couldn't be canceled (at cleanup time), timing out\n"); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_attr_t new_attr; - pthread_t new_th; - int ret; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute object to be joinable */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_JOINABLE) != 0) - { - perror("Error in pthread_attr_setdetachstate()\n"); - return PTS_UNRESOLVED; - } - - /* Create the thread */ - if(pthread_create(&new_th, &new_attr, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Detach the thread. */ - ret=pthread_detach(new_th); - - /* Cleanup and cancel the thread */ - pthread_cancel(new_th); - - /* Check return value of pthread_detach() */ - if(ret != 0) - { - if((ret != ESRCH) || (ret != EINVAL)) - { - printf("Test FAILED: Incorrect return code\n"); - return PTS_FAIL; - } - - perror("Error detaching thread\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/4-1.c deleted file mode 100644 index 17fc2f855f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/4-1.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_detach() - * - * Upon failure, it shall return an error number: - * -[EINVAL] The implemenation has detected that the value specified by - * 'thread' does not refer to a joinable thread. - * -[ESRCH] No thread could be found corresponding to that thread - - * It shall not return an error code of [EINTR] - * - * STEPS: - * 1.Create a detached state thread - * 2.Detach that thread - * 3.Check the return value and make sure it is EINVAL - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -/* Thread function */ -void *a_thread_func() -{ - - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - /* If the thread wasn't canceled in 10 seconds, time out */ - sleep(10); - - perror("Thread couldn't be canceled (at cleanup time), timing out\n"); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_attr_t new_attr; - pthread_t new_th; - int ret; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute object to be detached */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_DETACHED) != 0) - { - perror("Error in pthread_attr_setdetachstate()\n"); - return PTS_UNRESOLVED; - } - - /* Create the thread */ - if(pthread_create(&new_th, &new_attr, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Detach the thread. */ - ret=pthread_detach(new_th); - - /* Cleanup and cancel the thread */ - pthread_cancel(new_th); - - /* Check return value of pthread_detach() */ - if(ret != EINVAL) - { - if(ret == ESRCH) - { - perror("Error detaching thread\n"); - return PTS_UNRESOLVED; - } - - printf("Test FAILED: Incorrect return code\n"); - return PTS_FAIL; - - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/4-2.c deleted file mode 100644 index f196e9e6f0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/4-2.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_detach() - * - * Upon failure, it shall return an error number: - * -[EINVAL] The implemenation has detected that the value specified by - * 'thread' does not refer to a joinable thread. - * -[ESRCH] No thread could be found corresponding to that thread - - * It shall not return an error code of [EINTR] - * - * STEPS: - * 1. Create a thread. - * 2.Wait 'till the thread exits. - * 3.Try and detach this thread. - * 4.Check the return value and make sure it is ESRCH - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -/* Thread function */ -void *a_thread_func() -{ - pthread_exit(0); - return NULL; -} - - -int main() -{ - pthread_t new_th; - int ret; - - /* Create the thread */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait 'till the thread returns. - * The thread could have ended by the time we try to join, so - * don't worry about it, just so long as other errors don't - * occur. The point is to make sure the thread has ended execution. */ - if(pthread_join(new_th, NULL) == EDEADLK) - { - perror("Error joining thread\n"); - return PTS_UNRESOLVED; - } - - /* Detach the non-existant thread. */ - ret=pthread_detach(new_th); - - /* Check return value of pthread_detach() */ - if(ret != ESRCH) - { - printf("Test FAILED: Incorrect return code: %d instead of ESRCH\n", ret); - return PTS_FAIL; - - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/4-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/4-3.c deleted file mode 100644 index 157c5781fd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/4-3.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The function does not return EINTR - - * The steps are: - * -> kill a thread which calls pthread_detach() - * -> check that EINTR is never returned - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -char do_it=1; -unsigned long count_ope=0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - pid_t process; - - process=getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - ret = kill(process, thearg->sig); - if (ret != 0) { UNRESOLVED(errno, "Kill in sendsig"); } - - } - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -/* This one is registered for signal SIGUSR2 */ -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* Thread function -- almost does nothing */ -void * threaded(void * arg) -{ - int ret; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_UNBLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread"); } - - ret = pthread_detach(pthread_self()); - if (ret == EINTR) { FAILED("pthread_detach() returned EINTR"); } - - /* Signal we're done */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - /* return */ - return arg; -} - -/* Test function -- creates the thread. */ -void * test(void * arg) -{ - int ret=0; - pthread_t child; - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - sc = 0; - - while (do_it) - { - #if VERBOSE > 5 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - count_ope++; - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, NULL); - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 5 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - ; - } - if (ret == 0) /* The new thread is running */ - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - - /* Change thread attribute for the next loop */ - sc++; - sc %= NSCENAR; - } - return NULL; -} - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* Initialize thread attribute objects */ - scenar_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset(&usersigs); - ret = sigaddset(&usersigs, SIGUSR1); - ret |= sigaddset(&usersigs, SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Unable to add SIGUSR1 or 2 to a signal set"); } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread"); } - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - if ((ret = pthread_create(&th_work, NULL, test, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - - - /* Let's wait for a while now */ - sleep(1); - - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - - - if ((ret = pthread_join(th_work, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - - scenar_fini(); - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" %d thread detached.\n", count_ope); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/assertions.xml deleted file mode 100644 index 8b001ed22e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/assertions.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - The function - - int pthread_detach(pthread_t thread); - - detaches a thread. It shall indicate to the implementation that storage - for 'thread' can be reclaimed when that thread terminates. - - - If 'thread' has not terminated, pthread_detach() won't cause it to - terminate. The effect of multiple pthread_detach() calls on the same - target thread is unspecified. - - - If success, it returns 0; - - - Upon failure, it returns an error number: - -[EINVAL] 'thread' does not refer to a joinable thread. - -[ESRCH] No thread could be found corresponding to that thread ID - - It shall not return [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/coverage.txt deleted file mode 100644 index f1f14cc314..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -This document defines the coverage for the pthread_detach function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/threads_scenarii.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/threads_scenarii.c deleted file mode 100644 index 81e0dabf80..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_detach/threads_scenarii.c +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This file is a helper file for the pthread_create tests - * It defines the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - * - */ - - -struct __scenario -{ - /* Object to hold the given configuration, and which will be used to create the threads */ - pthread_attr_t ta; - /* General parameters */ - int detached; /* 0 => joinable; 1 => detached */ - /* Scheduling parameters */ - int explicitsched; /* 0 => sched policy is inherited; 1 => sched policy from the attr param */ - int schedpolicy; /* 0 => default; 1=> SCHED_FIFO; 2=> SCHED_RR */ - int schedparam; /* 0 => default sched param; 1 => max value for sched param; -1 => min value for sched param */ - int altscope; /* 0 => default contension scope; 1 => alternative contension scope */ - /* Stack parameters */ - int altstack; /* 0 => system manages the stack; 1 => stack is provided */ - int guard; /* 0 => default guardsize; 1=> guardsize is 0; 2=> guard is 1 page -- this setting only affect system stacks (not user's). */ - int altsize; /* 0 => default stack size; 1 => stack size specified (min value) -- ignored when stack is provided */ - /* Additionnal information */ - char * descr; /* object description */ - void * bottom; /* Stores the stack start when an alternate stack is required */ - int result; /* This thread creation is expected to: 0 => succeed; 1 => fail; 2 => unknown */ - sem_t sem; /* This semaphore is used to signal the end of the detached threads execution */ -} scenarii[]= - -#define CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,res) \ - { \ - .detached=det, \ - .explicitsched=expl, \ - .schedpolicy=scp, \ - .schedparam=spa, \ - .altscope=sco, \ - .altstack=sta, \ - .guard=gua, \ - .altsize=ssi, \ - .descr=desc, \ - .bottom=NULL, \ - .result=res } - -#define CASE_POS(det,expl,scp,spa,sco,sta,gua,ssi,desc) CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,0) -#define CASE_NEG(det,expl,scp,spa,sco,sta,gua,ssi,desc) CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,1) -#define CASE_UNK(det,expl,scp,spa,sco,sta,gua,ssi,desc) CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,2) - - /* - * This array gives the different combinations of threads attributes for the testcases. - * - * Some combinations must be avoided. - * -> Do not have a detached thread use an alternative stack; - * as we don't know when the thread terminates to free the stack memory - * -> ... (to be completed) - * - */ - -{ - /* Unary tests */ -/* 0*/ CASE_POS( 0, 0, 0, 0, 0, 0, 0, 0, "default") -/* 1*/ ,CASE_POS( 1, 0, 0, 0, 0, 0, 0, 0, "detached") -/* 2*/ ,CASE_POS( 0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched") -/* 3*/ ,CASE_UNK( 0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy") -/* 4*/ ,CASE_UNK( 0, 0, 2, 0, 0, 0, 0, 0, "RR Policy") -/* 5*/ ,CASE_UNK( 0, 0, 0, 1, 0, 0, 0, 0, "Max sched param") -/* 6*/ ,CASE_UNK( 0, 0, 0,-1, 0, 0, 0, 0, "Min sched param") -/* 7*/ ,CASE_POS( 0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope") -/* 8*/ ,CASE_POS( 0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack") -/* 9*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 0, "No guard size") -/*10*/ ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 0, "1p guard size") -/*11*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 1, "Min stack size") - - /* Stack play */ - ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard") - ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard") - ,CASE_POS( 1, 0, 0, 0, 0, 1, 0, 0, "Detached, Alternative stack") - ,CASE_POS( 1, 0, 0, 0, 0, 0, 1, 1, "Detached, Min stack size, no guard") - ,CASE_UNK( 1, 0, 0, 0, 0, 0, 2, 1, "Detached, Min stack size, 1p guard") - - /* Scheduling play -- all results are unknown since it might depend on the user priviledges */ - ,CASE_UNK( 0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param") - ,CASE_UNK( 0, 1, 2, 1, 0, 0, 0, 0, "Explicit RR max param") - ,CASE_UNK( 0, 1, 1,-1, 0, 0, 0, 0, "Explicit FIFO min param") - ,CASE_UNK( 0, 1, 2,-1, 0, 0, 0, 0, "Explicit RR min param") - ,CASE_UNK( 0, 1, 1, 1, 1, 0, 0, 0, "Explicit FIFO max param, alt scope") - ,CASE_UNK( 0, 1, 2, 1, 1, 0, 0, 0, "Explicit RR max param, alt scope") - ,CASE_UNK( 0, 1, 1,-1, 1, 0, 0, 0, "Explicit FIFO min param, alt scope") - ,CASE_UNK( 0, 1, 2,-1, 1, 0, 0, 0, "Explicit RR min param, alt scope") - ,CASE_UNK( 1, 1, 1, 1, 0, 0, 0, 0, "Detached, explicit FIFO max param") - ,CASE_UNK( 1, 1, 2, 1, 0, 0, 0, 0, "Detached, explicit RR max param") - ,CASE_UNK( 1, 1, 1,-1, 0, 0, 0, 0, "Detached, explicit FIFO min param") - ,CASE_UNK( 1, 1, 2,-1, 0, 0, 0, 0, "Detached, explicit RR min param") - ,CASE_UNK( 1, 1, 1, 1, 1, 0, 0, 0, "Detached, explicit FIFO max param, alt scope") - ,CASE_UNK( 1, 1, 2, 1, 1, 0, 0, 0, "Detached, explicit RR max param, alt scope") - ,CASE_UNK( 1, 1, 1,-1, 1, 0, 0, 0, "Detached, explicit FIFO min param, alt scope") - ,CASE_UNK( 1, 1, 2,-1, 1, 0, 0, 0, "Detached, explicit RR min param, alt scope") - -}; - -#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0])) - -/* This function will initialize every pthread_attr_t object in the scenarii array */ -void scenar_init() -{ - int ret=0; - int i; - int old; - long pagesize, minstacksize; - long tsa, tss, tps; - - pagesize =sysconf(_SC_PAGESIZE); - minstacksize =sysconf(_SC_THREAD_STACK_MIN); - tsa =sysconf(_SC_THREAD_ATTR_STACKADDR); - tss =sysconf(_SC_THREAD_ATTR_STACKSIZE); - tps =sysconf(_SC_THREAD_PRIORITY_SCHEDULING); - - #if VERBOSE > 0 - output("System abilities:\n"); - output(" TSA: %li\n", tsa); - output(" TSS: %li\n", tss); - output(" TPS: %li\n", tps); - output(" pagesize: %li\n", pagesize); - output(" min stack size: %li\n", minstacksize); - #endif - - - if (minstacksize % pagesize) - { - UNTESTED("The min stack size is not a multiple of the page size"); - } - - for (i=0; i 2 - output("Initializing attribute for scenario %i: %s\n", i, scenarii[i].descr); - #endif - - ret = pthread_attr_init(&scenarii[i].ta); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a thread attribute object"); } - - /* Set the attributes according to the scenario */ - if (scenarii[i].detached == 1) - { - ret = pthread_attr_setdetachstate(&scenarii[i].ta, PTHREAD_CREATE_DETACHED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set detachstate"); } - } - else - { - ret = pthread_attr_getdetachstate(&scenarii[i].ta, &old); - if (ret != 0) { UNRESOLVED(ret, "Unable to get detachstate from initialized attribute"); } - if (old != PTHREAD_CREATE_JOINABLE) { FAILED("The default attribute is not PTHREAD_CREATE_JOINABLE"); } - } - #if VERBOSE > 4 - output("Detach state was set sucessfully\n"); - #endif - - /* Sched related attributes */ - if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */ - { - if (scenarii[i].explicitsched == 1) - ret = pthread_attr_setinheritsched(&scenarii[i].ta, PTHREAD_EXPLICIT_SCHED); - else - ret = pthread_attr_setinheritsched(&scenarii[i].ta, PTHREAD_INHERIT_SCHED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set inheritsched attribute"); } - #if VERBOSE > 4 - output("inheritsched state was set sucessfully\n"); - #endif - } - #if VERBOSE > 4 - else - output("TPS unsupported => inheritsched parameter untouched\n"); - #endif - - if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */ - { - if (scenarii[i].schedpolicy == 1) - { - ret = pthread_attr_setschedpolicy(&scenarii[i].ta, SCHED_FIFO); - } - if (scenarii[i].schedpolicy == 2) - { - ret = pthread_attr_setschedpolicy(&scenarii[i].ta, SCHED_RR); - } - if (ret != 0) { UNRESOLVED(ret, "Unable to set the sched policy"); } - #if VERBOSE > 4 - if (scenarii[i].schedpolicy) - output("Sched policy was set sucessfully\n"); - else - output("Sched policy untouched\n"); - #endif - } - #if VERBOSE > 4 - else - output("TPS unsupported => sched policy parameter untouched\n"); - #endif - - if (scenarii[i].schedparam != 0) - { - struct sched_param sp; - - ret = pthread_attr_getschedpolicy(&scenarii[i].ta, &old); - if (ret != 0) { UNRESOLVED(ret, "Unable to get sched policy from attribute"); } - - if (scenarii[i].schedparam == 1) - sp.sched_priority = sched_get_priority_max(old); - if (scenarii[i].schedparam == -1) - sp.sched_priority = sched_get_priority_min(old); - - ret = pthread_attr_setschedparam(&scenarii[i].ta, &sp); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the sched param"); } - - #if VERBOSE > 4 - output("Sched param was set sucessfully to %i\n", sp.sched_priority); - } - else - { - output("Sched param untouched\n"); - #endif - } - - if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */ - { - ret = pthread_attr_getscope(&scenarii[i].ta, &old); - if (ret != 0) { UNRESOLVED(ret, "Failed to get contension scope from thread attribute"); } - - if (scenarii[i].altscope != 0) - { - if (old == PTHREAD_SCOPE_PROCESS) - old = PTHREAD_SCOPE_SYSTEM; - else - old = PTHREAD_SCOPE_PROCESS; - - ret = pthread_attr_setscope(&scenarii[i].ta, old); - //if (ret != 0) { UNRESOLVED(ret, "Failed to set contension scope"); } - #if VERBOSE > 0 - if (ret != 0) { output("WARNING: The TPS option is claimed to be supported but setscope fails\n"); } - #endif - - #if VERBOSE > 4 - output("Contension scope set to %s\n", old==PTHREAD_SCOPE_PROCESS?"PTHREAD_SCOPE_PROCESS":"PTHREAD_SCOPE_SYSTEM"); - } - else - { - output("Contension scope untouched (%s)\n", old==PTHREAD_SCOPE_PROCESS?"PTHREAD_SCOPE_PROCESS":"PTHREAD_SCOPE_SYSTEM"); - #endif - } - } - #if VERBOSE > 4 - else - output("TPS unsupported => sched contension scope parameter untouched\n"); - #endif - - /* Stack related attributes */ - if ((tss>0) && (tsa>0)) /* This routine is dependent on the Thread Stack Address Attribute - and Thread Stack Size Attribute options */ - { - if (scenarii[i].altstack != 0) - { - /* This is slightly more complicated. We need to alloc a new stack - and free it upon test termination */ - /* We will alloc with a simulated guardsize of 1 pagesize */ - scenarii[i].bottom = malloc(minstacksize + pagesize); - if (scenarii[i].bottom == NULL) { UNRESOLVED(errno,"Unable to alloc enough memory for alternative stack"); } - - ret = pthread_attr_setstack(&scenarii[i].ta, scenarii[i].bottom, minstacksize); - if (ret != 0) { UNRESOLVED(ret, "Failed to specify alternate stack"); } - - #if VERBOSE > 1 - output("Alternate stack created successfully. Bottom=%p, Size=%i\n", scenarii[i].bottom, minstacksize); - #endif - } - } - #if VERBOSE > 4 - else - output("TSA or TSS unsupported => No alternative stack\n"); - #endif - - #ifndef WITHOUT_XOPEN - if (scenarii[i].guard != 0) - { - if (scenarii[i].guard == 1) - ret = pthread_attr_setguardsize(&scenarii[i].ta, 0); - if (scenarii[i].guard == 2) - ret = pthread_attr_setguardsize(&scenarii[i].ta, pagesize); - if (ret != 0) { UNRESOLVED(ret, "Unable to set guard area size in thread stack"); } - #if VERBOSE > 4 - output("Guard size set to %i\n", (scenarii[i].guard==1)?1:pagesize); - #endif - } - #endif - - if (tss>0) /* This routine is dependent on the Thread Stack Size Attribute option */ - { - if (scenarii[i].altsize != 0) - { - ret = pthread_attr_setstacksize(&scenarii[i].ta, minstacksize); - if (ret != 0) { UNRESOLVED(ret, "Unable to change stack size"); } - #if VERBOSE > 4 - output("Stack size set to %i (this is the min)\n", minstacksize); - #endif - } - } - #if VERBOSE > 4 - else - output("TSS unsupported => stack size unchanged\n"); - #endif - - ret = sem_init(&scenarii[i].sem, 0,0); - if (ret == -1) { UNRESOLVED(errno, "Unable to init a semaphore"); } - - } - #if VERBOSE > 0 - output("All %i thread attribute objects were initialized\n\n", NSCENAR); - #endif -} - -/* This function will free all resources consumed in the scenar_init() routine */ -void scenar_fini(void) -{ - int ret = 0, i; - - for (i=0; i 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, NULL); - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - if (scenarii[sc].detached == 0) - { - ret = pthread_join(child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - else - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/1-1.c deleted file mode 100644 index 6578f4063a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/1-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_equal() - * shall compare the thread ids t1 and t2. The function shall return a non-zero - * value if t1 and t2 are equal, othersise zero shall be returned. - * No errors are defined. - * - * Steps: - * 1. Create a thread - * 2. Call pthread_equal and pass to it the new thread in both parameters. - * They should both be equal. - * - */ - -#include -#include -#include "posixtest.h" - - -void *a_thread_func() -{ - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Call pthread_equal() and pass to it the new thread ID in both - * parameters. It should return a non-zero value, indicating that - * they are equal. */ - if(pthread_equal(new_th, new_th) == 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/1-2.c deleted file mode 100644 index d93df98c65..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/1-2.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_equal() - * shall compare the thread ids t1 and t2. The function shall return a non-zero - * value if t1 and t2 are equal, othersise zero shall be returned. - * No errors are defined. - * - * Steps: - * 1. Create 2 threads - * 2. Call pthread_equal and pass to it the two threads. - * They should not be equal. - * - */ - -#include -#include -#include "posixtest.h" - - -void *a_thread_func() -{ - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th1, new_th2; - - /* Create a new thread. */ - if(pthread_create(&new_th1, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Create another new thread. */ - if(pthread_create(&new_th2, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Call pthread_equal() and pass to it the 2 new threads. - * It should return a zero value, indicating that - * they are not equal. */ - if(pthread_equal(new_th1, new_th2) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/2-1.c deleted file mode 100644 index d5c37a9e47..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/2-1.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The function does not return EINTR - - * The steps are: - * -> kill a thread which calls pthread_equal - * -> check that EINTR is never returned - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -char do_it=1; -unsigned long count_ope=0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - pid_t process; - - process=getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - ret = kill(process, thearg->sig); - if (ret != 0) { UNRESOLVED(errno, "Kill in sendsig"); } - - } - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -/* This one is registered for signal SIGUSR2 */ -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* Test function -- calls pthread_equal() and checks that EINTR is never returned. */ -void * test(void * arg) -{ - int ret=0; - - pthread_t me = pthread_self(); - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_UNBLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread"); } - - - while (do_it) - { - count_ope++; - - ret = pthread_equal(me, *(pthread_t *)arg); - if (ret != 0) { UNRESOLVED(ret, "pthread_equal failed to return the correct value"); } - - ret = pthread_equal(me, me); - if (ret == 0) { UNRESOLVED(ret, "pthread_equal returned a bad result"); } - if (ret == EINTR) { FAILED("pthread_equal returned EINTR status"); } - } - return NULL; -} - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2, me; - thestruct arg1, arg2; - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset(&usersigs); - ret = sigaddset(&usersigs, SIGUSR1); - ret |= sigaddset(&usersigs, SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Unable to add SIGUSR1 or 2 to a signal set"); } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread"); } - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - me = pthread_self(); - - if ((ret = pthread_create(&th_work, NULL, test, (void *)&me))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - - - /* Let's wait for a while now */ - sleep(1); - - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - - - if ((ret = pthread_join(th_work, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" %d thread comparison.\n", count_ope); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/assertions.xml deleted file mode 100644 index 3c9853327c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/assertions.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - The function - - int pthread_equal(pthread_t t1, pthread_t t2) - - compares the thread ids t1 and t2. It returns a non-zero - value if t1 and t2 are equal, othersise it returns zero. - No errors are defined. - - - The function must not return EINTR - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/coverage.txt deleted file mode 100644 index 9624192788..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/coverage.txt +++ /dev/null @@ -1,6 +0,0 @@ -This document defines the coverage for the pthread_equal() function: - -Assertion Tested? -1 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_equal/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/1-1.c deleted file mode 100644 index b07f1eb5c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/1-1.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_exit() - * - * terminates the calling thread and makes the value 'value_ptr' available - * to any successful join with the terminating thread. - * - * Steps: - * 1. Create a new thread. Have it return a return code on pthread_exit(); - * 2. Call pthread_join() in main(), and pass to it 'value_ptr'. - * 3. Check to see of the value_ptr and the value returned by pthread_exit() are the same; - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define RETURN_CODE 100 /* Set a random return code number. This shall be the return code of the - thread when using pthread_exit().*/ - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem; /* Manual semaphore used to indicate when the thread has been created. */ - -/* Thread's function. */ -void *a_thread_func() -{ - sem=INMAIN; - pthread_exit((void*)RETURN_CODE); - return NULL; -} - -int main() -{ - pthread_t new_th; - int *value_ptr; - - /* Initializing variables. */ - value_ptr=0; - sem=INTHREAD; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure the thread was created before we join it. */ - while(sem==INTHREAD) - sleep(1); - - /* Wait for thread to return */ - if(pthread_join(new_th, (void*)&value_ptr) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check to make sure that 'value_ptr' that was passed to pthread_join() and the - * pthread_exit() return code that was used in the thread funciton are the same. */ - if((long)value_ptr != RETURN_CODE) - { - printf("Test FAILED: pthread_exit() could not pass the return value of the thread in 'value_ptr' to pthread_join().\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/1-2.c deleted file mode 100644 index 928a728079..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/1-2.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * pthread_exit() terminates the current thread and - * allows a call to pthread_join() on this thread retrieve - * the argument (if the thread is not detached). - - * The steps are: - * - * -> Create threads with different attributes (but all must be joinable) - * -> inside the thread, a call to pthread_exit() is made with a certain value. - * -> In the main thread, we join the thread and check the value is as expected. - - * The test fails if the values are different. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - - -void * threaded (void * arg) -{ - pthread_exit(NULL + 1); - - FAILED("pthread_exit() did not terminate the thread"); - - return NULL; -} - - -int main (int argc, char *argv[]) -{ - int ret=0; - void * rval; - pthread_t child; - int i; - - output_init(); - - scenar_init(); - - for (i=0; i < NSCENAR; i++) - { - if (scenarii[i].detached == 0) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", i, scenarii[i].descr); - #endif - - ret = pthread_create(&child, &scenarii[i].ta, threaded, NULL); - switch (scenarii[i].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - ret = pthread_join(child, &rval); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - - if (rval != (NULL+1)) - { - FAILED("pthread_join() did not retrieve the pthread_exit() param"); - } - } - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/2-1.c deleted file mode 100644 index 0c8e98a6d1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/2-1.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_exit() - * - * Any cancelation cleanup handlers that have been pushed and not yet popped - * shall be popped and executed in the reverse order that they were pushed. - * - * Steps: - * 1. Create a new thread. - * 2. The thread will call pthread_exit(). - * 3. When this happens, the cleanup handler should be called. - * 4. Main will test that when pthread_join allows main to continue with the process that - * the thread has ended execution. If the cleanup_handler was not called, then the - * test fails. - * - */ - -#include -#include -#include -#include "posixtest.h" - -int i[3], j; - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is 1, it means that the thread was canceled. */ -void a_cleanup_func1() -{ - i[j]=1; - j++; - return; -} - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is 1, it means that the thread was canceled. */ -void a_cleanup_func2() -{ - i[j]=2; - j++; - return; -} - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is 1, it means that the thread was canceled. */ -void a_cleanup_func3() -{ - i[j]=3; - j++; - return; -} -/* Thread's function. */ -void *a_thread_func() -{ - /* Set up 3 cleanup handlers */ - pthread_cleanup_push(a_cleanup_func1,NULL); - pthread_cleanup_push(a_cleanup_func2,NULL); - pthread_cleanup_push(a_cleanup_func3,NULL); - - /* Terminate the thread here. */ - pthread_exit(0); - - /* Need these here for it to compile nicely. We never reach here though. */ - pthread_cleanup_pop(0); - pthread_cleanup_pop(0); - pthread_cleanup_pop(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initialize integer array. */ - for(j=0;j<3;j++) - i[j] = 0; - - /* Initialize counter. */ - j=0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to return */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check to make sure that the cleanup handlers were executed in order. */ - if(i[0] == 3) - { - if(i[1] == 2) - { - if(i[2] == 1) - { - printf("Test PASSED\n"); - return PTS_PASS; - - } - printf("Test FAILED: Did not execute cleanup handlers in order.\n"); - return PTS_FAIL; - } - printf("Test FAILED: Did not execute cleanup handlers in order.\n"); - return PTS_FAIL; - } - else if(i[0] == 0) - { - printf("Test FAILED: Did not execute cleanup handlers.\n"); - return PTS_FAIL; - } - - printf("Test FAILED: Did not execute cleanup handlers in order.\n"); - return PTS_FAIL; - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/2-2.c deleted file mode 100644 index bb985b6bb1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/2-2.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * Pending cancelation cleanup handlers are executed in FILO order. - - * The steps are: - * - * -> Create threads with different attributes (but all must be joinable) - * -> inside the thread, - * -> register three cancelation handlers - * -> call pthread_exit. - * -> In the main thread, we join the thread and check the cleanups were executed in order. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -int global=0; -int tab[3]; - -#define CLEANUP(n) void clnp##n(void * arg)\ -{\ - tab[global]=n; \ - global++; \ -} - -CLEANUP(1) -CLEANUP(2) -CLEANUP(3) - - -void * threaded (void * arg) -{ - pthread_cleanup_push(clnp3, NULL); - pthread_cleanup_push(clnp2, NULL); - pthread_cleanup_push(clnp1, NULL); - - pthread_exit(NULL + 1); - - pthread_cleanup_pop(0); - pthread_cleanup_pop(0); - pthread_cleanup_pop(0); - - FAILED("pthread_exit() did not terminate the thread"); - return NULL; -} - - -int main (int argc, char *argv[]) -{ - int ret=0; - void * rval; - pthread_t child; - int i,j; - - output_init(); - - scenar_init(); - - for (i=0; i < NSCENAR; i++) - { - if (scenarii[i].detached == 0) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", i, scenarii[i].descr); - #endif - - for (j=0; j<3; j++) - tab[j]=0; - global=0; - - ret = pthread_create(&child, &scenarii[i].ta, threaded, NULL); - switch (scenarii[i].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - ret = pthread_join(child, &rval); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - - if (rval != (NULL+1)) - { - FAILED("pthread_join() did not retrieve the pthread_exit() param"); - } - - for (j=0; j<3; j++) - if (tab[j] != j+1) - { - output("dump:\ntab[0]=%i\ntab[1]=%i\ntab[2]=%i\n", tab[0], tab[1], tab[2]); - FAILED("The cleanup handlers were not called as expected"); - } - } - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/3-1.c deleted file mode 100644 index 0421db8915..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/3-1.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_exit() - * - * Any destructors for thread_specific data will be called when - * pthread_exit is called - * - * Steps: - * 1. Create a new thread. - * 2. Create thread specific data, with a destructor in the thread - * 3. Call pthread_exit in the thread. - * 4. Make sure that the destructor was called - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-1" -#define FUNCTION "pthread_exit" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -/* Flag to indicate that the destructor was called */ -int cleanup_flag = 0; - -void destructor(void *tmp) -{ - cleanup_flag = 1; -} - -/* Thread's function. */ -void *a_thread_func(void *tmp) -{ - pthread_key_t key; - int value = 1; - int rc = 0; - - rc = pthread_key_create(&key, destructor); - if(rc != 0 ) { - printf(ERROR_PREFIX "pthread_key_create\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_setspecific(key, &value); - if(rc != 0 ) { - printf(ERROR_PREFIX "pthread_setspecific\n"); - exit(PTS_UNRESOLVED); - } - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int rc = 0; - - /* Create a new thread. */ - rc = pthread_create(&new_th, NULL, a_thread_func, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_create\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to return */ - rc = pthread_join(new_th, NULL); - if(rc != 0) { - printf(ERROR_PREFIX "pthread_join\n"); - return PTS_UNRESOLVED; - } - - if(cleanup_flag != 1 ) { - printf("Test FAIL: Destructor was not called.\n"); - return PTS_FAIL; - } - - printf("Test PASS\n"); - return PTS_PASS; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/3-2.c deleted file mode 100644 index 6459d877a2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/3-2.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The TLD destructors (if any) are executed after the cancelation cleanup handlers, - * in unspecified order. - - * The steps are: - * - * -> Create threads with different attributes (but all must be joinable) - * -> inside the thread, - * -> register three cancelation handlers - * -> call pthread_exit. - * -> In the main thread, we join the thread and check the cleanups were executed in order. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -int global=0; -int tab[4]; -pthread_key_t tld[3]; - -#define CLEANUP(n) void clnp##n(void * arg)\ -{\ - tab[global]=n; \ - global++; \ -} - -/* Cancelation cleanup handlers */ -CLEANUP(1) -CLEANUP(2) -CLEANUP(3) - -/* TLD destructor */ -void destructor(void * arg) -{ - *(int *) arg += global; -} - -/* Thread routine */ -void * threaded (void * arg) -{ - int ret = 0; - - ret = pthread_setspecific(tld[0], (void *)&tab[3]); - if (ret != 0) { UNRESOLVED(ret, "Failed to set TLD data"); } - - pthread_cleanup_push(clnp3, NULL); - pthread_cleanup_push(clnp2, NULL); - ret = pthread_setspecific(tld[1], (void *)&tab[3]); - if (ret != 0) { UNRESOLVED(ret, "Failed to set TLD data"); } - - pthread_cleanup_push(clnp1, NULL); - ret = pthread_setspecific(tld[2], (void *)&tab[3]); - if (ret != 0) { UNRESOLVED(ret, "Failed to set TLD data"); } - - pthread_exit(NULL + 1); - - pthread_cleanup_pop(0); - pthread_cleanup_pop(0); - pthread_cleanup_pop(0); - - FAILED("pthread_exit() did not terminate the thread"); - return NULL; -} - - -int main (int argc, char *argv[]) -{ - int ret=0; - void * rval; - pthread_t child; - int i,j; - - output_init(); - - scenar_init(); - - for (j=0; j<3; j++) - { - ret = pthread_key_create(&tld[j], destructor); - if (ret != 0) { UNRESOLVED(ret, "Failed to create a TLD key"); } - } - - for (i=0; i < NSCENAR; i++) - { - if (scenarii[i].detached == 0) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", i, scenarii[i].descr); - #endif - - for (j=0; j<4; j++) - tab[j]=0; - global=0; - - ret = pthread_create(&child, &scenarii[i].ta, threaded, NULL); - switch (scenarii[i].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - ret = pthread_join(child, &rval); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - - if (rval != (NULL+1)) - { - FAILED("pthread_join() did not retrieve the pthread_exit() param"); - } - - for (j=0; j<3; j++) - { - if ((tab[j] != j+1) || (tab[3] != 9)) - { - output("dump:\ntab[0]=%i\ntab[1]=%i\ntab[2]=%i\ntab[3]=%i\n", tab[0], tab[1], tab[2], tab[3]); - FAILED("The cleanup handlers were not called as expected"); - } - } - } - } - } - - for (j=0; j<3; j++) - { - ret = pthread_key_delete(tld[j]); - if (ret != 0) { UNRESOLVED(ret, "Failed to delete a TLD key"); } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/4-1.c deleted file mode 100644 index 74e9b2a5d8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/4-1.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * No atexit() registered routine shall be called because of pthread_exit(). - - * The steps are: - * - * -> Create threads with different attributes (but all must be joinable) - * -> inside the thread, - * -> register a function with atexit() - * -> call pthread_exit. - * -> In the main thread, we join the thread and check the function did not execute. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -int global=0; - -/* atexit() routines */ -void at1(void) -{ - global+=1; -} -void at2(void) -{ - global+=2; -} - -/* Thread routine */ -void * threaded (void * arg) -{ - int ret = 0; - - /* Note that this funtion will be registered once again for each scenario. - POSIX requires the ability to register at least 32 functions so it should - not be an issue in our case, as long as we don't get more than 32 scenarii - (with joinable threads) */ - ret = atexit(at2); - if (ret != 0) { UNRESOLVED(ret, "Failed to register an atexit() routine"); } - - pthread_exit(NULL + 1); - - FAILED("pthread_exit() did not terminate the thread"); - return NULL; -} - - -int main (int argc, char *argv[]) -{ - int ret=0; - void * rval; - pthread_t child; - int i; - - output_init(); - - scenar_init(); - - for (i=0; i < NSCENAR; i++) - { - if (scenarii[i].detached == 0) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", i, scenarii[i].descr); - #endif - - ret = pthread_create(&child, &scenarii[i].ta, threaded, NULL); - switch (scenarii[i].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - ret = pthread_join(child, &rval); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - - if (rval != (NULL+1)) - { - FAILED("pthread_join() did not retrieve the pthread_exit() param"); - } - - if (global != 0) { FAILED("The function registered with atexit() executed"); } - - } - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/5-1.c deleted file mode 100644 index 57b68b3a44..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/5-1.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * When a thread other than the first thread of a process returns, - * an implicit call to pthread_exit() is made with the returned value - * as a parameter. - - * The steps are: - * - * Same test as 1-2, 3-2, 4-1, but with return in place of pthread_exit. - * The results shall be the same. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -int atctl=0; -pthread_key_t tld[3]; - - -/* atexit() routines */ -void at1(void) -{ - atctl+=1; -} -void at2(void) -{ - atctl+=2; -} - -/* TLD destructor */ -void destructor(void * arg) -{ - *(int *) arg += 1; -} - -/* Thread routine */ -void * threaded (void * arg) -{ - int ret = 0; - - ret = atexit(at2); - if (ret != 0) { UNRESOLVED(ret, "Failed to register an atexit() routine"); } - - ret = pthread_setspecific(tld[0], arg); - if (ret != 0) { UNRESOLVED(ret, "Failed to set TLD data"); } - - ret = pthread_setspecific(tld[1], arg); - if (ret != 0) { UNRESOLVED(ret, "Failed to set TLD data"); } - - ret = pthread_setspecific(tld[2], arg); - if (ret != 0) { UNRESOLVED(ret, "Failed to set TLD data"); } - - return NULL + 1; - - FAILED("return did not terminate the thread (oO)"); - return NULL; -} - -/* Main routine */ -int main (int argc, char *argv[]) -{ - int ret=0; - int ctl=0; - void * rval; - pthread_t child; - int i,j; - - output_init(); - - scenar_init(); - - for (j=0; j<3; j++) - { - ret = pthread_key_create(&tld[j], destructor); - if (ret != 0) { UNRESOLVED(ret, "Failed to create a TLD key"); } - } - - for (i=0; i < NSCENAR; i++) - { - if (scenarii[i].detached == 0) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", i, scenarii[i].descr); - #endif - - ctl=0; - - ret = pthread_create(&child, &scenarii[i].ta, threaded, &ctl); - switch (scenarii[i].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - ret = pthread_join(child, &rval); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - - if (rval != (NULL+1)) - { - FAILED("pthread_join() did not retrieve the pthread_exit() param"); - } - - if (atctl != 0) { FAILED("The function registered with atexit() executed"); } - - if (ctl != 3) { FAILED("The TLD destructors were not called"); } - } - } - } - - for (j=0; j<3; j++) - { - ret = pthread_key_delete(tld[j]); - if (ret != 0) { UNRESOLVED(ret, "Failed to delete a TLD key"); } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/6-1.c deleted file mode 100644 index ec52c1e969..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/6-1.c +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * If the calling thread is the last thread in the process, - * the effect are as if an implicit call to exit(0) had been made. - - * The steps are: - * - * -> main creates a thread. - * -> this thread forks(). The new process contains only 1 thread. - * -> the thread in the new process calls pthread_exit(non-0 value). - * -> main process joins the child process and checks the behavior - * is as if exit(0) had been called. - * The checked items are: - * -> the return value. - * -> the atexit() routines have been called. - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -/* This will be used to control that atexit() has been called */ -int * ctl; -long mf; - -void clnp(void) -{ - *ctl = 1; -} - -/* Thread routine */ -void * threaded (void * arg) -{ - int ret = 0; - - pid_t pid, chk; - int status; - - if (mf > 0) - *ctl = 0; - - pid = fork(); - if (pid == (pid_t)-1) - { - UNRESOLVED(errno, "Failed to fork()"); - } - if (pid == 0) - { - /* children */ - if (mf > 0) - { - ret = atexit(clnp); - if (ret != 0) { UNRESOLVED(ret, "Failed to register atexit function"); } - } - - /* exit the last (and only) thread */ - pthread_exit(&ret); - - FAILED("pthread_exit() did not terminate the process when there was only 1 thread"); - } - - /* Only the parent process goes this far */ - chk = waitpid(pid, &status, 0); - if (chk != pid) - { - output("Expected pid: %i. Got %i\n", (int)pid, (int)chk); - UNRESOLVED(errno, "Waitpid failed"); - } - - if (WIFSIGNALED(status)) - { - output("Child process killed with signal %d\n",WTERMSIG(status)); - UNRESOLVED( -1 , "Child process was killed"); - } - - if (WIFEXITED(status)) - { - ret = WEXITSTATUS(status); - } - else - { - UNRESOLVED( -1, "Child process was neither killed nor exited"); - } - - if (ret != 0) - { - output("Exit status was: %i\n", ret); - FAILED("The child process did not exit with 0 status."); - } - - if (mf > 0) - if (*ctl != 1) - FAILED("pthread_exit() in the last thread did not execute atexit() routines"); - - - /* Signal we're done (especially in case of a detached thread) */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - return NULL; -} - -/* Main routine */ -int main (int argc, char *argv[]) -{ - int ret=0; - pthread_t child; - - mf =sysconf(_SC_MAPPED_FILES); - - output_init(); - - scenar_init(); - - /* We want to share some memory with the child process */ - if (mf> 0) - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/pthread_exit_6-1-XXXXXX"; - size_t sz; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - sz= (size_t)sysconf(_SC_PAGESIZE); - - tmp = calloc(1, sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - ctl = (int *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory.\n"); - #endif - } - - for (sc=0; sc < NSCENAR; sc++) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, &ctl); - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - if (scenarii[sc].detached == 0) - { - ret = pthread_join(child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - else - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/6-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/6-2.c deleted file mode 100644 index 09de4da764..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/6-2.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The pthread_exit() routine never returns to its caller - - * The steps are: - * - * -> create some threads with different attributes - * -> in the thread call pthread_exit - * -> if the function returns, the test fails. - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - - /********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -/* main is defined in the next file */ -#define STD_MAIN -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -/* Thread routine */ -void * threaded (void * arg) -{ - int ret = 0; - - /* Signal we're done (especially in case of a detached thread) */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - pthread_exit(arg); - - FAILED("pthread_exit() returned"); - - /* Compiler complaisance */ - return NULL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/assertions.xml deleted file mode 100644 index 5375b25ea6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/assertions.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - The function - - void pthread_exit(void *value_ptr); - - terminates the calling thread and makes the value 'value_ptr' available - to any successful join with the terminating thread. - - - Any cancelation cleanup handlers that have been pushed and not yet popped - shall be popped and executed in the reverse order that they were pushed. - - - After all cancelation cleanup handlers have been executed, if the thread - has any thread-specific data, appriopriate destructor functions shall - be called in an unspecified order. - - - Thread termination does not release any application visible process - resources include, but not limited to, mutexes and file descriptors, nor - does it perform any process-level cleanup actions, including but not - limited to, calling any atexit() routines that may exist. - - - An implicit call to pthread_exit() is made when a thread other than the - thread in which main() was first invoked returns from the start routine that - was used to create it. The function's return value shall serve as the - thread's exit status. - - - The process shall exit with an exit status of 0 after the last thread has - been terminated. The behavior shall be as if the implemenation called exit() - with a zero argument at thread termination time. - - The pthread_exit() function cannot return to its called. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/coverage.txt deleted file mode 100644 index e446d55e46..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_exit function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO ** Skipping for now. -5 NO ** Skipping for now. -6 NO ** Skipping for now. - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/threads_scenarii.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/threads_scenarii.c deleted file mode 100644 index 81e0dabf80..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_exit/threads_scenarii.c +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This file is a helper file for the pthread_create tests - * It defines the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - * - */ - - -struct __scenario -{ - /* Object to hold the given configuration, and which will be used to create the threads */ - pthread_attr_t ta; - /* General parameters */ - int detached; /* 0 => joinable; 1 => detached */ - /* Scheduling parameters */ - int explicitsched; /* 0 => sched policy is inherited; 1 => sched policy from the attr param */ - int schedpolicy; /* 0 => default; 1=> SCHED_FIFO; 2=> SCHED_RR */ - int schedparam; /* 0 => default sched param; 1 => max value for sched param; -1 => min value for sched param */ - int altscope; /* 0 => default contension scope; 1 => alternative contension scope */ - /* Stack parameters */ - int altstack; /* 0 => system manages the stack; 1 => stack is provided */ - int guard; /* 0 => default guardsize; 1=> guardsize is 0; 2=> guard is 1 page -- this setting only affect system stacks (not user's). */ - int altsize; /* 0 => default stack size; 1 => stack size specified (min value) -- ignored when stack is provided */ - /* Additionnal information */ - char * descr; /* object description */ - void * bottom; /* Stores the stack start when an alternate stack is required */ - int result; /* This thread creation is expected to: 0 => succeed; 1 => fail; 2 => unknown */ - sem_t sem; /* This semaphore is used to signal the end of the detached threads execution */ -} scenarii[]= - -#define CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,res) \ - { \ - .detached=det, \ - .explicitsched=expl, \ - .schedpolicy=scp, \ - .schedparam=spa, \ - .altscope=sco, \ - .altstack=sta, \ - .guard=gua, \ - .altsize=ssi, \ - .descr=desc, \ - .bottom=NULL, \ - .result=res } - -#define CASE_POS(det,expl,scp,spa,sco,sta,gua,ssi,desc) CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,0) -#define CASE_NEG(det,expl,scp,spa,sco,sta,gua,ssi,desc) CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,1) -#define CASE_UNK(det,expl,scp,spa,sco,sta,gua,ssi,desc) CASE(det,expl,scp,spa,sco,sta,gua,ssi,desc,2) - - /* - * This array gives the different combinations of threads attributes for the testcases. - * - * Some combinations must be avoided. - * -> Do not have a detached thread use an alternative stack; - * as we don't know when the thread terminates to free the stack memory - * -> ... (to be completed) - * - */ - -{ - /* Unary tests */ -/* 0*/ CASE_POS( 0, 0, 0, 0, 0, 0, 0, 0, "default") -/* 1*/ ,CASE_POS( 1, 0, 0, 0, 0, 0, 0, 0, "detached") -/* 2*/ ,CASE_POS( 0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched") -/* 3*/ ,CASE_UNK( 0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy") -/* 4*/ ,CASE_UNK( 0, 0, 2, 0, 0, 0, 0, 0, "RR Policy") -/* 5*/ ,CASE_UNK( 0, 0, 0, 1, 0, 0, 0, 0, "Max sched param") -/* 6*/ ,CASE_UNK( 0, 0, 0,-1, 0, 0, 0, 0, "Min sched param") -/* 7*/ ,CASE_POS( 0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope") -/* 8*/ ,CASE_POS( 0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack") -/* 9*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 0, "No guard size") -/*10*/ ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 0, "1p guard size") -/*11*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 1, "Min stack size") - - /* Stack play */ - ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard") - ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard") - ,CASE_POS( 1, 0, 0, 0, 0, 1, 0, 0, "Detached, Alternative stack") - ,CASE_POS( 1, 0, 0, 0, 0, 0, 1, 1, "Detached, Min stack size, no guard") - ,CASE_UNK( 1, 0, 0, 0, 0, 0, 2, 1, "Detached, Min stack size, 1p guard") - - /* Scheduling play -- all results are unknown since it might depend on the user priviledges */ - ,CASE_UNK( 0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param") - ,CASE_UNK( 0, 1, 2, 1, 0, 0, 0, 0, "Explicit RR max param") - ,CASE_UNK( 0, 1, 1,-1, 0, 0, 0, 0, "Explicit FIFO min param") - ,CASE_UNK( 0, 1, 2,-1, 0, 0, 0, 0, "Explicit RR min param") - ,CASE_UNK( 0, 1, 1, 1, 1, 0, 0, 0, "Explicit FIFO max param, alt scope") - ,CASE_UNK( 0, 1, 2, 1, 1, 0, 0, 0, "Explicit RR max param, alt scope") - ,CASE_UNK( 0, 1, 1,-1, 1, 0, 0, 0, "Explicit FIFO min param, alt scope") - ,CASE_UNK( 0, 1, 2,-1, 1, 0, 0, 0, "Explicit RR min param, alt scope") - ,CASE_UNK( 1, 1, 1, 1, 0, 0, 0, 0, "Detached, explicit FIFO max param") - ,CASE_UNK( 1, 1, 2, 1, 0, 0, 0, 0, "Detached, explicit RR max param") - ,CASE_UNK( 1, 1, 1,-1, 0, 0, 0, 0, "Detached, explicit FIFO min param") - ,CASE_UNK( 1, 1, 2,-1, 0, 0, 0, 0, "Detached, explicit RR min param") - ,CASE_UNK( 1, 1, 1, 1, 1, 0, 0, 0, "Detached, explicit FIFO max param, alt scope") - ,CASE_UNK( 1, 1, 2, 1, 1, 0, 0, 0, "Detached, explicit RR max param, alt scope") - ,CASE_UNK( 1, 1, 1,-1, 1, 0, 0, 0, "Detached, explicit FIFO min param, alt scope") - ,CASE_UNK( 1, 1, 2,-1, 1, 0, 0, 0, "Detached, explicit RR min param, alt scope") - -}; - -#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0])) - -/* This function will initialize every pthread_attr_t object in the scenarii array */ -void scenar_init() -{ - int ret=0; - int i; - int old; - long pagesize, minstacksize; - long tsa, tss, tps; - - pagesize =sysconf(_SC_PAGESIZE); - minstacksize =sysconf(_SC_THREAD_STACK_MIN); - tsa =sysconf(_SC_THREAD_ATTR_STACKADDR); - tss =sysconf(_SC_THREAD_ATTR_STACKSIZE); - tps =sysconf(_SC_THREAD_PRIORITY_SCHEDULING); - - #if VERBOSE > 0 - output("System abilities:\n"); - output(" TSA: %li\n", tsa); - output(" TSS: %li\n", tss); - output(" TPS: %li\n", tps); - output(" pagesize: %li\n", pagesize); - output(" min stack size: %li\n", minstacksize); - #endif - - - if (minstacksize % pagesize) - { - UNTESTED("The min stack size is not a multiple of the page size"); - } - - for (i=0; i 2 - output("Initializing attribute for scenario %i: %s\n", i, scenarii[i].descr); - #endif - - ret = pthread_attr_init(&scenarii[i].ta); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a thread attribute object"); } - - /* Set the attributes according to the scenario */ - if (scenarii[i].detached == 1) - { - ret = pthread_attr_setdetachstate(&scenarii[i].ta, PTHREAD_CREATE_DETACHED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set detachstate"); } - } - else - { - ret = pthread_attr_getdetachstate(&scenarii[i].ta, &old); - if (ret != 0) { UNRESOLVED(ret, "Unable to get detachstate from initialized attribute"); } - if (old != PTHREAD_CREATE_JOINABLE) { FAILED("The default attribute is not PTHREAD_CREATE_JOINABLE"); } - } - #if VERBOSE > 4 - output("Detach state was set sucessfully\n"); - #endif - - /* Sched related attributes */ - if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */ - { - if (scenarii[i].explicitsched == 1) - ret = pthread_attr_setinheritsched(&scenarii[i].ta, PTHREAD_EXPLICIT_SCHED); - else - ret = pthread_attr_setinheritsched(&scenarii[i].ta, PTHREAD_INHERIT_SCHED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set inheritsched attribute"); } - #if VERBOSE > 4 - output("inheritsched state was set sucessfully\n"); - #endif - } - #if VERBOSE > 4 - else - output("TPS unsupported => inheritsched parameter untouched\n"); - #endif - - if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */ - { - if (scenarii[i].schedpolicy == 1) - { - ret = pthread_attr_setschedpolicy(&scenarii[i].ta, SCHED_FIFO); - } - if (scenarii[i].schedpolicy == 2) - { - ret = pthread_attr_setschedpolicy(&scenarii[i].ta, SCHED_RR); - } - if (ret != 0) { UNRESOLVED(ret, "Unable to set the sched policy"); } - #if VERBOSE > 4 - if (scenarii[i].schedpolicy) - output("Sched policy was set sucessfully\n"); - else - output("Sched policy untouched\n"); - #endif - } - #if VERBOSE > 4 - else - output("TPS unsupported => sched policy parameter untouched\n"); - #endif - - if (scenarii[i].schedparam != 0) - { - struct sched_param sp; - - ret = pthread_attr_getschedpolicy(&scenarii[i].ta, &old); - if (ret != 0) { UNRESOLVED(ret, "Unable to get sched policy from attribute"); } - - if (scenarii[i].schedparam == 1) - sp.sched_priority = sched_get_priority_max(old); - if (scenarii[i].schedparam == -1) - sp.sched_priority = sched_get_priority_min(old); - - ret = pthread_attr_setschedparam(&scenarii[i].ta, &sp); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the sched param"); } - - #if VERBOSE > 4 - output("Sched param was set sucessfully to %i\n", sp.sched_priority); - } - else - { - output("Sched param untouched\n"); - #endif - } - - if (tps>0) /* This routine is dependent on the Thread Execution Scheduling option */ - { - ret = pthread_attr_getscope(&scenarii[i].ta, &old); - if (ret != 0) { UNRESOLVED(ret, "Failed to get contension scope from thread attribute"); } - - if (scenarii[i].altscope != 0) - { - if (old == PTHREAD_SCOPE_PROCESS) - old = PTHREAD_SCOPE_SYSTEM; - else - old = PTHREAD_SCOPE_PROCESS; - - ret = pthread_attr_setscope(&scenarii[i].ta, old); - //if (ret != 0) { UNRESOLVED(ret, "Failed to set contension scope"); } - #if VERBOSE > 0 - if (ret != 0) { output("WARNING: The TPS option is claimed to be supported but setscope fails\n"); } - #endif - - #if VERBOSE > 4 - output("Contension scope set to %s\n", old==PTHREAD_SCOPE_PROCESS?"PTHREAD_SCOPE_PROCESS":"PTHREAD_SCOPE_SYSTEM"); - } - else - { - output("Contension scope untouched (%s)\n", old==PTHREAD_SCOPE_PROCESS?"PTHREAD_SCOPE_PROCESS":"PTHREAD_SCOPE_SYSTEM"); - #endif - } - } - #if VERBOSE > 4 - else - output("TPS unsupported => sched contension scope parameter untouched\n"); - #endif - - /* Stack related attributes */ - if ((tss>0) && (tsa>0)) /* This routine is dependent on the Thread Stack Address Attribute - and Thread Stack Size Attribute options */ - { - if (scenarii[i].altstack != 0) - { - /* This is slightly more complicated. We need to alloc a new stack - and free it upon test termination */ - /* We will alloc with a simulated guardsize of 1 pagesize */ - scenarii[i].bottom = malloc(minstacksize + pagesize); - if (scenarii[i].bottom == NULL) { UNRESOLVED(errno,"Unable to alloc enough memory for alternative stack"); } - - ret = pthread_attr_setstack(&scenarii[i].ta, scenarii[i].bottom, minstacksize); - if (ret != 0) { UNRESOLVED(ret, "Failed to specify alternate stack"); } - - #if VERBOSE > 1 - output("Alternate stack created successfully. Bottom=%p, Size=%i\n", scenarii[i].bottom, minstacksize); - #endif - } - } - #if VERBOSE > 4 - else - output("TSA or TSS unsupported => No alternative stack\n"); - #endif - - #ifndef WITHOUT_XOPEN - if (scenarii[i].guard != 0) - { - if (scenarii[i].guard == 1) - ret = pthread_attr_setguardsize(&scenarii[i].ta, 0); - if (scenarii[i].guard == 2) - ret = pthread_attr_setguardsize(&scenarii[i].ta, pagesize); - if (ret != 0) { UNRESOLVED(ret, "Unable to set guard area size in thread stack"); } - #if VERBOSE > 4 - output("Guard size set to %i\n", (scenarii[i].guard==1)?1:pagesize); - #endif - } - #endif - - if (tss>0) /* This routine is dependent on the Thread Stack Size Attribute option */ - { - if (scenarii[i].altsize != 0) - { - ret = pthread_attr_setstacksize(&scenarii[i].ta, minstacksize); - if (ret != 0) { UNRESOLVED(ret, "Unable to change stack size"); } - #if VERBOSE > 4 - output("Stack size set to %i (this is the min)\n", minstacksize); - #endif - } - } - #if VERBOSE > 4 - else - output("TSS unsupported => stack size unchanged\n"); - #endif - - ret = sem_init(&scenarii[i].sem, 0,0); - if (ret == -1) { UNRESOLVED(errno, "Unable to init a semaphore"); } - - } - #if VERBOSE > 0 - output("All %i thread attribute objects were initialized\n\n", NSCENAR); - #endif -} - -/* This function will free all resources consumed in the scenar_init() routine */ -void scenar_fini(void) -{ - int ret = 0, i; - - for (i=0; i 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, NULL); - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - if (scenarii[sc].detached == 0) - { - ret = pthread_join(child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - else - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/1-1.c deleted file mode 100644 index 1cd549bf14..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/1-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_getcpuclockid() - * - * Steps: - * 1. Create a thread - * 2. Call the API to get the clockid in the created thread - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "pthread_getcpuclockid" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -void *thread_func() -{ - int rc; - clockid_t cid; - - rc = pthread_getcpuclockid(pthread_self(), &cid); - if (rc !=0 ) { - perror(ERROR_PREFIX "pthread_getcpuclockid"); - exit(PTS_FAIL); - } - printf("clock id of new thread is %d\n", cid); - - pthread_exit(0); - return NULL; -} - -int main() -{ - int rc; - pthread_t new_th; - - rc = pthread_create(&new_th, NULL, thread_func, NULL); - if (rc !=0 ) { - perror(ERROR_PREFIX "failed to create a thread"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_join(new_th, NULL); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_join"); - exit(PTS_UNRESOLVED); - } - - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/2-1.sh deleted file mode 100755 index 7944a97792..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh -# Copyright (c) 2004, Intel Corporation. All rights reserved. -# Created by: crystal.xiong REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_getcpuclockid returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/assertions.xml deleted file mode 100644 index 036f8fc2aa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/assertions.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - pthread_getcpuclockid() function shall return in the clock ID of the CPU-time - clock of the thread specified by thread_id, if the thread specified by - thread_id exists. - - - - If success, it returns zero. - - - - If fails, an error number shall be returned to indicate the error. - The pthread_getcpuclockid() may fail if: - [ESRCH] The value specified by thread_id does not refer to an existing - thread. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/coverage.txt deleted file mode 100644 index 28b6306d62..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_getcpuclockid function: - -Assertion Tested? -1 YES -2 YES -3 YES - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/speculative/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/speculative/3-1.c deleted file mode 100644 index b89ac58498..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getcpuclockid/speculative/3-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_getcpuclockid() - * - * Steps: - * 1. Create a thread - * 2. pthread_join the created thread - * 3. Call the API to get the clockid of this thread, it may fail. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-1" -#define FUNCTION "pthread_getcpuclockid" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -void *thread_func() -{ - pthread_exit(0); - return NULL; -} - -int main() -{ - int rc; - clockid_t cid; - pthread_t new_th; - - rc = pthread_create(&new_th, NULL, thread_func, NULL); - if (rc !=0 ) { - perror(ERROR_PREFIX "failed to create a thread"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_join(new_th, NULL); - if(rc != 0) - { - perror(ERROR_PREFIX "pthread_join"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_getcpuclockid(new_th, &cid); - if (rc == ESRCH ) { - printf("pthread_getcpuclockid returns ESRCH " - "when thread_id doesn't exist\n"); - } else { - printf("pthread_getcpuclockid doesn't return " - "ESRCH when thread_id doesn't exist\n"); - } - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/1-1.c deleted file mode 100644 index cdf3a2af76..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/1-1.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * adam.li@intel.com - * - * The pthread_getschedparam( ) function shall retrieve the scheduling - * policy and scheduling parameters for the thread whose thread ID is - * given by thread and shall store those values in - * policy and param, respectively. The priority value returned from - * pthread_getschedparam( ) shall be - * the value specified by the most recent pthread_setschedparam( ), - * pthread_setschedprio( ), or pthread_create( ) call affecting the - * target thread. It shall not reflect any temporary adjustments to - * its priority as a result of any priority inheritance or ceiling functions. - * - */ - -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - struct sched_param sparam; - int policy; - int rc; - - rc = pthread_getschedparam(pthread_self(), &policy, &sparam); - if (rc != 0) - { - printf("Error at pthread_getschedparam: rc=%d\n", rc); - exit(PTS_FAIL); - } - printf("policy: %d, priority: %d\n", policy, sparam.sched_priority); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - pthread_join(new_th, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/1-2.c deleted file mode 100644 index e86d7ee7e1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/1-2.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * adam.li@intel.com - * - * The pthread_getschedparam( ) function shall retrieve the scheduling - * policy and scheduling parameters for the thread whose thread ID is - * given by thread and shall store those values in - * policy and param, respectively. The priority value returned from - * pthread_getschedparam( ) shall be - * the value specified by the most recent pthread_setschedparam( ), - * pthread_setschedprio( ), or pthread_create( ) call affecting the - * target thread. It shall not reflect any temporary adjustments to - * its priority as a result of any priority inheritance or ceiling functions. - * - */ - - /* Set the sched parameter with pthread_setschedparam then get */ -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - struct sched_param sparam; - int policy, priority, policy_1; - int rc; - - policy = SCHED_FIFO; - priority = sched_get_priority_min(policy); - sparam.sched_priority = priority; - - rc = pthread_setschedparam(pthread_self(), policy, &sparam); - if (rc != 0) - { - printf("Error at pthread_setschedparam: rc=%d\n", rc); - exit(PTS_UNRESOLVED); - } - rc = pthread_getschedparam(pthread_self(), &policy_1, &sparam); - if (rc != 0) - { - printf("Error at pthread_getschedparam: rc=%d\n", rc); - exit(PTS_FAIL); - } - //printf("policy: %d, priority: %d\n", policy_1, sparam.sched_priority); - if (policy_1 != policy || sparam.sched_priority != priority) - { - printf("pthread_getschedparam did not get the correct value\n"); - exit(PTS_FAIL); - } - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - pthread_join(new_th, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/1-3.c deleted file mode 100644 index 7a7e10884e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/1-3.c +++ /dev/null @@ -1,339 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function gets the scheduling policy and parameter of -* the specified thread. The priority value is the one last -* set with pthread_setschedparam, pthread_setschedprio or -* pthread_create - - -* The steps are: -* -> create a new thread with a known scheduling policy & param. -* -> check the created thread has the required policy & param. -* -> change the policy with pthread_setschedparam & check the result. -* -> change the param with pthread_setschedprio & check the result. - -* The test fails if an inconsistency is detected. - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*********************** standard includes ************************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*********************** Test framework ***********************************/ -/******************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/***************************** Configuration **********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/***************************** Test case *********************************/ -/******************************************************************************/ - -/* This function checks the thread policy & priority */ -void check_param( pthread_t thread, int policy, int priority ) -{ - int ret = 0; - - int t_pol; - - struct sched_param t_parm; - - /* Check the priority is valid */ - - if ( priority == -1 ) - { - UNRESOLVED( errno, "Wrong priority value" ); - } - - /* Get the thread's parameters */ - ret = pthread_getschedparam( thread, &t_pol, &t_parm ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get thread's parameters" ); - } - - if ( t_pol != policy ) - { - FAILED( "The thread's policy is not as expected" ); - } - - if ( t_parm.sched_priority != priority ) - { - FAILED( "The thread's priority is not as expected" ); - } -} - -/* thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - /* check the thread attributes have been applied - (we only check what is reported, not the real behavior) - */ - check_param( pthread_self(), SCHED_RR, sched_get_priority_min( SCHED_RR ) ); - - ret = pthread_barrier_wait( arg ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - /* Nothing to do while the main thread sets the scheduling policy */ - - ret = pthread_barrier_wait( arg ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - /* Check the scheduling policy was changed - (we only check what is reported, not the real behavior) - */ - check_param( pthread_self(), SCHED_FIFO, sched_get_priority_min( SCHED_FIFO ) ); - - ret = pthread_barrier_wait( arg ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - /* Nothing to do while the main thread sets the scheduling parameter */ - - ret = pthread_barrier_wait( arg ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - /* Check the scheduling parameter has been changed - (we only check what is reported, not the real behavior) - */ - check_param( pthread_self(), SCHED_FIFO, sched_get_priority_max( SCHED_FIFO ) ); - - ret = pthread_barrier_wait( arg ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - return NULL; -} - -/* The main test function. */ -int main( int argc, char *argv[] ) -{ - int ret = 0; - pthread_t child; - pthread_attr_t ta; - pthread_barrier_t bar; - - struct sched_param sp; - - /* Initialize output routine */ - output_init(); - - ret = pthread_barrier_init( &bar, NULL, 2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init barrier" ); - } - - /* Create the attribute object with a known scheduling policy */ - ret = pthread_attr_init( &ta ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to initialize thread attribute" ); - } - - ret = pthread_attr_setinheritsched( &ta, PTHREAD_EXPLICIT_SCHED ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set inherit sched" ); - } - - sp.sched_priority = sched_get_priority_min( SCHED_RR ); - - if ( sp.sched_priority == -1 ) - { - UNRESOLVED( errno, "Failed to get min priority" ); - } - - ret = pthread_attr_setschedparam( &ta, &sp ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set attribute param" ); - } - - ret = pthread_attr_setschedpolicy( &ta, SCHED_RR ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set attribute policy" ); - } - - /* Create the thread with this attribute */ - ret = pthread_create( &child, &ta, threaded, &bar ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "thread creation failed (you may need more priviledges)" ); - } - - /* Wait while the thread checks its policy - (we only check what is reported, not the real behavior) - */ - check_param( child, SCHED_RR, sched_get_priority_min( SCHED_RR ) ); - - - ret = pthread_barrier_wait( &bar ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - /* Change the threads policy */ - sp.sched_priority = sched_get_priority_min( SCHED_FIFO ); - - if ( sp.sched_priority == -1 ) - { - UNRESOLVED( errno, "Failed to get min priority" ); - } - - ret = pthread_setschedparam( child, SCHED_FIFO, &sp ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to change running thread's policy" ); - } - - ret = pthread_barrier_wait( &bar ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - /* Wait while the thread checks its policy - (we only check what is reported, not the real behavior) - */ - check_param( child, SCHED_FIFO, sched_get_priority_min( SCHED_FIFO ) ); - - ret = pthread_barrier_wait( &bar ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - /* Change the thread priority */ - sp.sched_priority = sched_get_priority_max( SCHED_FIFO ); - - if ( sp.sched_priority == -1 ) - { - UNRESOLVED( errno, "Failed to get max priority" ); - } - - ret = pthread_setschedprio( child, sp.sched_priority ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise thread's priority" ); - } - - ret = pthread_barrier_wait( &bar ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - /* The thread checks its priority - (we only check what is reported, not the real behavior) - */ - check_param( child, SCHED_FIFO, sched_get_priority_max( SCHED_FIFO ) ); - - ret = pthread_barrier_wait( &bar ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/4-1.c deleted file mode 100644 index 5681b26eb7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/4-1.c +++ /dev/null @@ -1,338 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function does not return EINTR - -* The steps are: -* -> kill a thread which calls pthread_getschedparam -* -> check that EINTR is never returned - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*********************** standard includes ************************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/******************************************************************************/ -/*********************** Test framework ***********************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/***************************** Configuration **********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - -/******************************************************************************/ -/***************************** Test case *********************************/ -/******************************************************************************/ - -char do_it = 1; -unsigned long count_ope = 0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig = 0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} - -thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig ( void * arg ) -{ - thestruct * thearg = ( thestruct * ) arg; - int ret; - pid_t process; - - process = getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread" ); - } - - while ( do_it ) - { -#ifdef WITH_SYNCHRO - - if ( ( ret = sem_wait( thearg->sem ) ) ) - { - UNRESOLVED( errno, "Sem_wait in sendsig" ); - } - - count_sig++; -#endif - - ret = kill( process, thearg->sig ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Kill in sendsig" ); - } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig1 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 1" ); - } - -#endif -} - -/* This one is registered for signal SIGUSR2 */ -void sighdl2( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig2 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 2" ); - } - -#endif -} - -/* Test function -- calls pthread_equal() and checks that EINTR is never returned. */ -void * test( void * arg ) -{ - int ret = 0; - int pol; - - struct sched_param sp; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_UNBLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread" ); - } - - - while ( do_it ) - { - count_ope++; - ret = pthread_getschedparam( pthread_self(), &pol, &sp ); - - if ( ret == EINTR ) - { - FAILED( "EINTR was returned" ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unexpected error returned" ); - } - } - - return NULL; -} - - -/* Main function */ -int main ( int argc, char * argv[] ) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset ( &sa.sa_mask ); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - - if ( ( ret = sigaction ( SIGUSR1, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler1" ); - } - - sa.sa_handler = sighdl2; - - if ( ( ret = sigaction ( SIGUSR2, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler2" ); - } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset( &usersigs ); - - ret = sigaddset( &usersigs, SIGUSR1 ); - - ret |= sigaddset( &usersigs, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to add SIGUSR1 or 2 to a signal set" ); - } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread" ); - } - -#ifdef WITH_SYNCHRO - if ( sem_init( &semsig1, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig1 init" ); - } - - if ( sem_init( &semsig2, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig2 init" ); - } - -#endif - - if ( ( ret = pthread_create( &th_work, NULL, test, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread creation failed" ); - } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ( ( ret = pthread_create( &th_sig1, NULL, sendsig, ( void * ) & arg1 ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread creation failed" ); - } - - if ( ( ret = pthread_create( &th_sig2, NULL, sendsig, ( void * ) & arg2 ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread creation failed" ); - } - - - - /* Let's wait for a while now */ - sleep( 1 ); - - - /* Now stop the threads and join them */ - do - { - do_it = 0; - } - while ( do_it ); - - - if ( ( ret = pthread_join( th_sig1, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread join failed" ); - } - - if ( ( ret = pthread_join( th_sig2, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread join failed" ); - } - - - if ( ( ret = pthread_join( th_work, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread join failed" ); - } - - -#if VERBOSE > 0 - output( "Test executed successfully.\n" ); - - output( " %d initializations.\n", count_ope ); - -#ifdef WITH_SYNCHRO - output( " %d signals were sent meanwhile.\n", count_sig ); - -#endif -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/assertions.xml deleted file mode 100644 index 109604a0e0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/assertions.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - The pthread_getschedparam( ) function shall retrieve the scheduling - policy and scheduling parameters for the thread whose thread ID is - given by thread and shall store those values in - policy and param, respectively. The priority value returned from - pthread_getschedparam( ) shall be - the value specified by the most recent pthread_setschedparam( ), - pthread_setschedprio( ), or pthread_create( ) call affecting the - target thread. It shall not reflect any temporary adjustments to - its priority as a result of any priority inheritance or ceiling functions. - - - - TSP If _POSIX_THREAD_SPORADIC_SERVER is defined, then the policy argument may have the - value SCHED_SPORADIC, with the exception for the pthread_setschedparam( ) function - that if the scheduling policy was not SCHED_SPORADIC at the time of the call, - it is implementation-defined whether the function is supported; in other words, - the implementation need not allow the application to dynamically change the - scheduling policy to SCHED_SPORADIC. The sporadic server scheduling policy - has the associated parameters sched_ss_low_priority, sched_ss_repl_period, - sched_ss_init_budget, sched_priority, and sched_ss_max_repl. The specified - sched_ss_repl_period shall be greater than or equal to the specified - sched_ss_init_budget for the function to succeed; if it is not, then the function - shall fail. The value of sched_ss_max_repl shall be within the inclusive - range [1,{SS_REPL_MAX}] for the function to succeed; if not, the function - shall fail. - - - - If successful, the pthread_getschedparam( ) and pthread_setschedparam( ) - functions shall return zero; otherwise, an error number shall be returned - to indicate the error. - - - - The function never returns EINTR. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/coverage.txt deleted file mode 100644 index 85925cf779..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_getschedparam() function: - -Assertion Tested? -1 YES -2 NO -3 YES *Tested implictly by 1-1 - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getschedparam/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/1-1.c deleted file mode 100644 index 5ad8cfcd7c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/1-1.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_getspecific() - * - * shall return the value currently bound to the specified key on behalf of the calling thread. - * Calling pthread_getspecific() with a key value not obtained from pthread_key_create() or - * after key has been deleted with pthread_key_delete() is undefined. - * - * Steps: - * 1. Create NUM_OF_KEYS pthread_key_t objects - * 2. Set each key to a thread-specific value with pthread_setspecific() - * 3. Call pthread_getspecific() on each key and check that the value returned is correct. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_KEYS 10 -#define KEY_VALUE 0 - -int main() -{ - pthread_key_t keys[NUM_OF_KEYS]; - int i; - void* rc; - - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_key_t key; - void* rc; - - if(pthread_key_create(&key, NULL) != 0) - { - printf("Error: pthread_key_create() failed\n"); - return PTS_UNRESOLVED; - } - - rc = pthread_getspecific(key); - if(rc != NULL) - { - printf("Test FAILED: Did not return correct value, expected NULL, but got %ld\n", (long)rc); - return PTS_FAIL; - } - - if(pthread_key_delete(key) != 0) - { - printf("Error: pthread_key_delete() failed\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/assertions.xml deleted file mode 100644 index 7e7866d077..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/assertions.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - The function - void *pthread_getspecific(pthread_key_t key) - - shall return the value currently bound to the specified key on behalf of the calling thread. - Calling pthread_getspecific() with a key value not obtained from pthread_key_create() or - after key has been deleted with pthread_key_delete() is undefined. - - - - pthread_getspecific can be called from a thread-specific data destructor function. - A call to pthread_getspecific() for the thread-specific data key being destroyed shall - return the value NULL, unless the value is changed (after the destructor starts) by a call - to pthread_setspecific(). - - - - It shall return the thread-specific data value associated with the given 'key'. If no - thread-specific data value is associated with 'key, then the value NULL shall be returned. - - It does not return any errors. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/coverage.txt deleted file mode 100644 index 9df86f6c2f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_getspecific function: - -Assertion Tested? -1 YES -2 NO *Will not test -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/1-1.c deleted file mode 100644 index d66b7900e8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/1-1.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_join() - * - * shall suspend the execution of the calling thread until the target - * 'thread' terminates, unless 'thread' has already terminated. - * - * Steps: - * 1. Create a new thread. Have it sleep for 3 seconds. - * 2. The main() thread should wait for the new thread to finish execution before exiting out. - * - */ - -#include -#include -#include -#include "posixtest.h" - -int end_exec; /* Global flag indicating the the thread function has finished execution. */ - -/* Thread's function. */ -void *a_thread_func() -{ - int i; - - printf("Wait for 3 seconds for thread to finish execution:\n"); - for(i=1;i<4;i++) - { - printf("Waited (%d) second\n", i); - sleep(1); - } - - /* Indicate that the thread has ended execution. */ - end_exec=1; - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initialize flag */ - end_exec = 0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to return */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if(end_exec == 0) - { - printf("Test FAILED: When using pthread_join(), main() did not wait for thread to finish execution before continuing.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/1-2.c deleted file mode 100644 index 60766982f9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/1-2.c +++ /dev/null @@ -1,229 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* pthread_join() returns only when the joined thread has terminated. - -* The steps are: -* -> create a thread -* -> the thread yields then read clock and exit -* -> check the read clock value is before pthread_join return. - -* The test fails if the time read is not coherent - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Helper *****************************************/ -/********************************************************************************************/ -#include "threads_scenarii.c" -/* this file defines: -* scenarii: array of struct __scenario type. -* NSCENAR : macro giving the total # of scenarii -* scenar_init(): function to call before use the scenarii array. -* scenar_fini(): function to call after end of use of the scenarii array. -*/ - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - int i; - /* yield the control some times */ - - for ( i = 0; i < 10; i++ ) - sched_yield(); - - /* Now tell we're done */ - ret = clock_gettime( CLOCK_REALTIME, arg ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to get clock time" ); - } - - return NULL; -} - -/* The main test function. */ -int main( int argc, char *argv[] ) -{ - int ret = 0; - pthread_t child; - - struct timespec ts_pre, ts_th, ts_post; - - /* Initialize output routine */ - output_init(); - - /* Initialize thread attribute objects */ - scenar_init(); - - for ( sc = 0; sc < NSCENAR; sc++ ) - { -#if VERBOSE > 0 - output( "-----\n" ); - output( "Starting test with scenario (%i): %s\n", sc, scenarii[ sc ].descr ); -#endif - ret = clock_gettime( CLOCK_REALTIME, &ts_pre ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read clock" ); - } - - ret = pthread_create( &child, &scenarii[ sc ].ta, threaded, &ts_th ); - - switch ( scenarii[ sc ].result ) - { - case 0: /* Operation was expected to succeed */ - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create this thread" ); - } - - break; - - case 1: /* Operation was expected to fail */ - - if ( ret == 0 ) - { - UNRESOLVED( -1, "An error was expected but the thread creation succeeded" ); - } - - break; - - case 2: /* We did not know the expected result */ - default: -#if VERBOSE > 0 - - if ( ret == 0 ) - { - output( "Thread has been created successfully for this scenario\n" ); - } - else - { - output( "Thread creation failed with the error: %s\n", strerror( ret ) ); - } - -#endif - - } - - if ( ret == 0 ) /* The new thread is running */ - { - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to join a thread" ); - } - - ret = clock_gettime( CLOCK_REALTIME, &ts_post ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read clock" ); - } - - /* Now check that ts_pre <= ts_th <= ts_post */ - if ( ( ts_th.tv_sec < ts_pre.tv_sec ) - || ( ( ts_th.tv_sec == ts_pre.tv_sec ) && ( ts_th.tv_nsec < ts_pre.tv_nsec ) ) ) - { - output( "Pre : %d.%09d\n", ts_pre.tv_sec, ts_pre.tv_nsec ); - output( "child: %d.%09d\n", ts_th.tv_sec, ts_th.tv_nsec ); - output( "Post : %d.%09d\n", ts_post.tv_sec, ts_post.tv_nsec ); - FAILED( "Child returned before its creation ???" ); - } - - if ( ( ts_post.tv_sec < ts_th.tv_sec ) - || ( ( ts_post.tv_sec == ts_th.tv_sec ) && ( ts_post.tv_nsec < ts_th.tv_nsec ) ) ) - { - output( "Pre : %d.%09d\n", ts_pre.tv_sec, ts_pre.tv_nsec ); - output( "child: %d.%09d\n", ts_th.tv_sec, ts_th.tv_nsec ); - output( "Post : %d.%09d\n", ts_post.tv_sec, ts_post.tv_nsec ); - FAILED( "pthread_join returned before child terminated" ); - } - - } - } - - scenar_fini(); -#if VERBOSE > 0 - output( "-----\n" ); - output( "All test data destroyed\n" ); - output( "Test PASSED\n" ); -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/2-1.c deleted file mode 100644 index 5a49638272..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/2-1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_join() - * - * On return from a successful pthread_join() call with a non-NULL 'value_ptr' - * argument, the avlue passed to pthread_exit() by the terminating thread shall - * be made available in the location referenced by 'value_ptr'. - * - * Steps: - * 1. Create a new thread. Have it return a return code on pthread_exit(); - * 2. Call pthread_join() in main(), and pass to it 'value_ptr'. - * 3. Check to see of the value_ptr and the value returned by pthread_exit() are the same; - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define RETURN_CODE ((void*)100) /* Set a random return code number. This shall be the return code of the - thread when using pthread_exit().*/ - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem; /* Manual semaphore used to indicate when the thread has been created. */ - -/* Thread's function. */ -void *a_thread_func() -{ - sem=INMAIN; - pthread_exit(RETURN_CODE); - return NULL; -} - -int main() -{ - pthread_t new_th; - void *value_ptr; - - /* Initializing variables. */ - value_ptr=0; - sem=INTHREAD; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure the thread was created before we join it. */ - while(sem==INTHREAD) - sleep(1); - - /* Wait for thread to return */ - if(pthread_join(new_th, &value_ptr) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check to make sure that 'value_ptr' that was passed to pthread_join() and the - * pthread_exit() return code that was used in the thread funciton are the same. */ - if(value_ptr != RETURN_CODE) - { - printf("Test FAILED: pthread_join() did not return the pthread_exit value of the thread in 'value_ptr'.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/3-1.c deleted file mode 100644 index c1fcb2ca9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/3-1.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_join() - * - * When pthread_join() returns successfully, the target thread has been - * terminated. - * - * Steps: - * 1. Create a new thread. - * 2. Send a cancel request to it from main, then use pthread_join to wait for it to end. - * 3. The thread will sleep for 3 seconds, then call test_cancel() to cancel execution. - * 4. When this happens, the cleanup handler should be called. - * 5. Main will test that when pthread_join allows main to continue with the process that - * the thread has ended execution. If the cleanup_handler was not called, then the - * test fails. - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 10 /* Timeout period for cancel request is 10 seconds. */ -int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */ - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is 1, it means that the thread was canceled. */ -void a_cleanup_func() -{ - cleanup_flag=1; - return; -} - -/* Thread's function. */ -void *a_thread_func() -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); - - /* Set up the cleanup handler */ - pthread_cleanup_push(a_cleanup_func,NULL); - - /* Wait for a timeout period for the cancel request to be sent. */ - /* Cancelation point. Should call cleanup handler now. . */ - sleep(TIMEOUT); - - /* Should not get here, but just in case pthread_testcancel() didn't work. */ - /* Cancel request timed out. */ - pthread_cleanup_pop(0); - cleanup_flag=-1; - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initialize flag */ - cleanup_flag = 0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Send cancel request to the thread. */ - if(pthread_cancel(new_th) != 0) - { - perror("Couldn't cancel thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to return */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if(cleanup_flag == 0) - { - printf("Test FAILED: Thread did not finish execution when pthread_join returned. \n"); - return PTS_FAIL; - } - - if(cleanup_flag == -1) - { - perror("Error in pthread_testcancel(). Cancel request timed out.\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/4-1.c deleted file mode 100644 index 493abbf616..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/4-1.c +++ /dev/null @@ -1,267 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* If the thread calling pthread_join is canceled, the joined thread remains joinable. - -* The steps are: -* -> create a thread blocked on a mutex. -* -> create another thread which tries and join the first thread. -* -> cancel the 2nd thread. -* -> unblock the semaphore then join the 1st thread - -* The test fails if the main thread is unable to join the 1st thread. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Helper *****************************************/ -/********************************************************************************************/ -#include "threads_scenarii.c" -/* this file defines: -* scenarii: array of struct __scenario type. -* NSCENAR : macro giving the total # of scenarii -* scenar_init(): function to call before use the scenarii array. -* scenar_fini(): function to call after end of use of the scenarii array. -*/ - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; - -/* 1st thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - /* Try and lock the mutex, then exit */ - - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex" ); - } - - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex" ); - } - - return NULL; -} - -/* Canceled thread */ -void * joiner_func( void * arg ) -{ - ( void ) pthread_join( *( pthread_t * ) arg, NULL ); - - FAILED( "The joiner thread was not canceled" ); - - /* please the compiler */ - return NULL; -} - - -/* The main test function. */ -int main( int argc, char *argv[] ) -{ - int ret = 0; - pthread_t child; - pthread_t joiner; - - /* Initialize output routine */ - output_init(); - - /* Initialize thread attribute objects */ - scenar_init(); - - for ( sc = 0; sc < NSCENAR; sc++ ) - { -#if VERBOSE > 0 - output( "-----\n" ); - output( "Starting test with scenario (%i): %s\n", sc, scenarii[ sc ].descr ); -#endif - - /* Lock the mutex */ - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "failed to lock the mutex" ); - } - - ret = pthread_create( &child, &scenarii[ sc ].ta, threaded, NULL ); - - switch ( scenarii[ sc ].result ) - { - case 0: /* Operation was expected to succeed */ - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create this thread" ); - } - - break; - - case 1: /* Operation was expected to fail */ - - if ( ret == 0 ) - { - UNRESOLVED( -1, "An error was expected but the thread creation succeeded" ); - } - - break; - - case 2: /* We did not know the expected result */ - default: -#if VERBOSE > 0 - - if ( ret == 0 ) - { - output( "Thread has been created successfully for this scenario\n" ); - } - else - { - output( "Thread creation failed with the error: %s\n", strerror( ret ) ); - } - -#endif - - } - - if ( ret == 0 ) /* The new thread is running */ - { - - /* Now create the joiner thread */ - ret = pthread_create( &joiner, NULL, joiner_func, &child ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create the joiner thread" ); - } - - /* Let it enter pthread_join */ - sched_yield(); - - /* Cancel the joiner thread */ - ret = pthread_cancel( joiner ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to cancel the thread" ); - } - - /* Join the canceled thread */ - ret = pthread_join( joiner, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the canceled thread" ); - } - - /* Unblock the child thread */ - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock the mutex" ); - } - - /* Check the first thread is still joinable */ - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - output( "Error returned: %d\n" ); - FAILED( "The thread is no more joinable" ); - } - - } - else - { - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock the mutex" ); - } - } - } - - scenar_fini(); -#if VERBOSE > 0 - output( "-----\n" ); - output( "All test data destroyed\n" ); - output( "Test PASSED\n" ); -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/5-1.c deleted file mode 100644 index 2353c84691..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/5-1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_join() - * - * Upon successful completion, it returns 0; - * - * Steps: - * 1. Create a new thread. - * 2. Join that thread to main. If the return code is not 0, or the other valid error - * codes of EINVAL, ESRCH or EDEADLK, then the test fails. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -/* Thread's function. */ -void *a_thread_func() -{ - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int ret; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to return */ - ret=pthread_join(new_th, NULL); - - if(ret != 0) - { - if((ret != EINVAL) && (ret != ESRCH) && (ret != EDEADLK)) - { - printf("Test FAILED: Invalid return code %d.\n", ret); - return PTS_FAIL; - } - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/6-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/6-2.c deleted file mode 100644 index 1ecbc252e7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/6-2.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_join() - * - * pthread_join() SHALL fail if: - * - * -[ESRCH] No thread could be found corresponding to that thread ID - * - * pthread_join() MAY fail if: - - * -[EINVAL] The implementation has detected that the value specified by - * 'thread' does not refer to a joinable thread. - * -[EDEADLK] A deadlock was detected or the value of 'thread' specifies the - * calling thread. - - * It shall not return an error code of [EINTR] - * - * Testing ESRCH - * - * Steps: - * 1. Create a new thread. - * 2. Call pthread_join() in main. This means that the thread should have ended execution. - * 3. Call pthread_join() again, it should give the error code ESRCH. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -/* Thread's function. */ -void *a_thread_func() -{ - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int ret; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to return */ - ret=pthread_join(new_th, NULL); - - if(ret != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Now that the thread has returned, try to join it again. It should give the error - * code of ESRCH. */ - ret=pthread_join(new_th, NULL); - - if(ret != ESRCH) - { - printf("Test FAILED: Return code should be ESRCH, but is: %d instead.\n", ret); - return PTS_FAIL; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/6-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/6-3.c deleted file mode 100644 index 52da375fac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/6-3.c +++ /dev/null @@ -1,381 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function does not return EINTR - -* The steps are: -* -> kill a thread which calls pthread_join -* -> check that EINTR is never returned - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - - -/********************************************************************************************/ -/*********************************** Helper *****************************************/ -/********************************************************************************************/ -#include "threads_scenarii.c" -/* this file defines: -* scenarii: array of struct __scenario type. -* NSCENAR : macro giving the total # of scenarii -* scenar_init(): function to call before use the scenarii array. -* scenar_fini(): function to call after end of use of the scenarii array. -*/ - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -char do_it = 1; -unsigned long count_ope = 0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig = 0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} - -thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig ( void * arg ) -{ - thestruct * thearg = ( thestruct * ) arg; - int ret; - pid_t process; - - process = getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread" ); - } - - while ( do_it ) - { -#ifdef WITH_SYNCHRO - - if ( ( ret = sem_wait( thearg->sem ) ) ) - { - UNRESOLVED( errno, "Sem_wait in sendsig" ); - } - - count_sig++; -#endif - - ret = kill( process, thearg->sig ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Kill in sendsig" ); - } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig1 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 1" ); - } - -#endif -} - -/* This one is registered for signal SIGUSR2 */ -void sighdl2( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig2 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 2" ); - } - -#endif -} - -/* thread function */ -void *threaded( void* arg ) -{ - /* do nothing */ - sched_yield(); - - return NULL; -} - - -/* Test function -- calls pthread_join() and checks that EINTR is never returned. */ -void * test( void * arg ) -{ - int ret = 0; - pthread_t child; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_UNBLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread" ); - } - - - while ( do_it ) - { - for ( sc = 0; sc < NSCENAR; sc++ ) - { - ret = pthread_create( &child, &scenarii[ sc ].ta, threaded, NULL ); - - if ( ( scenarii[ sc ].result == 0 ) && ( ret != 0 ) ) - { - UNRESOLVED( ret, "Failed to create this thread" ); - } - - if ( ( scenarii[ sc ].result == 1 ) && ( ret == 0 ) ) - { - - UNRESOLVED( -1, "An error was expected but the thread creation succeeded" ); - } - - - if ( ret == 0 ) /* The new thread is running */ - { - count_ope++; - - ret = pthread_join( child, NULL ); - - if ( ret == EINTR ) - { - FAILED( "pthread_join returned EINTR" ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to join a thread" ); - } - - } - } - } - - return NULL; -} - -/* Main function */ -int main ( int argc, char * argv[] ) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset ( &sa.sa_mask ); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - - if ( ( ret = sigaction ( SIGUSR1, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler1" ); - } - - sa.sa_handler = sighdl2; - - if ( ( ret = sigaction ( SIGUSR2, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler2" ); - } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset( &usersigs ); - - ret = sigaddset( &usersigs, SIGUSR1 ); - - ret |= sigaddset( &usersigs, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to add SIGUSR1 or 2 to a signal set" ); - } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread" ); - } - -#ifdef WITH_SYNCHRO - if ( sem_init( &semsig1, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig1 init" ); - } - - if ( sem_init( &semsig2, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig2 init" ); - } - -#endif - - /* Initialize thread attribute objects */ - scenar_init(); - - - if ( ( ret = pthread_create( &th_work, NULL, test, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread creation failed" ); - } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ( ( ret = pthread_create( &th_sig1, NULL, sendsig, ( void * ) & arg1 ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread creation failed" ); - } - - if ( ( ret = pthread_create( &th_sig2, NULL, sendsig, ( void * ) & arg2 ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread creation failed" ); - } - - - - /* Let's wait for a while now */ - sleep( 10 ); - - - /* Now stop the threads and join them */ - do - { - do_it = 0; - } - while ( do_it ); - - - if ( ( ret = pthread_join( th_sig1, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread join failed" ); - } - - if ( ( ret = pthread_join( th_sig2, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread join failed" ); - } - - - if ( ( ret = pthread_join( th_work, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread join failed" ); - } - - scenar_fini(); - -#if VERBOSE > 0 - output( "Test executed successfully.\n" ); - - output( " %d pthread_join calls.\n", count_ope ); - -#ifdef WITH_SYNCHRO - output( " %d signals were sent meanwhile.\n", count_sig ); - -#endif - #endif - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/assertions.xml deleted file mode 100644 index 4872cc22a7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/assertions.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - The function - - int pthread_join(pthread_t thread, void **value_ptr); - - shall suspend the execution of the calling thread until the target - 'thread' terminates, unless 'thread' has already terminated. - - - On return from a successful pthread_join() call with a non-NULL 'value_ptr' - argument, the value passed to pthread_exit() by the terminating thread shall - be made available in the location referenced by 'value_ptr'. - - - When pthread_join() returns successfully, the target thread has been - terminated. - - - If the thread calling pthread_join() is canceled, then the target thread - shall not be detached. - - - Upon successful completion, it returns 0; - - - pthread_join() SHALL fail if: - - -[ESRCH] No thread could be found corresponding to that thread ID - - pthread_join() MAY fail if: - - -[EINVAL] The implementation has detected that the value specified by - 'thread' does not refer to a joinable thread. - -[EDEADLK] A deadlock was detected or the value of 'thread' specifies the - calling thread. - - It shall not return an error code of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/coverage.txt deleted file mode 100644 index 9272ccdb1a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/coverage.txt +++ /dev/null @@ -1,12 +0,0 @@ -This document defines the coverage for the pthread_join function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO ** Skipping for now. -5 YES -6 YES ** When it specifies 'may' fail and not 'shall' fail, - it will always return PASS, but will return a - PASS and print out a warning if it fails. -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/threads_scenarii.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/threads_scenarii.c deleted file mode 100644 index b43e9d615b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_join/threads_scenarii.c +++ /dev/null @@ -1,486 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This file is a helper file for the pthread_join tests -* It defines the following objects: -* scenarii: array of struct __scenario type. -* NSCENAR : macro giving the total # of scenarii -* scenar_init(): function to call before use the scenarii array. -* scenar_fini(): function to call after end of use of the scenarii array. - -* It is derived from the file in pthread_create tests, with the detached stuff removed -* -*/ - - -struct __scenario -{ - /* Object to hold the given configuration, and which will be used to create the threads */ - pthread_attr_t ta; - /* Scheduling parameters */ - int explicitsched; /* 0 => sched policy is inherited; 1 => sched policy from the attr param */ - int schedpolicy; /* 0 => default; 1=> SCHED_FIFO; 2=> SCHED_RR */ - int schedparam; /* 0 => default sched param; 1 => max value for sched param; -1 => min value for sched param */ - int altscope; /* 0 => default contension scope; 1 => alternative contension scope */ - /* Stack parameters */ - int altstack; /* 0 => system manages the stack; 1 => stack is provided */ - int guard; /* 0 => default guardsize; 1=> guardsize is 0; 2=> guard is 1 page -- this setting only affect system stacks (not user's). */ - int altsize; /* 0 => default stack size; 1 => stack size specified (min value) -- ignored when stack is provided */ - /* Additionnal information */ - char * descr; /* object description */ - void * bottom; /* Stores the stack start when an alternate stack is required */ - int result; /* This thread creation is expected to: 0 => succeed; 1 => fail; 2 => unknown */ -} - -scenarii[] = - -#define CASE(expl,scp,spa,sco,sta,gua,ssi,desc,res) \ - { \ - .explicitsched=expl, \ - .schedpolicy=scp, \ - .schedparam=spa, \ - .altscope=sco, \ - .altstack=sta, \ - .guard=gua, \ - .altsize=ssi, \ - .descr=desc, \ - .bottom=NULL, \ - .result=res } - -#define CASE_POS(expl,scp,spa,sco,sta,gua,ssi,desc) CASE(expl,scp,spa,sco,sta,gua,ssi,desc,0) -#define CASE_NEG(expl,scp,spa,sco,sta,gua,ssi,desc) CASE(expl,scp,spa,sco,sta,gua,ssi,desc,1) -#define CASE_UNK(expl,scp,spa,sco,sta,gua,ssi,desc) CASE(expl,scp,spa,sco,sta,gua,ssi,desc,2) - - /* - * This array gives the different combinations of threads attributes for the testcases. - * - * Some combinations must be avoided. - * -> Do not have a detached thread use an alternative stack; - * as we don't know when the thread terminates to free the stack memory - * -> ... (to be completed) - * - */ - - { - /* Unary tests */ - /* 0*/ CASE_POS( 0, 0, 0, 0, 0, 0, 0, "default" ) - /* 1*/ , CASE_POS( 1, 0, 0, 0, 0, 0, 0, "Explicit sched" ) - /* 3*/ , CASE_UNK( 0, 1, 0, 0, 0, 0, 0, "FIFO Policy" ) - /* 4*/ , CASE_UNK( 0, 2, 0, 0, 0, 0, 0, "RR Policy" ) - /* 5*/ , CASE_UNK( 0, 0, 1, 0, 0, 0, 0, "Max sched param" ) - /* 6*/ , CASE_UNK( 0, 0, -1, 0, 0, 0, 0, "Min sched param" ) - /* 7*/ , CASE_POS( 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope" ) - /* 8*/ , CASE_POS( 0, 0, 0, 0, 1, 0, 0, "Alternative stack" ) - /* 9*/ , CASE_POS( 0, 0, 0, 0, 0, 1, 0, "No guard size" ) - /*10*/ , CASE_UNK( 0, 0, 0, 0, 0, 2, 0, "1p guard size" ) - /*11*/ , CASE_POS( 0, 0, 0, 0, 0, 0, 1, "Min stack size" ) - - /* Stack play */ - , CASE_POS( 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard" ) - , CASE_UNK( 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard" ) - - /* Scheduling play -- all results are unknown since it might depend on the user priviledges */ - , CASE_UNK( 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param" ) - , CASE_UNK( 1, 2, 1, 0, 0, 0, 0, "Explicit RR max param" ) - , CASE_UNK( 1, 1, -1, 0, 0, 0, 0, "Explicit FIFO min param" ) - , CASE_UNK( 1, 2, -1, 0, 0, 0, 0, "Explicit RR min param" ) - , CASE_UNK( 1, 1, 1, 1, 0, 0, 0, "Explicit FIFO max param, alt scope" ) - , CASE_UNK( 1, 2, 1, 1, 0, 0, 0, "Explicit RR max param, alt scope" ) - , CASE_UNK( 1, 1, -1, 1, 0, 0, 0, "Explicit FIFO min param, alt scope" ) - , CASE_UNK( 1, 2, -1, 1, 0, 0, 0, "Explicit RR min param, alt scope" ) - - }; - -#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0])) - -/* This function will initialize every pthread_attr_t object in the scenarii array */ -void scenar_init() -{ - int ret = 0; - int i; - int old; - long pagesize, minstacksize; - long tsa, tss, tps; - - pagesize = sysconf( _SC_PAGESIZE ); - minstacksize = sysconf( _SC_THREAD_STACK_MIN ); - tsa = sysconf( _SC_THREAD_ATTR_STACKADDR ); - tss = sysconf( _SC_THREAD_ATTR_STACKSIZE ); - tps = sysconf( _SC_THREAD_PRIORITY_SCHEDULING ); - -#if VERBOSE > 0 - output( "System abilities:\n" ); - output( " TSA: %li\n", tsa ); - output( " TSS: %li\n", tss ); - output( " TPS: %li\n", tps ); - output( " pagesize: %li\n", pagesize ); - output( " min stack size: %li\n", minstacksize ); -#endif - - - if ( minstacksize % pagesize ) - { - UNTESTED( "The min stack size is not a multiple of the page size" ); - } - - for ( i = 0; i < NSCENAR; i++ ) - { -#if VERBOSE > 2 - output( "Initializing attribute for scenario %i: %s\n", i, scenarii[ i ].descr ); -#endif - - ret = pthread_attr_init( &scenarii[ i ].ta ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to initialize a thread attribute object" ); - } - - /* Sched related attributes */ - if ( tps > 0 ) /* This routine is dependent on the Thread Execution Scheduling option */ - { - - if ( scenarii[ i ].explicitsched == 1 ) - ret = pthread_attr_setinheritsched( &scenarii[ i ].ta, PTHREAD_EXPLICIT_SCHED ); - else - ret = pthread_attr_setinheritsched( &scenarii[ i ].ta, PTHREAD_INHERIT_SCHED ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to set inheritsched attribute" ); - } - -#if VERBOSE > 4 - output( "inheritsched state was set sucessfully\n" ); - -#endif - } -#if VERBOSE > 4 - else - output( "TPS unsupported => inheritsched parameter untouched\n" ); - -#endif - - if ( tps > 0 ) /* This routine is dependent on the Thread Execution Scheduling option */ - { - - if ( scenarii[ i ].schedpolicy == 1 ) - { - ret = pthread_attr_setschedpolicy( &scenarii[ i ].ta, SCHED_FIFO ); - } - - if ( scenarii[ i ].schedpolicy == 2 ) - { - ret = pthread_attr_setschedpolicy( &scenarii[ i ].ta, SCHED_RR ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to set the sched policy" ); - } - -#if VERBOSE > 4 - if ( scenarii[ i ].schedpolicy ) - output( "Sched policy was set sucessfully\n" ); - else - output( "Sched policy untouched\n" ); - -#endif - } -#if VERBOSE > 4 - else - output( "TPS unsupported => sched policy parameter untouched\n" ); - -#endif - - if ( scenarii[ i ].schedparam != 0 ) - { - - struct sched_param sp; - - ret = pthread_attr_getschedpolicy( &scenarii[ i ].ta, &old ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to get sched policy from attribute" ); - } - - if ( scenarii[ i ].schedparam == 1 ) - sp.sched_priority = sched_get_priority_max( old ); - - if ( scenarii[ i ].schedparam == -1 ) - sp.sched_priority = sched_get_priority_min( old ); - - ret = pthread_attr_setschedparam( &scenarii[ i ].ta, &sp ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set the sched param" ); - } - -#if VERBOSE > 4 - output( "Sched param was set sucessfully to %i\n", sp.sched_priority ); - } - else - { - output( "Sched param untouched\n" ); -#endif - - } - - if ( tps > 0 ) /* This routine is dependent on the Thread Execution Scheduling option */ - { - ret = pthread_attr_getscope( &scenarii[ i ].ta, &old ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get contension scope from thread attribute" ); - } - - if ( scenarii[ i ].altscope != 0 ) - { - if ( old == PTHREAD_SCOPE_PROCESS ) - old = PTHREAD_SCOPE_SYSTEM; - else - old = PTHREAD_SCOPE_PROCESS; - - ret = pthread_attr_setscope( &scenarii[ i ].ta, old ); - - //if (ret != 0) { UNRESOLVED(ret, "Failed to set contension scope"); } - if ( ret != 0 ) - { - output( "WARNING: The TPS option is claimed to be supported but setscope fails\n" ); - } - -#if VERBOSE > 4 - output( "Contension scope set to %s\n", old == PTHREAD_SCOPE_PROCESS ? "PTHREAD_SCOPE_PROCESS" : "PTHREAD_SCOPE_SYSTEM" ); - } - else - { - output( "Contension scope untouched (%s)\n", old == PTHREAD_SCOPE_PROCESS ? "PTHREAD_SCOPE_PROCESS" : "PTHREAD_SCOPE_SYSTEM" ); -#endif - - } - - } -#if VERBOSE > 4 - else - output( "TPS unsupported => sched contension scope parameter untouched\n" ); - -#endif - - /* Stack related attributes */ - if ( ( tss > 0 ) && ( tsa > 0 ) ) /* This routine is dependent on the Thread Stack Address Attribute - and Thread Stack Size Attribute options */ - { - - if ( scenarii[ i ].altstack != 0 ) - { - /* This is slightly more complicated. We need to alloc a new stack - and free it upon test termination */ - /* We will alloc with a simulated guardsize of 1 pagesize */ - scenarii[ i ].bottom = malloc( minstacksize + pagesize ); - - if ( scenarii[ i ].bottom == NULL ) - { - UNRESOLVED( errno, "Unable to alloc enough memory for alternative stack" ); - } - - ret = pthread_attr_setstack( &scenarii[ i ].ta, scenarii[ i ].bottom, minstacksize ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to specify alternate stack" ); - } - -#if VERBOSE > 1 - output( "Alternate stack created successfully. Bottom=%p, Size=%i\n", scenarii[ i ].bottom, minstacksize ); - -#endif - - } - - } -#if VERBOSE > 4 - else - output( "TSA or TSS unsupported => No alternative stack\n" ); - -#endif - -#ifndef WITHOUT_XOPEN - if ( scenarii[ i ].guard != 0 ) - { - if ( scenarii[ i ].guard == 1 ) - ret = pthread_attr_setguardsize( &scenarii[ i ].ta, 0 ); - - if ( scenarii[ i ].guard == 2 ) - ret = pthread_attr_setguardsize( &scenarii[ i ].ta, pagesize ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to set guard area size in thread stack" ); - } - -#if VERBOSE > 4 - output( "Guard size set to %i\n", ( scenarii[ i ].guard == 1 ) ? 1 : pagesize ); - -#endif - - } - -#endif - - if ( tss > 0 ) /* This routine is dependent on the Thread Stack Size Attribute option */ - { - - if ( scenarii[ i ].altsize != 0 ) - { - ret = pthread_attr_setstacksize( &scenarii[ i ].ta, minstacksize ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to change stack size" ); - } - -#if VERBOSE > 4 - output( "Stack size set to %i (this is the min)\n", minstacksize ); - -#endif - - } - - } -#if VERBOSE > 4 - else - output( "TSS unsupported => stack size unchanged\n" ); - -#endif - - - } - -#if VERBOSE > 0 - output( "All %i thread attribute objects were initialized\n\n", NSCENAR ); - -#endif -} - -/* This function will free all resources consumed in the scenar_init() routine */ -void scenar_fini( void ) -{ - int ret = 0, i; - - for ( i = 0; i < NSCENAR; i++ ) - { - if ( scenarii[ i ].bottom != NULL ) - free( scenarii[ i ].bottom ); - - ret = pthread_attr_destroy( &scenarii[ i ].ta ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy a thread attribute object" ); - } - } -} - -int sc = 0; /* This might be very dirty... but is much simpler */ - -#ifdef STD_MAIN /* We want main to be defined here */ - -extern void * threaded( void *arg ); /* This is the test function */ - -int main ( int argc, char *argv[] ) -{ - int ret = 0; - pthread_t child; - - /* Initialize output routine */ - output_init(); - - /* Initialize thread attribute objects */ - scenar_init(); - - for ( sc = 0; sc < NSCENAR; sc++ ) - { -#if VERBOSE > 0 - output( "-----\n" ); - output( "Starting test with scenario (%i): %s\n", sc, scenarii[ sc ].descr ); -#endif - - ret = pthread_create( &child, &scenarii[ sc ].ta, threaded, NULL ); - - switch ( scenarii[ sc ].result ) - { - case 0: /* Operation was expected to succeed */ - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create this thread" ); - } - - break; - - case 1: /* Operation was expected to fail */ - - if ( ret == 0 ) - { - UNRESOLVED( -1, "An error was expected but the thread creation succeeded" ); - } - - break; - - case 2: /* We did not know the expected result */ - default: -#if VERBOSE > 0 - - if ( ret == 0 ) - { - output( "Thread has been created successfully for this scenario\n" ); - } - else - { - output( "Thread creation failed with the error: %s\n", strerror( ret ) ); - } - -#endif - - } - - if ( ret == 0 ) /* The new thread is running */ - { - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to join a thread" ); - } - - } - } - - scenar_fini(); -#if VERBOSE > 0 - output( "-----\n" ); - output( "All test data destroyed\n" ); - output( "Test PASSED\n" ); -#endif - - PASSED; -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/1-1.c deleted file mode 100644 index 0fff2ac3a9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/1-1.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_key_create() - * - * shall create a thread-specific data key visible to all threaads in the process. Key values - * provided by pthread_key_create() are opaque objects used to locate thread-specific data. - * Although the same key value may be used by different threads, the values bound to the key - * by pthread_setspecific() are maintained on a per-thread basis and persist for the life of - * the calling thread. - * - * Steps: - * 1. Define an array of keys - * 2. Use pthread_key_create() and create those keys - * 3. Verify that you can set and get specific values for those keys without errors. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_KEYS 10 -#define KEY_VALUE 0 - -pthread_key_t keys[NUM_OF_KEYS]; - -int main() -{ - int i; - void* rc; - - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_THREADS 10 -#define KEY_VALUE 1000 -pthread_key_t keys[NUM_OF_THREADS]; -int i; - -/* Thread function that sets the key to KEY_VALUE */ -void *a_thread_func() -{ - /* Set the key to KEY_VALUE */ - if(pthread_setspecific(keys[i], (void *)(KEY_VALUE)) != 0) - { - printf("Error: pthread_setspecific() failed\n"); - pthread_exit((void*)PTS_FAIL); - } - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - void *value_ptr; - - /* Create a key */ - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_key_t key; - void* rc; - - /* Verify that the value associated with "key" in a new thread is NULL */ - rc = pthread_getspecific(key); - if(rc != NULL) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if(pthread_key_create(&key, NULL) != 0) - { - printf("Error: pthread_key_create() failed\n"); - return PTS_UNRESOLVED; - } else - { - /* Verify that the value associated with "key" after it is newly created is - * NULL */ - rc = pthread_getspecific(key); - if(rc != NULL) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/3-1.c deleted file mode 100644 index fae1cc3f12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/3-1.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_key_create() - * - * An optional destructor function may be associated with each key value. At thread exit, if - * a key value has a non-NULL destructor pointer, and the thread has a non-NULL value associated - * with that key, the value of the key is set to NULL, and then the function pointed to is called - * with the previously associated value as its sole argument. The order of destructor calls is - * unspecified if more than one destructor exists for a thread when it exits. - * - * Steps: - * 1. Define an array of keys - * 2. Use pthread_key_create() and create those keys - * 3. Verify that you can set and get specific values for those keys without errors. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define KEY_VALUE 1000 - -pthread_key_t key; -int dest_cnt; - -/* Destructor funciton */ -void dest_func(void *p) -{ - dest_cnt++; -} - -/* Thread function */ -void *a_thread_func() -{ - - /* Set the value of the key to a value */ - if(pthread_setspecific(key, (void *)(KEY_VALUE)) != 0) - { - printf("Error: pthread_setspecific() failed\n"); - pthread_exit((void*) PTS_UNRESOLVED); - } - - /* The thread ends here, the destructor for the key should now be called after this */ - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Inialize the destructor flag */ - dest_cnt = 0; - - /* Create a key with a destructor function */ - if(pthread_key_create(&key, dest_func) != 0) - { - printf("Error: pthread_key_create() failed\n"); - pthread_exit((void*) PTS_UNRESOLVED); - } - - /* Create a thread */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for the thread's return */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check if the destructor was called */ - if(dest_cnt == 0) - { - printf("Test FAILED: Destructor not called\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/assertions.xml deleted file mode 100644 index 4d05f9ed50..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/assertions.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - The function - int pthread_key_create(pthread_key_t *key, void (*destructor(void*)); - - shall create a thread-specific data key visible to all threaads in the process. Key values - provided by pthread_key_create() are opaque objects used to locate thread-specific data. - Although the same key value may be used by different threads, the values bound to the key - by pthread_setspecific() are maintained on a per-thread basis and persist for the life of - the calling thread. - - - - Upon key creation, the value NULL shall be associated with the new key in all active threads. - Upon thread creation, the value NULL shall be associated with all defined keys in the new - thread. - - - - An optional destructor function may be associated with each key value. At thread exit, if - a key value has a non-NULL destructor pointer, and the thread has a non-NULL value associated - with that key, the value of the key is set to NULL, and then the function pointed to is called - with the previously associated value as its sole argument. The order of destructor calls is - unspecified if more than one destructor exists for a thread when it exits. - - - - If, after all the destructors have been called for all non-NULL values with associated - destructors, there are still some non-NULL values with associated destructors, then the - process is repeated. If, after at least (PTHREAD_DESTRUCTOR_ITERATIONS) iterations of - destructor calls for outstanding non-NULL values, there are still some non-NULL values with - associated destructors, implemenations may stop calling destructors or they may continue - calling destructors until no non-NULL values with associated destructors exist, even though - this might result in an infinite loop. - - - - If successful, the pthread_key_create() function shall store the newly created key value - at *key and shall return zero. Otherwise, an error number shall be returned to indicate - an error: - - It shall fail if: - [EAGAIN] - the system lacked the necessary resources to create another thread_specific - data key, or the system imposed limit on the total number of keys per process - [PTHREAD_KEYS_MAX] has been exceeded. - - [ENOMEM] - insufficient memory exists to create the key. - - it shall not return [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/coverage.txt deleted file mode 100644 index 216d23a9f5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/coverage.txt +++ /dev/null @@ -1,10 +0,0 @@ -This document defines the coverage for the pthread_key_create function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO *Will not test -5 NO *Will not test - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/speculative/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/speculative/5-1.c deleted file mode 100644 index cf39dea4ef..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/speculative/5-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_key_create() - * - * If successful, the pthread_key_create() function shall store the newly created key value - * at *key and shall return zero. Otherwise, an error number shall be returned to indicate - * an error: - * - * [EAGAIN] - the system lacked the necessary resources to create another thread_specific - * data key, or the system imposed limit on the total number of keys per process - * [PTHREAD_KEYS_MAX] has been exceeded. - * - * [ENOMEM] - insufficient memory exists to create the key. - * - * TESTING [EAGAIN] - * - * Steps: - * 1. Define an array of keys - * 2. Use pthread_key_create() and create those keys - * 3. Verify that you can set and get specific values for those keys without errors. - * - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int NUM_OF_KEYS = PTHREAD_KEYS_MAX; - -static pthread_key_t keys[NUM_OF_KEYS]; - -int main() -{ - int i, rc; - - for(i = 0;i<=NUM_OF_KEYS;i++) - { - rc = pthread_key_create(&keys[i], NULL); - if(i == NUM_OF_KEYS) - { - if(rc != EAGAIN) - { - printf("Test FAILED: Expected EAGAIN when exceeded the limit of keys in a single process, but got: %d\n", rc); - return PTS_FAIL; - } - } - - if(rc != 0) - { - if(rc != EAGAIN) - { - printf("Error: pthread_key_create() failed\n"); - return PTS_UNRESOLVED; - } else - { - printf("Test FAILED: EAGAIN was returned before the key limit was exceeded\n"); - return PTS_FAIL; - } - } - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/1-1.c deleted file mode 100644 index bda6610fc5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/1-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_key_delete() - * - * Shall delete a thread-specific data key previously returned by pthread_key_create. The - * thread-specific data values specified data values associated with 'key' need not be NULL at - * the time pthread_key_delete is called. It is the responsibility of the application to free - * any application storage or perform any cleanup actions for data structures related to the - * deleted key or associated thread-specific data in any threads; this cleanup can be done - * either before or after pthread_key_delete is called. Any attempt to use 'key' following - * the call to pthread_key_delete results in undefined behavior. - * - * Steps: - * 1. Create many keys, and do not specify and value to them (default is NULL) - * 2. Delete the keys with pthread_key_delete - * 3. Verify that this will not result in an error - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_KEYS 10 - -int main() -{ - pthread_key_t keys[NUM_OF_KEYS]; - int i; - - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_KEYS 10 -#define KEY_VALUE 100 - -int main() -{ - pthread_key_t keys[NUM_OF_KEYS]; - int i; - - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - -#define KEY_VALUE 1000 - -pthread_key_t key; -int dest_cnt; - -/* Destructor funciton */ -void dest_func(void *p) -{ - dest_cnt++; - /* Delete the key and check if an error has occured */ - if(pthread_key_delete(key) != 0) - { - dest_cnt++; - } -} - -/* Thread function */ -void *a_thread_func() -{ - - /* Set the value of the key to a value */ - if(pthread_setspecific(key, (void *)(KEY_VALUE)) != 0) - { - printf("Error: pthread_setspecific() failed\n"); - pthread_exit((void*) PTS_UNRESOLVED); - } - - /* The thread ends here, the destructor for the key should now be called after this */ - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Inialize the destructor flag */ - dest_cnt = 0; - - /* Create a key with a destructor function */ - if(pthread_key_create(&key, dest_func) != 0) - { - printf("Error: pthread_key_create() failed\n"); - pthread_exit((void*) PTS_UNRESOLVED); - } - - /* Create a thread */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for the thread's return */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check if the destructor was called and if the pthread_key_delete function was - * called successfully */ - if(dest_cnt != 1) - { - if(dest_cnt == 0) - { - printf("Error calling the key destructor function\n"); - return PTS_UNRESOLVED; - } else - { - printf("Test FAILED: pthread_key_delete failed to be called from the destructor function\n"); - return PTS_FAIL; - } - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/3-1.sh deleted file mode 100755 index e427779eaa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/3-1.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_key_delete -# -# If successful, it returns zero. - -# This is tested implicitly via assertion 1 & 2. - -echo "Tested implicitly via assertion 1 & 2. See output for status." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/assertions.xml deleted file mode 100644 index 048ad2f0af..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/assertions.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - The function - int pthread_key_delete(pthread_key_t key); - - Shall delete a thread-specific data key previously returned by pthread_key_create. The - thread-specific data values specified data values associated with 'key' need not be NULL at - the time pthread_key_delete is called. It is the responsibility of the application to free - any application storage or perform any cleanup actions for data structures related to the - deleted key or associated thread-specific data in any threads; this cleanup can be done - either before or after pthread_key_delete is called. Any attempt to use 'key' following - the call to pthread_key_delete results in undefined behavior. - - - - pthread_key_delete function shall be callable from within destructor functions. No - destructor functions shall be invoked by pthread_key_delete. Any destructor function - that may have been associated with 'key' shall no longer be called up thread exit. - - - - If successful, it returns zero. It may fail if: - [EINVAL] - The 'key' value is invalid. - it shall not return [EINTR] - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/coverage.txt deleted file mode 100644 index 1d499da0d3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_key_delete function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/1-1.c deleted file mode 100644 index c0608030ac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/1-1.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - This program verifies that the pthread_kill() function requests from the - kernel to deliver a specified signal to a specified thread. - - Using two global values of sem1 (INTHREAD and INMAIN), we are going to - control when we want execution to be in main() and when we want - execution to be a_thread_func(). When the main() function sets sem1 to - INTHREAD and keeps looping until sem1 gets changed back to INMAIN, the - a_thread_func() will be exclusively running. Similarly, when the - a_thread_func() sets sem1 to INMAIN and keeps looping until sem1 gets - changed back to INTHREAD, the main() function will be exclusively - running. - - Steps: - 1. From the main() function, create a new thread. Using the above - methodology, let the new thread run "exclusively." - 2. Inside the new thread, prepare for catching the signal indicated by - SIGTOTEST, and calling a handler that sets handler_called to 1. Now - let the main() thread run "exclusively". - 3. Have main() send the signal indicated by SIGTOTEST to the new thread, - using pthread_kill(). Let the new thread continue running, - and from the main function, wait until handler_called is set to - something other than 0. - 4. In the new thread, if the handler wasn't called for more than 5 - seconds, then set handler_called to -1, otherwise set it to 1. - 5. In either case, the main() function will continue execution and return - a PTS_PASS if handler_called was 1, and a PTS_FAIL if handler_called - was -1. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 -# define INMAIN 1 -# define SIGTOTEST SIGABRT - -int sem1; /* Manual semaphore */ -int handler_called = 0; - -void handler() { - printf("signal was called\n"); - handler_called = 1; - return; -} - -void *a_thread_func() -{ - struct sigaction act; - act.sa_flags = 0; - act.sa_handler = handler; - sigemptyset(&act.sa_mask); - sigaction(SIGTOTEST, &act, 0); - - sem1=INMAIN; - - while(sem1==INMAIN) - sleep(1); - - sleep(5); - - handler_called=-1; - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - sem1=INTHREAD; - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - while(sem1==INTHREAD) - sleep(1); - - if(pthread_kill(new_th, SIGTOTEST) != 0) - { - printf("Test FAILED: Couldn't send signal to thread\n"); - return PTS_FAIL; - } - - sem1=INTHREAD; - - while(handler_called==0) - sleep(1); - - if(handler_called == -1) { - printf("Test FAILED: Kill request timed out\n"); - return PTS_FAIL; - } else if (handler_called == 0) { - printf("Test FAILED: Thread did not recieve or handle\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/1-2.c deleted file mode 100644 index 4f1d056bbc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/1-2.c +++ /dev/null @@ -1,181 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* pthread_kill() sends the specified signal to the specified thread. - - -* The steps are: -* -> set a signal handler -* -> Create a new thread -* -> pthread_kill this thread from the main thread -* -> Wait that the signal handler is called -* -> Check that the correct signal is received in the correct thread - -* The test fails if a bad signal is received or bad thread receives it. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int handler_called = 0; -pthread_t ch; - -/* Signal handler */ -void handler( int sig ) -{ - handler_called = sig; - - if ( !pthread_equal( pthread_self(), ch ) ) - { - FAILED( "The signal handler was not trigged in the killed thread" ); - } -} - -/* Thread function */ -void * threaded( void * arg ) -{ - int rebours = 3; - - /* sleep up to 3 seconds */ - - while ( ( !handler_called ) && ( rebours-- ) ) - sleep( 1 ); - - /* quit */ - return NULL; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - sigaction( SIGUSR2, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Create the child */ - ret = pthread_create( &ch, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a thread" ); - } - - /* kill the child thread */ - ret = pthread_kill( ch, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill child thread" ); - } - - /* Wait for child thread termination */ - ret = pthread_join( ch, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* Check if handler has been trigged inside the child */ - if ( handler_called != SIGUSR2 ) - { - FAILED( "Wrong signal received in thread" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/2-1.c deleted file mode 100644 index b5a83fe313..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/2-1.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that if the signal is the null signal (0), no signal is sent. - * 1) Call pthread_kill on the current thread with the null signal. - * 2) If process is still functional after kill() is called, consider - * the test a pass (most likely no signal was sent). - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_t main_thread; - - main_thread=pthread_self(); - - if (pthread_kill(main_thread, 0) != 0) { - printf("Could not call pthread_kill with sig = 0\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/3-1.c deleted file mode 100644 index 8ccd1bdc4a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/3-1.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the pthread_kill() function shall return 0 upon success. - - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_t main_thread; - - main_thread = pthread_self(); - - if (pthread_kill(main_thread, 0) != 0) { - printf("pthread_kill did not return success.\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/6-1.c deleted file mode 100644 index d6364fd04e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/6-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002-3, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test that the pthread_kill() function shall return ESRCH when no - * thread could be found corresponding to that specified by the given - * thread ID. - * - * NOTE: Cannot find 6-1.c in PTS cvs. So write this one. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void * thread_function(void *arg) -{ - /* Does nothing */ - pthread_exit((void*)0); - - /* To please some compilers */ - return NULL; -} - -int main() -{ - pthread_t child_thread; - pthread_t invalid_tid; - - int rc; - - rc = pthread_create(&child_thread, NULL, - thread_function, NULL); - if (rc != 0) - { - printf("Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - rc = pthread_join(child_thread, NULL); - if (rc != 0) - { - printf("Error at pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Now the child_thread exited, it is an invalid tid */ - memcpy(&invalid_tid, &child_thread, - sizeof(pthread_t)); - - if (pthread_kill(invalid_tid, 0) == ESRCH) { - printf("pthread_kill() returns ESRCH.\n"); - return PTS_PASS; - } - - printf("Test Fail\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/7-1.c deleted file mode 100644 index b651e9301c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/7-1.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that when the null signal is sent to pthread_kill(), error - checking is still performed. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_t main_thread; - - main_thread = pthread_self(); - - if (EINVAL != pthread_kill(main_thread, -1)) { - printf("pthread_kill() did not fail on EINVAL\n"); - return PTS_FAIL; - } - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/8-1.c deleted file mode 100644 index 8b55fc4bb8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/8-1.c +++ /dev/null @@ -1,355 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function does not return EINTR - -* The steps are: -* -> kill a thread which calls pthread_kill -* -> check that EINTR is never returned - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -char do_it = 1; -unsigned long count_ope = 0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig = 0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} - -thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig ( void * arg ) -{ - thestruct * thearg = ( thestruct * ) arg; - int ret; - pid_t process; - - process = getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread" ); - } - - while ( do_it ) - { -#ifdef WITH_SYNCHRO - - if ( ( ret = sem_wait( thearg->sem ) ) ) - { - UNRESOLVED( errno, "Sem_wait in sendsig" ); - } - - count_sig++; -#endif - - ret = kill( process, thearg->sig ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Kill in sendsig" ); - } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig1 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 1" ); - } - -#endif -} - -/* This one is registered for signal SIGUSR2 */ -void sighdl2( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig2 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 2" ); - } - -#endif -} - -int init_ctl; -/* Init function */ -void initializer( void ) -{ - init_ctl++; - return ; -} - - -/* Test function -- calls pthread_kill() and checks that EINTR is never returned. */ -void * test( void * arg ) -{ - int ret = 0; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_UNBLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread" ); - } - - - while ( do_it ) - { - count_ope++; - - ret = pthread_kill( pthread_self(), 0 ); - - if ( ret == EINTR ) - { - FAILED( "pthread_kill returned EINTR" ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_kill returned an unexpected error" ); - } - - ret = pthread_kill( pthread_self(), SIGUSR1 ); - - if ( ret == EINTR ) - { - FAILED( "pthread_kill returned EINTR" ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_kill returned an unexpected error" ); - } - } - - return NULL; -} - -/* Main function */ -int main ( int argc, char * argv[] ) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset ( &sa.sa_mask ); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - - if ( ( ret = sigaction ( SIGUSR1, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler1" ); - } - - sa.sa_handler = sighdl2; - - if ( ( ret = sigaction ( SIGUSR2, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler2" ); - } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset( &usersigs ); - - ret = sigaddset( &usersigs, SIGUSR1 ); - - ret |= sigaddset( &usersigs, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to add SIGUSR1 or 2 to a signal set" ); - } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread" ); - } - -#ifdef WITH_SYNCHRO - if ( sem_init( &semsig1, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig1 init" ); - } - - if ( sem_init( &semsig2, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig2 init" ); - } - -#endif - - if ( ( ret = pthread_create( &th_work, NULL, test, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread creation failed" ); - } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ( ( ret = pthread_create( &th_sig1, NULL, sendsig, ( void * ) & arg1 ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread creation failed" ); - } - - if ( ( ret = pthread_create( &th_sig2, NULL, sendsig, ( void * ) & arg2 ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread creation failed" ); - } - - - - /* Let's wait for a while now */ - sleep( 1 ); - - - /* Now stop the threads and join them */ - do - { - do_it = 0; - } - while ( do_it ); - - - if ( ( ret = pthread_join( th_sig1, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread join failed" ); - } - - if ( ( ret = pthread_join( th_sig2, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread join failed" ); - } - - - if ( ( ret = pthread_join( th_work, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread join failed" ); - } - - -#if VERBOSE > 0 - output( "Test executed successfully.\n" ); - - output( " %d operations.\n", count_ope ); - -#ifdef WITH_SYNCHRO - output( " %d signals were sent meanwhile.\n", count_sig ); - -#endif -#endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/assertions.xml deleted file mode 100644 index 976a5a5898..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/assertions.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - The pthread_kill() function requests from the kernel to deliver a - specified signal be to a specified thread. - - - Just like in the kill() function, error checking shall be performed - but no signal shall actually be sent, if sig is zero. - - - The function shall return a value of zero, upon successful completion. - - - The function shall return an error number otherwise. - - - No signal shall be sent if the pthread_kill() function fails. - - - [ESRCH] No thread could be found corresponding to that specified by - the given thread ID. - - - [EINVAL] The value of the sig argument is an invalid or unsupported - signal number. - - - The pthread_kill () function shall not return an error code of - [EINTR]. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/coverage.txt deleted file mode 100644 index 03dc3d5a71..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This file defines the coverage for the kill() function testing. - -Assertion Status -1 YES -2 YES -3 YES -4 IMPLICITLY tested by assertions 6 and 7. -5 IMPLICITLY tested by assertions 6 and 7. -6 YES -7 YES -8 WON'T test. No way to interrupt the pthread_kill() call. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_kill/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/1-1.c deleted file mode 100644 index 086fbb2dcd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/1-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_destroy() - * shall destroy the mutex referenced by 'mutex'; the mutex object in effect - * becomes uninitialized. - * - */ - -#include -#include -#include "posixtest.h" - -pthread_mutex_t mutex1, mutex2; -pthread_mutex_t mutex3 = PTHREAD_MUTEX_INITIALIZER; - -int main() -{ - pthread_mutexattr_t mta; - int rc; - - /* Initialize a mutex attributes object */ - if((rc=pthread_mutexattr_init(&mta)) != 0) { - fprintf(stderr,"Error at pthread_mutexattr_init(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Initialize mutex1 with the default mutex attributes */ - if((rc=pthread_mutex_init(&mutex1,&mta)) != 0) { - fprintf(stderr,"Fail to initialize mutex1, rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Initialize mutex2 with NULL attributes */ - if((rc=pthread_mutex_init(&mutex2,NULL)) != 0) { - fprintf(stderr,"Fail to initialize mutex2, rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Destroy the mutex attributes object */ - if((rc=pthread_mutexattr_destroy(&mta)) != 0) { - fprintf(stderr,"Error at pthread_mutexattr_destroy(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Destroy mutex1 */ - if((rc=pthread_mutex_destroy(&mutex1)) != 0) { - fprintf(stderr,"Fail to destroy mutex1, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Destroy mutex2 */ - if((rc=pthread_mutex_destroy(&mutex2)) != 0) { - fprintf(stderr,"Fail to destroy mutex2, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Destroy mutex3 */ - if((rc=pthread_mutex_destroy(&mutex3)) != 0) { - fprintf(stderr,"Fail to destroy mutex3, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/2-1.c deleted file mode 100644 index 29107de23a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/2-1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutex_destroy() that - * a destroyed mutex object can be reinitialized using pthread_mutex_init() - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutex_t mutex; - - /* Initialize a mutex attributes object */ - if(pthread_mutex_init(&mutex,NULL) != 0) - { - fprintf(stderr,"Cannot initialize mutex object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy the mutex attributes object */ - if(pthread_mutex_destroy(&mutex) != 0) - { - fprintf(stderr,"Cannot destroy the mutex object\n"); - return PTS_UNRESOLVED; - } - - /* Initialize the mutex attributes object again. This shouldn't result in an error. */ - if(pthread_mutex_init(&mutex,NULL) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/2-2.c deleted file mode 100644 index 0a4f153b09..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/2-2.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, 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. - - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN - -struct _scenar -{ - int m_type; /* Mutex type to use */ - int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_DEFAULT, 0, "Default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 0, "Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, "Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, "Recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, "Pshared mutex"} - ,{PTHREAD_MUTEX_NORMAL, 1, "Pshared Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, "Pshared Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, "Pshared Recursive mutex"} -}; -#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0])) - - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - int i,j; - pthread_mutex_t mtx; - pthread_mutexattr_t ma[NSCENAR + 1]; - pthread_mutexattr_t *pma[NSCENAR + 2]; - long pshared; - - /* Initialize output routine */ - output_init(); - - /* System abilities */ - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - - /* Initialize the mutex attributes objects */ - for (i=0; i 0) && (scenarii[i].m_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma[i], PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - } - } - /* Default mutexattr object */ - ret = pthread_mutexattr_init(&ma[i]); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - - /* Initialize the pointer array */ - for (i=0; i 0 - output("Attributes are ready, proceed to the test\n"); - #endif - - for (i=0; i 1 - char * nul="NULL"; - char * def ="Default"; - char * stri; - char * strj; - if (i 0 - output("Test passed; destroying the test data\n"); - #endif - - for (i=0; i -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutex_t mutex; - int rc; - - /* Initialize a mutex object */ - if((rc=pthread_mutex_init(&mutex,NULL)) != 0) { - fprintf(stderr,"Fail to initialize mutex, rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - if((rc=pthread_mutex_destroy(&mutex)) == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - /* The following error codes are possible, but against assertion 5 */ - else if(rc == EBUSY) { - fprintf(stderr,"Detected an attempt to destroy a mutex in use\n"); - } - else if(rc == EINVAL) { - fprintf(stderr,"The value specified by 'mutex' is invalid\n"); - } - - /* Any other returned value means the test failed */ - else - { - printf("Test FAILED (error: %i)\n", rc); - } - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/5-1.c deleted file mode 100644 index 619954f26a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/5-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_destroy() - * It shall be safe to destroy an initialized mutex that is unlocked. - */ - -#include -#include -#include -#include "posixtest.h" - -pthread_mutex_t mutex; - -int main() -{ - int rc; - - /* Initialize mutex with the default mutex attributes */ - if((rc=pthread_mutex_init(&mutex, NULL)) != 0) { - fprintf(stderr,"Fail to initialize mutex, rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Lock mutex */ - if((rc=pthread_mutex_lock(&mutex)) != 0) { - fprintf(stderr,"Error at pthread_mutex_lock(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - sleep(1); - /* Unlock */ - if((rc=pthread_mutex_unlock(&mutex)) != 0) { - fprintf(stderr,"Error at pthread_mutex_unlock(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - /* Destroy mutex after it is unlocked */ - if((rc=pthread_mutex_destroy(&mutex)) != 0) { - fprintf(stderr,"Fail to destroy mutex after being unlocked, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/5-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/5-2.c deleted file mode 100644 index 8d36db0801..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/5-2.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * It is safe to destroy an initialized unlocked mutex. - - * The steps are: - * -> Initialize a mutex with a given attribute. - * -> Lock the mutex - * -> unlock the mutex - * -> Destroy the mutex -- this shall return 0. - - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN - -struct _scenar -{ - int m_type; /* Mutex type to use */ - int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_DEFAULT, 0, "Default mutex"} - ,{PTHREAD_MUTEX_NORMAL, 0, "Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, "Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, "Recursive mutex"} - - ,{PTHREAD_MUTEX_DEFAULT, 1, "Pshared mutex"} - ,{PTHREAD_MUTEX_NORMAL, 1, "Pshared Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, "Pshared Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, "Pshared Recursive mutex"} -}; -#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0])) - - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - int i; - pthread_mutex_t mtx; - pthread_mutexattr_t ma[NSCENAR + 1]; - pthread_mutexattr_t *pma[NSCENAR + 2]; - long pshared; - - /* Initialize output routine */ - output_init(); - - /* System abilities */ - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - - /* Initialize the mutex attributes objects */ - for (i=0; i 0) && (scenarii[i].m_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma[i], PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - } - } - /* Default mutexattr object */ - ret = pthread_mutexattr_init(&ma[i]); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - - /* Initialize the pointer array */ - for (i=0; i 0 - output("Attributes are ready, proceed to the test\n"); - #endif - - for (i=0; i 1 - char * nul="NULL"; - char * def ="Default"; - char * stri; - if (i 0 - output("Test passed; destroying the test data\n"); - #endif - - for (i=0; i - - The function - - int pthread_mutex_destroy(pthread_mutex_t *mutex); - - destroys the mutex referenced by 'mutex'; the mutex object now becomes - becomes uninitialized. An implementation may cause pthread_mutex_destroy() - to set the object referenced by 'mutex' to an invalid value. - - - A destroyed mutex object can be reinitialized using pthread_mutex_init(); - the results of referencing the object after it has been - destroyed are undefined. - - - Upon success, it returns a 0; - - - pthread_mutex_destroy() may fail if: - - -[EBUSY] The implementation has detected an attempt to destory the - object referenced by 'mutex' while it is locked or referenced. - -[EINVAL] The value specified by 'mutex' is invalid. - - It shall not return [EINTR] - - - It shall be safe to destroy an initialized mutex that is unlocked. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/coverage.txt deleted file mode 100644 index eba046cd38..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/coverage.txt +++ /dev/null @@ -1,12 +0,0 @@ -This document defines the coverage for the pthread_mutex_destroy function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO ** Keeping in mind it 'may' fail and not 'shall' fail, - so it will always return PASS, but will return a - PASS and print out a warning if it fails. - ** EBUSY is tested -5 YES -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/speculative/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/speculative/4-2.c deleted file mode 100644 index dce286c849..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/speculative/4-2.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2004, QUALCOMM Inc. All rights reserved. - * Created by: abisain REMOVE-THIS AT qualcomm DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that when a pthread_mutex_destroy is called on a - * locked mutex, it fails and returns EBUSY - - * Steps: - * 1. Create a mutex - * 2. Lock the mutex - * 3. Try to destroy the mutex - * 4. Check that this may fail with EBUSY - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-2" -#define FUNCTION "pthread_mutex_destroy" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -int main() -{ - pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - int rc = 0; - - /* Lock the mutex */ - rc = pthread_mutex_lock(&mutex); - if(rc != 0) { - perror(ERROR_PREFIX "pthread_mutex_lock\n"); - exit(PTS_UNRESOLVED); - } - - /* Try to destroy the locked mutex */ - rc = pthread_mutex_destroy(&mutex); - if(rc != EBUSY) { - printf(ERROR_PREFIX "Test PASS: Expected %d(EBUSY) got %d, " - "though the standard states 'may' fail\n", EBUSY, rc); - exit(PTS_PASS); - } - printf("Test PASS\n"); - exit(PTS_PASS); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_destroy/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c deleted file mode 100644 index d9251e6522..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_getprioceiling() - * - * returns the current prioceiling of the mutex. - * - * Steps:i - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Call pthread_mutex_getprioceiling() to obtain the prioceiling. - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is prioceiling capability. */ - /* #ifndef _POSIX_PRIORITY_SCHEDULING - fprintf(stderr,"prioceiling attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif */ - - pthread_mutex_t mutex; - int prioceiling, max_prio, min_prio; - - /* Initialize a mutex object */ - if(pthread_mutex_init(&mutex, NULL) != 0) - { - perror("Error at pthread_mutex_init()\n"); - return PTS_UNRESOLVED; - } - - /* Get the prioceiling of the mutex. */ - if(pthread_mutex_getprioceiling(&mutex, &prioceiling) != 0) - { - printf("Test FAILED: Error obtaining the priority ceiling\n"); - return PTS_FAIL; - } - - /* Get the max and min prio according to SCHED_FIFO (posix scheduling policy) */ - max_prio = sched_get_priority_max(SCHED_FIFO); - min_prio = sched_get_priority_min(SCHED_FIFO); - - /* Make sure that prioceiling is withing the legal SCHED_FIFO boundries. */ - if((prioceiling < min_prio) || (prioceiling > max_prio)) - { - printf("Test FAILED: Default prioceiling %d is not compliant with SCHED_FIFO boundry. \n", prioceiling); - return PTS_FAIL; - } - - printf("Test PASSED: Prioceiling %d\n", prioceiling); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_getprioceiling/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_getprioceiling/assertions.xml deleted file mode 100644 index 48e7177d09..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_getprioceiling/assertions.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - The function - - int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *restrict mutex, - int *restrict prioceiling); - - returns the current prioceiling of the mutex. - - - Upon success, it returns 0, and stores the value of the prioceiling in 'prioceiling'. - - - It MAY fail if: - - [EINVAL] - The priority requested by 'prioceiling' is out of range - [EINVAL] - 'mutex' doesn't refer to an existing mutex - [EPERM] - The caller doesn't have the privilege to perform the operation. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_getprioceiling/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_getprioceiling/coverage.txt deleted file mode 100644 index d4bd4c1485..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_getprioceiling/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_mutex_getprioceiling function: - -Assertion Tested? -1 YES -2 NO -3 NO - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/1-1.c deleted file mode 100644 index 94402448c1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/1-1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_init() - * initializes a mutex referenced by 'mutex' with attributes specified - * by 'attr'. If 'attr' is NULL, the default mutex attributes are used. - * The effect shall be the same as passing the address of a default - * mutex attributes. - - * NOTE: There is no direct way to judge if two mutexes have the same effect, - * thus this test does not cover the statement in the last sentence. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - pthread_mutex_t mutex1, mutex2; - int rc; - - /* Initialize a mutex attributes object */ - if((rc=pthread_mutexattr_init(&mta)) != 0) { - fprintf(stderr,"Error at pthread_mutexattr_init(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Initialize mutex1 with the default mutex attributes */ - if((rc=pthread_mutex_init(&mutex1,&mta)) != 0) { - fprintf(stderr,"Fail to initialize mutex1, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Initialize mutex2 with NULL attributes */ - if((rc=pthread_mutex_init(&mutex2,NULL)) != 0) { - fprintf(stderr,"Fail to initialize mutex2, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/1-2.c deleted file mode 100644 index e585c4612b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/1-2.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, 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 error code? - * -> Is an error 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. - */ - - /* - * - adam.li@intel.com 2004-05-09 - * Add to PTS. Please refer to http://nptl.bullopensource.org/phpBB/ - * for general information - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/**** global variables ****/ -pthread_mutex_t * p_mtx; -int retval = 0; -int returned = 0; -int canceled = 0; -sem_t semA, semB; - -/***** Cancelation handlers *****/ -void cleanup_deadlk(void * arg) -{ - canceled = 1; - pthread_mutex_unlock(p_mtx); -} - -/***** Threads functions *****/ -void * deadlk_issue(void * arg) -{ - int ret, tmp; - - if ((ret=pthread_mutex_lock(p_mtx))) - { UNRESOLVED(ret, "First mutex lock in deadlk_issue"); } - pthread_cleanup_push(cleanup_deadlk, NULL); - if ((ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &tmp))) - { UNRESOLVED(ret, "Set cancel type in deadlk_issue"); } - if ((ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &tmp))) - { UNRESOLVED(ret, "Set cancel state in deadlk_issue"); } - #if VERBOSE >1 - output("Thread releases the semaphore...\n"); - #endif - if ((ret = sem_post(&semA))) - { UNRESOLVED(errno, "Sem_post in deadlk_issue"); } - - returned = 0; - retval = pthread_mutex_lock(p_mtx); - returned = 1; - - if ((ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &tmp))) - { UNRESOLVED(ret, "Set cancel state in deadlk_issue"); } - pthread_cleanup_pop(0); - return NULL; -} - -void * unlock_issue(void * arg) -{ - int ret; - - #if VERBOSE >1 - output("Locking in child...\n"); - #endif - if ((ret=pthread_mutex_lock(p_mtx))) - { UNRESOLVED(ret, "First mutex lock in unlock_issue"); } - - if ((ret = sem_post(&semA))) - { UNRESOLVED(errno, "Sem_post in unlock_issue"); } - - if ((ret = sem_wait(&semB))) - { UNRESOLVED(errno, "Sem_wait in unlock_issue"); } - - if (retval != 0) /* parent thread failed to unlock the mutex) */ - { - #if VERBOSE >1 - output("Unlocking in child...\n"); - #endif - if ((ret=pthread_mutex_unlock(p_mtx))) - { FAILED("Mutex unlock returned an error but mutex is unlocked."); } - } - - return NULL; -} - - -/***** main program *****/ -int main(int argc, char *argv[]) -{ - pthread_mutex_t mtx_null, mtx_def; - pthread_mutexattr_t mattr; - pthread_t thr; - - pthread_mutex_t * tab_mutex[2]={&mtx_null, &mtx_def}; - int tab_res[2][3]={{0,0,0},{0,0,0}}; - - int ret; - void * th_ret; - - int i; - - output_init(); - - #if VERBOSE >1 - output("Test starting...\n"); - #endif - - /* We first initialize the two mutexes. */ - if ((ret=pthread_mutex_init(&mtx_null, NULL))) - { UNRESOLVED(ret, "NULL mutex init"); } - - if ((ret=pthread_mutexattr_init(&mattr))) - { UNRESOLVED(ret, "Mutex attribute init"); } - if ((ret=pthread_mutex_init(&mtx_def, &mattr))) - { UNRESOLVED(ret, "Default attribute mutex init"); } - - if ((ret=pthread_mutexattr_destroy(&mattr))) - { UNRESOLVED(ret, "Mutex attribute destroy"); } - - - if ((ret=sem_init(&semA, 0, 0))) - { UNRESOLVED(errno, "Sem A init"); } - if ((ret=sem_init(&semB, 0, 0))) - { UNRESOLVED(errno, "Sem B init"); } - - #if VERBOSE >1 - output("Data initialized...\n"); - #endif - - - /* OK let's go for the first part of the test : abnormals unlocking */ - - /* We first check if unlocking an unlocked mutex returns an error. */ - retval = pthread_mutex_unlock(tab_mutex[0]); - ret = pthread_mutex_unlock(tab_mutex[1]); - #if VERBOSE >0 - output("Results for unlock issue #1:\n mutex 1 unlocking returned %i\n mutex 2 unlocking returned %i\n", - retval, ret); - #endif - if (ret != retval) - { - FAILED("Unlocking an unlocked mutex behaves differently."); - } - - /* Now we focus on unlocking a mutex lock by another thread */ - for (i=0; i<2; i++) - { - p_mtx = tab_mutex[i]; - tab_res[i][0]=0; - tab_res[i][1]=0; - tab_res[i][2]=0; - - #if VERBOSE >1 - output("Creating thread (unlock)...\n"); - #endif - - if ((ret = pthread_create(&thr, NULL, unlock_issue, NULL))) - { UNRESOLVED(ret, "Unlock issue thread create"); } - - if ((ret = sem_wait(&semA))) - { UNRESOLVED(errno, "Sem A wait failed for unlock issue."); } - - #if VERBOSE >1 - output("Unlocking in parent...\n"); - #endif - retval = pthread_mutex_unlock(p_mtx); - - if ((ret = sem_post(&semB))) - { UNRESOLVED(errno, "Sem B post failed for unlock issue."); } - - if ((ret=pthread_join(thr, &th_ret))) - { UNRESOLVED(ret, "Join thread"); } - - #if VERBOSE >1 - output("Thread joined successfully...\n"); - #endif - - tab_res[i][0] = retval; - } - #if VERBOSE >0 - output("Results for unlock issue #2:\n mutex 1 returned %i\n mutex 2 returned %i\n", - tab_res[0][0],tab_res[1][0]); - #endif - - if (tab_res[0][0] != tab_res[1][0]) - { - FAILED("Unlocking an unowned mutex behaves differently."); - } - - - /* We now are going to test the deadlock issue - */ - - /* We start with testing the NULL mutex features */ - for (i=0; i<2; i++) - { - p_mtx = tab_mutex[i]; - tab_res[i][0]=0; - tab_res[i][1]=0; - tab_res[i][2]=0; - - #if VERBOSE >1 - output("Creating thread (deadlk)...\n"); - #endif - - if ((ret = pthread_create(&thr, NULL, deadlk_issue, NULL))) - { UNRESOLVED(ret, "Deadlk_issue thread create"); } - - /* Now we are waiting the thread is ready to relock the mutex. */ - if ((ret=sem_wait(&semA))) - { UNRESOLVED(errno, "Sem wait"); } - - /* To ensure thread runs until second lock, we yield here */ - sched_yield(); - - /* OK, now we cancel the thread */ - canceled=0; - #if VERBOSE >1 - output("Cancel thread...\n"); - #endif - if (returned ==0) - if ((ret=pthread_cancel(thr))) - { UNRESOLVED(ret, "Cancel thread (deadlk_issue)"); } - - #if VERBOSE >1 - output("Thread canceled...\n"); - #endif - - if ((ret=pthread_join(thr, &th_ret))) - { UNRESOLVED(ret, "Join thread"); } - - #if VERBOSE >1 - output("Thread joined successfully...\n"); - #endif - - tab_res[i][2] = retval; - tab_res[i][1] = returned; - tab_res[i][0] = canceled; - } - - /* Now we parse the results */ - #if VERBOSE >0 - output("Results for deadlock issue:\n mutex 1 \t%s\t%s%i\n mutex 2 \t%s\t%s%i\n", - tab_res[0][0]?"deadlock" : "no deadlock", - tab_res[0][1]?"returned " : "did not return ", - tab_res[0][2], - tab_res[1][0]?"deadlock" : "no deadlock", - tab_res[1][1]?"returned " : "did not return ", - tab_res[1][2]); - #endif - - if (tab_res[0][0] != tab_res[1][0]) - { FAILED("One mutex deadlocks, not the other"); } - - if (tab_res[0][1] != tab_res[1][1]) - { UNRESOLVED(tab_res[0][1], "Abnormal situation!"); } - - if ((tab_res[0][1] == 1) && (tab_res[0][2] != tab_res[1][2])) - { FAILED("The locks returned different error codes."); } - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/2-1.c deleted file mode 100644 index ae66fd7005..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/2-1.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_init() - * Upon successful initialization, the state of the mutex becomes - * initialized and unlocked. - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutex_t mutex; - int rc; - - /* Initialize a mutex object */ - if((rc=pthread_mutex_init(&mutex,NULL)) != 0) { - fprintf(stderr,"Fail to initialize mutex, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Acquire the mutex object using pthread_mutex_lock */ - if((rc=pthread_mutex_lock(&mutex)) != 0) { - fprintf(stderr,"Fail to lock the mutex, rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - fprintf(stderr,"Main: hold the mutex for a while\n"); - sleep(1); - - /* Release the mutex object using pthread_mutex_unlock */ - if((rc=pthread_mutex_unlock(&mutex)) != 0) { - fprintf(stderr,"Fail to unlock the mutex, rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Destory the mutex object */ - if((rc=pthread_mutex_destroy(&mutex)) != 0) { - fprintf(stderr,"Fail to destory the mutex, rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/3-1.c deleted file mode 100644 index 36bd10d944..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/3-1.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the macro PTHREAD_MUTEX_INITIALIZER can be sued to intiailize - * mutexes that are statically allocated. - * - */ - -#include -#include -#include -#include "posixtest.h" - -typedef struct my_data { - pthread_mutex_t mutex; /* Protects access to value */ - int value; /* Access protected by mutex */ -} my_data_t; - -my_data_t data = {PTHREAD_MUTEX_INITIALIZER, 0}; - -int main() -{ - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/3-2.c deleted file mode 100644 index 7f04afb7a8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/3-2.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This sample test aims to check the following assertion: - * - * The macro PTHREAD_MUTEX_INITIALIZER can be used - * to initialize mutexes that are statically allocated. - * The effect are equivalent to dynamic initialization by a call to - * pthread_mutex_init() with parameter attr specified as NULL, - * except that no error checks are performed. - * - * The steps are: - * * create two mutexes. One is initialized with NULL attribute, - * the other is statically initialized with the macro PTHREAD_MUTEX_INITIALIZER. - * * 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 error code? - * -> Is an error 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. - */ - - /* - * - adam.li@intel.com 2004-05-09 - * Add to PTS. Please refer to http://nptl.bullopensource.org/phpBB/ - * for general information - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/**** global variables ****/ -pthread_mutex_t * p_mtx; -int retval = 0; -int returned = 0; -int canceled = 0; -sem_t semA, semB; - -/***** Cancelation handlers *****/ -void cleanup_deadlk(void * arg) -{ - canceled = 1; - pthread_mutex_unlock(p_mtx); -} - -/***** Threads functions *****/ -void * deadlk_issue(void * arg) -{ - int ret, tmp; - - if ((ret=pthread_mutex_lock(p_mtx))) - { UNRESOLVED(ret, "First mutex lock in deadlk_issue"); } - pthread_cleanup_push(cleanup_deadlk, NULL); - if ((ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &tmp))) - { UNRESOLVED(ret, "Set cancel type in deadlk_issue"); } - if ((ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &tmp))) - { UNRESOLVED(ret, "Set cancel state in deadlk_issue"); } - #if VERBOSE >1 - output("Thread releases the semaphore...\n"); - #endif - if ((ret = sem_post(&semA))) - { UNRESOLVED(errno, "Sem_post in deadlk_issue"); } - - returned = 0; - retval = pthread_mutex_lock(p_mtx); - returned = 1; - - if ((ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &tmp))) - { UNRESOLVED(ret, "Set cancel state in deadlk_issue"); } - pthread_cleanup_pop(0); - return NULL; -} - -void * unlock_issue(void * arg) -{ - int ret; - - #if VERBOSE >1 - output("Locking in child...\n"); - #endif - if ((ret=pthread_mutex_lock(p_mtx))) - { UNRESOLVED(ret, "First mutex lock in unlock_issue"); } - - if ((ret = sem_post(&semA))) - { UNRESOLVED(errno, "Sem_post in unlock_issue"); } - - if ((ret = sem_wait(&semB))) - { UNRESOLVED(errno, "Sem_wait in unlock_issue"); } - - if (retval != 0) /* parent thread failed to unlock the mutex) */ - { - #if VERBOSE >1 - output("Unlocking in child...\n"); - #endif - if ((ret=pthread_mutex_unlock(p_mtx))) - { FAILED("Mutex unlock returned an error but mutex is unlocked."); } - } - - return NULL; -} - - -/***** main program *****/ -int main(int argc, char *argv[]) -{ - pthread_mutex_t mtx_null, - mtx_macro = PTHREAD_MUTEX_INITIALIZER; - pthread_t thr; - - pthread_mutex_t * tab_mutex[2]={&mtx_null, &mtx_macro}; - int tab_res[2][3]={{0,0,0},{0,0,0}}; - - int ret; - void * th_ret; - - int i; - - output_init(); - #if VERBOSE >1 - output("Test starting...\n"); - #endif - - /* We first initialize the two mutexes. */ - if ((ret=pthread_mutex_init(&mtx_null, NULL))) - { UNRESOLVED(ret, "NULL mutex init"); } - - - if ((ret=sem_init(&semA, 0, 0))) - { UNRESOLVED(errno, "Sem A init"); } - if ((ret=sem_init(&semB, 0, 0))) - { UNRESOLVED(errno, "Sem B init"); } - - #if VERBOSE >1 - output("Data initialized...\n"); - #endif - - - /* OK let's go for the first part of the test : abnormals unlocking */ - - /* We first check if unlocking an unlocked mutex returns an error. */ - retval = pthread_mutex_unlock(tab_mutex[0]); - ret = pthread_mutex_unlock(tab_mutex[1]); - #if VERBOSE >0 - output("Results for unlock issue #1:\n mutex 1 unlocking returned %i\n mutex 2 unlocking returned %i\n", - retval, ret); - #endif - if (ret != retval) - { - FAILED("Unlocking an unlocked mutex behaves differently."); - } - - /* Now we focus on unlocking a mutex lock by another thread */ - for (i=0; i<2; i++) - { - p_mtx = tab_mutex[i]; - tab_res[i][0]=0; - tab_res[i][1]=0; - tab_res[i][2]=0; - - #if VERBOSE >1 - output("Creating thread (unlock)...\n"); - #endif - - if ((ret = pthread_create(&thr, NULL, unlock_issue, NULL))) - { UNRESOLVED(ret, "Unlock issue thread create"); } - - if ((ret = sem_wait(&semA))) - { UNRESOLVED(errno, "Sem A wait failed for unlock issue."); } - - #if VERBOSE >1 - output("Unlocking in parent...\n"); - #endif - retval = pthread_mutex_unlock(p_mtx); - - if ((ret = sem_post(&semB))) - { UNRESOLVED(errno, "Sem B post failed for unlock issue."); } - - if ((ret=pthread_join(thr, &th_ret))) - { UNRESOLVED(ret, "Join thread"); } - - #if VERBOSE >1 - output("Thread joined successfully...\n"); - #endif - - tab_res[i][0] = retval; - } - #if VERBOSE >0 - output("Results for unlock issue #2:\n mutex 1 returned %i\n mutex 2 returned %i\n", - tab_res[0][0],tab_res[1][0]); - #endif - - if (tab_res[0][0] != tab_res[1][0]) - { - FAILED("Unlocking an unowned mutex behaves differently."); - } - - - /* We now are going to test the deadlock issue - */ - - /* We start with testing the NULL mutex features */ - for (i=0; i<2; i++) - { - p_mtx = tab_mutex[i]; - tab_res[i][0]=0; - tab_res[i][1]=0; - tab_res[i][2]=0; - - #if VERBOSE >1 - output("Creating thread (deadlk)...\n"); - #endif - - if ((ret = pthread_create(&thr, NULL, deadlk_issue, NULL))) - { UNRESOLVED(ret, "Deadlk_issue thread create"); } - - /* Now we are waiting the thread is ready to relock the mutex. */ - if ((ret=sem_wait(&semA))) - { UNRESOLVED(errno, "Sem wait"); } - - /* To ensure thread runs until second lock, we yield here */ - sched_yield(); - - /* OK, now we cancel the thread */ - canceled=0; - #if VERBOSE >1 - output("Cancel thread...\n"); - #endif - if (returned ==0) - if ((ret=pthread_cancel(thr))) - { UNRESOLVED(ret, "Cancel thread (deadlk_issue)"); } - - #if VERBOSE >1 - output("Thread canceled...\n"); - #endif - - if ((ret=pthread_join(thr, &th_ret))) - { UNRESOLVED(ret, "Join thread"); } - - #if VERBOSE >1 - output("Thread joined successfully...\n"); - #endif - - tab_res[i][2] = retval; - tab_res[i][1] = returned; - tab_res[i][0] = canceled; - } - - /* Now we parse the results */ - #if VERBOSE >0 - output("Results for deadlock issue:\n mutex 1 \t%s\t%s%i\n mutex 2 \t%s\t%s%i\n", - tab_res[0][0]?"deadlock" : "no deadlock", - tab_res[0][1]?"returned " : "did not return ", - tab_res[0][2], - tab_res[1][0]?"deadlock" : "no deadlock", - tab_res[1][1]?"returned " : "did not return ", - tab_res[1][2]); - #endif - - if (tab_res[0][0] != tab_res[1][0]) - { FAILED("One mutex deadlocks, not the other"); } - - if (tab_res[0][1] != tab_res[1][1]) - { UNRESOLVED(tab_res[0][1], "Abnormal situation!"); } - - if ((tab_res[0][1] == 1) && (tab_res[0][2] != tab_res[1][2])) - { FAILED("The locks returned different error codes."); } - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/4-1.c deleted file mode 100644 index 08131b0d36..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/4-1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_init() - * Upon succesful completion, it shall return a 0 - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - pthread_mutex_t mutex; - int rc; - - /* Initialize a mutex attributes object */ - if((rc=pthread_mutexattr_init(&mta)) != 0) { - fprintf(stderr,"Error at pthread_mutexattr_init(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Initialize a mutex object with the default mutex attributes */ - if((rc=pthread_mutex_init(&mutex,&mta)) == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - /* Check if returned values are tolerable */ - else if(rc == ENOMEM) { - fprintf(stderr,"Insufficient memory to initialize the mutex\n"); - return PTS_UNRESOLVED; - } - else if(rc == EAGAIN) { - fprintf(stderr,"Lack of the necessary resources to initilize the mutex\n"); - return PTS_UNRESOLVED; - } - else if(rc == EPERM) { - fprintf(stderr,"Permission denied\n"); - return PTS_UNRESOLVED; - } - else if(rc == EBUSY) { - fprintf(stderr,"Detected an attemp to reinitilize a previously initilized mutex\n"); - return PTS_UNRESOLVED; - } - - /* Any other returned value means the test failed */ - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/5-1.c deleted file mode 100644 index 212008e224..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/5-1.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This sample test aims to check the following assertion: - * The function fails and returns ENOMEM if there is not enough memory. - - - - * The steps are: - * * Fork - * * New process sets its memory resource limit to a minimum value, then - * -> Allocate all the available memory - * -> call pthread_mutex_init() - * -> free the memory - * -> Checks that pthread_mutex_init() returned 0 or ENOMEM. - * * Parent process waits for the child. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the setrlimit() function from X/OPEN standard */ - #ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -int main(int argc, char * argv[]) -{ - pid_t child; - - - pthread_mutex_t mtx; - pthread_mutexattr_t ma[4]; - pthread_mutexattr_t *pma[5]; - - int ret=0; - int i; - int retini[5] = {-1,-1,-1,-1,-1}; - int retdtr[5]= {-1,-1,-1,-1,-1}; - - void * ptr, *ptr_prev=NULL; - - int sz = 0; - struct rlimit rl; - - int status=0; - - output_init(); - - child = fork(); - - if (child == (pid_t)-1) - { UNRESOLVED(errno, "Fork failed"); } - - if (child != 0) /* We are the father */ - { - if (child != waitpid(child, &status, 0)) - { UNRESOLVED(errno, "Waitpid failed"); } - - if (WIFSIGNALED(status)) - { UNRESOLVED(WTERMSIG(status), - "The child process was killed."); } - - if (WIFEXITED(status)) - return WEXITSTATUS(status); - - UNRESOLVED(0, "Child process neither returned nor was killed."); - } - - /* Only the child goes further */ - - /* We initialize the different mutex attributes */ - for (i=0; (i<4) && (ret == 0); i++) - { - pma[i] = &ma[i]; - ret = pthread_mutexattr_init(pma[i]); - } - if (ret) - { UNRESOLVED(ret, "Mutex attribute init failed"); } - pma[4] = (pthread_mutexattr_t *) NULL; - - if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_NORMAL))) - { UNRESOLVED(ret, "Mutex attribute NORMAL failed"); } - if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_DEFAULT))) - { UNRESOLVED(ret, "Mutex attribute DEFAULT failed"); } - if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_RECURSIVE))) - { UNRESOLVED(ret, "Mutex attribute RECURSIVE failed"); } - if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_ERRORCHECK))) - { UNRESOLVED(ret, "Mutex attribute ERRORCHECK failed"); } - - sz = sysconf(_SC_PAGESIZE); - - - /* Limit the process memory to a small value (64Mb for example). */ - rl.rlim_max=1024*1024*64; - rl.rlim_cur=1024*1024*64; - if ((ret = setrlimit(RLIMIT_AS, &rl))) - { UNRESOLVED(ret, "Memory limitation failed"); } - - - #if VERBOSE > 1 - output("Ready to take over memory. Page size is %d\n", sz); - #endif - - /* Allocate all available memory */ - while (1) - { - ptr = malloc( sz ); /* Allocate one page of memory */ - if (ptr == NULL) - break; - #if VERBOSE > 1 - ret++; - #endif - *(void **)ptr = ptr_prev; /* Write into the allocated page */ - ptr_prev = ptr; - } - #if VERBOSE > 1 - output("%d pages were allocated before failure\n", ret); - ret = 0; - #endif - - while (1) - { - ptr = malloc( sizeof(void*) ); /* Allocate every remaining bits of memory */ - if (ptr == NULL) - break; - #if VERBOSE > 1 - ret++; - #endif - *(void **)ptr = ptr_prev; /* Keep track of allocated memory */ - ptr_prev = ptr; - } - #if VERBOSE > 1 - output("%d additional spaces were allocated before failure\n", ret); - ret = 0; - #endif - if (errno != ENOMEM) - UNRESOLVED(errno, "Memory not full"); - - /* Now that memory is full, we try to initialize a mutex */ - for (i=0; i<5; i++) - { - retini[i] = pthread_mutex_init(&mtx, pma[i]); - if (!retini[i]) /* If mutex has been initialized, we destroy it */ - retdtr[i] = pthread_mutex_destroy(&mtx); - } - - /* We can now free the memory */ - while (ptr_prev != NULL) - { - ptr = ptr_prev; - ptr_prev = *(void **)ptr; - free(ptr); - } - - #if VERBOSE > 1 - output("Memory is released\n"); - #endif - - for (i=0; i<4; i++) - pthread_mutexattr_destroy(pma[i]); - - - for (i=0; i<5; i++) - { - if (retini[i] != 0 && retini[i] !=ENOMEM) - { FAILED("Mutex init returned a wrong error code when no memory was left"); } - - if (retini[i] == 0) - { - #if VERBOSE > 0 - output("Mutex initialization for attribute %d succeeds when memory is full\n", i); - #endif - if (retdtr[i] != 0) - { UNRESOLVED( retdtr[i], "Mutex destroy failed on mutex inilialized under heavy loaded memory"); } - } - #if VERBOSE > 0 - else - { - output("Mutex initialization for attribute %d fails with ENOMEM when memory is full\n", i); - } - #endif - } - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/5-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/5-3.c deleted file mode 100644 index 5ff9eaf143..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/5-3.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This sample test aims to check the following assertion: - * The function does not return an error code of EINTR - - - * The steps are: - * - * -> Create a thread which loops on pthread_mutex_init and pthread_mutex_destroy - * operations. - * -> Create another thread which loops on sending a signal to the first thread. - * - * - */ - - /* - adam.li@intel.com 2004.05.08 - * Add to PTS. Please refer to http://nptl.bullopensource.org/phpBB/ - * for general information - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We enable the following line to have mutex attributes defined */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#define WITH_SYNCHRO -#ifndef VERBOSE -#define VERBOSE 2 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -char do_it=1; -unsigned long count_ope=0; -pthread_mutex_t count_protect = PTHREAD_MUTEX_INITIALIZER; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif -sem_t semsync; - -typedef struct -{ - pthread_t *thr; - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -/* the following function keeps on sending the signal to the thread pointed by arg - * If WITH_SYNCHRO is defined, the target thread has a handler for the signal */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - if ((ret = pthread_kill (*(thearg->thr), thearg->sig))) - { UNRESOLVED(ret, "Pthread_kill in sendsig"); } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* The following function loops on init/destroy some mutex (with different attributes) - * it does check that no error code of EINTR is returned */ - -void * threaded(void * arg) -{ - pthread_mutexattr_t ma[4], *pma[5]; - pthread_mutex_t m[5]; - int i; - int ret; - - /* We need to register the signal handlers */ - struct sigaction sa; - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* Initialize the different mutex attributes */ - pma[4]=NULL; - - for (i=0; i<4; i++) - { - pma[i]=&ma[i]; - if ((ret = pthread_mutexattr_init(pma[i]))) - { UNRESOLVED(ret, "pthread_mutexattr_init"); } - } - - #ifndef WITHOUT_XOPEN - if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_NORMAL))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (normal)"); } - if ((ret = pthread_mutexattr_settype(pma[1], PTHREAD_MUTEX_ERRORCHECK))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (errorcheck)"); } - if ((ret = pthread_mutexattr_settype(pma[2], PTHREAD_MUTEX_RECURSIVE))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (recursive)"); } - if ((ret = pthread_mutexattr_settype(pma[3], PTHREAD_MUTEX_DEFAULT))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (default)"); } - #if VERBOSE >1 - output("Mutex attributes NORMAL,ERRORCHECK,RECURSIVE,DEFAULT initialized\n"); - #endif - #else - #if VERBOSE > 0 - output("Mutex attributes NORMAL,ERRORCHECK,RECURSIVE,DEFAULT unavailable\n"); - #endif - #endif - - /* We are ready to proceed */ - while (do_it) - { - for (i=0; i<5; i++) - { - ret = pthread_mutex_init(&m[i], pma[i]); - if (ret == EINTR) - { - FAILED("pthread_mutex_init returned EINTR"); - } - if (ret != 0) - { - UNRESOLVED(ret, "pthread_mutex_init failed"); - } - ret = pthread_mutex_destroy(&m[i]); - if (ret == EINTR) - { - FAILED("pthread_mutex_destroy returned EINTR"); - } - if (ret != 0) - { - UNRESOLVED(ret, "pthread_mutex_destroy failed"); - } - pthread_mutex_lock(&count_protect); - count_ope++; - pthread_mutex_unlock(&count_protect); - } - } - - /* Now we can destroy the mutex attributes objects */ - for (i=0; i<4; i++) - { - if ((ret = pthread_mutexattr_destroy(pma[i]))) - { UNRESOLVED(ret, "pthread_mutexattr_init"); } - } - - do { - ret = sem_wait(&semsync); - } while (ret && (errno == EINTR)); - if (ret) - { UNRESOLVED(errno, "Could not wait for sig senders termination"); } - - return NULL; -} - -/* At last (but not least) we need a main */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - - output_init(); - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - if (sem_init(&semsync, 0, 0)) - { UNRESOLVED(errno, "semsync init"); } - - if ((ret = pthread_create(&th_work, NULL, threaded, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.thr = &th_work; - arg2.thr = &th_work; - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - /* Let's wait for a while now */ - sleep(1); - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - - if (sem_post(&semsync)) - { UNRESOLVED(errno, "could not post semsync"); } - - if ((ret = pthread_join(th_work, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" %d mutex initialization and destruction were done.\n", count_ope); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/assertions.xml deleted file mode 100644 index b295947ca9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/assertions.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - The function - - int pthread_mutex_init(pthread_mutex_t *restrict mutex, - const pthread_mutexattr_t *restrict attr); - - pthread_mutex_t = PHTREAD_MUTEX_INITIALIZER - - initializes a mutex referenced by 'mutex' with attributes specified by - 'attr'. If 'attr' is NULL, the default mutex attributes are used. The - effect shall be the same as passing the address of a default mutex attributes - object. - - - Upon successful initialization, the state of the mutex becomes initialized - and unlocked. Attempting to initialize an already intialized mutex - results in undefined behavior. - - - In cases where default mutex attributes are appropriate, the macro - PTHREAD_MUTEX_INITIALIZER can be used to intiailize mutexes that are - statically allocated. The effect shall be equivilant to dynamic - intialization by a call to pthread_mutex_init() with paramter 'attr' - specified as NULL, except that no error checks are performed. - - - Upon success, it returns a 0; - - - It SHALL fail if: - - -[EAGAIN] The system lacked the neccessary resources (other than memory) - to intialize another mutex. - -[ENOMEM] Insufficient memory exists to initialize the mutex. - -[EPERM] The caller does not have the privilage to perform the operation. - - It MAY fail if: - - -[EBUSY] The implementation has detected an attempt to reinitialize the - object referenced by 'mutex', a previously intialized, but not yet - destroyed, mutex. - -[EINVAL] The value specified by 'attr' is invalid. - - It shall not return [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/coverage.txt deleted file mode 100644 index a9faf09a54..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/coverage.txt +++ /dev/null @@ -1,13 +0,0 @@ -This document defines the coverage for the pthread_mutex_init function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 YES - 5-1.c: Test for ENOMEM - 5-3.c: Test for EINTR - speculative/5-2.c: Test for EPERM. Not available on -Linux. -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/speculative/5-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/speculative/5-2.c deleted file mode 100644 index cb5767ab1e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/speculative/5-2.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This sample test aims to check the following assertion: - * The function fails and return EPERM if caller has not the - * privilege to perform the operation. - - - - * The steps are: - * -> if this implementation does not support privileges, return PTS_UNSUPPORTED - * -> Otherwise, use the implementation features to come to a situation where - * pthread_mutex_init should fail because of the privileges, and then check - * that the return code is EPERM. - * -> return PTS_UNTESTED if the architecture is not present in the test. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "../testfrmw.h" - #include "../testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#ifndef PTS_UNSUPPORTED -#define PTS_UNSUPPORTED 4 -#endif -#ifndef PTS_UNTESTED -#define PTS_UNTESTED 5 -#endif - - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -int main(int argc, char * argv[]) -{ - int ret; - struct utsname un; - - output_init(); - ret = uname(&un); - if (ret == -1) - { UNRESOLVED(errno, "Unable to get Implementation name"); } - - #if VERBOSE > 0 - output("Implementation is: \n\t%s\n\t%s\n\t%s\n", un.sysname, un.release, un.version); - #endif - - /* If we are running Linux */ - if (strcmp(un.sysname, "Linux") == 0 ) - { - /* Linux does not provide privilege access to pthread_mutex_init function */ - ret = PTS_UNSUPPORTED; - output("Linux does not provide this feature\n"); - output_fini(); - return ret; - } - - /* If we are running AIX */ - if (strcmp(un.sysname, "AIX") == 0 ) - { - ; - } - /* If we are running Solaris */ - if (strcmp(un.sysname, "SunOS") == 0 ) - { - ; - } - - output("This implementation is not tested yet\n"); - output_fini(); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/testfrmw.c deleted file mode 100644 index 575dbe8c3e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/testfrmw.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - pthread_mutex_lock(&m_trace); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/testfrmw.h deleted file mode 100644 index 3fd8c3a3c9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_init/testfrmw.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i on line %i (%s)\n", __FILE__, x, __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i on line %i (%s)\n", x, __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/1-1.c deleted file mode 100644 index f93ab20857..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/1-1.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_lock() - * shall lock the mutex object referenced by 'mutex'. If the mutex is - * already locked, the calling thread shall block until the mutex becomes - * available. This operation shall return with the mutex object referenced - * by 'mutex' in the locked state with the calling thread as its owner. - - * Steps: - * -- Initialize a mutex to protect a global variable 'value' - * -- Create N threads. Each is looped M times to acquire the mutex, - * increase the value, and then release the mutex. - * -- Check if the value has increased properly (M*N); a broken mutex - * implementation may cause lost augments. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 5 -#define LOOPS 4 - -void *f1(void *parm); - -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -int value; /* value protected by mutex */ - -int main() -{ - int i, rc; - pthread_attr_t pta; - pthread_t threads[THREAD_NUM]; - //pthread_t self = pthread_self(); - - pthread_attr_init(&pta); - pthread_attr_setdetachstate(&pta, PTHREAD_CREATE_JOINABLE); - - /* Create threads */ - fprintf(stderr,"Creating %d threads\n", THREAD_NUM); - for (i=0; i -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutex_t mutex; - int rc; - - /* Initialize a mutex object with the default mutex attributes */ - if((rc=pthread_mutex_init(&mutex,NULL)) != 0) { - fprintf(stderr,"Error at pthread_mutex_init(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Lock the mutex using pthread_mutex_lock() */ - if((rc=pthread_mutex_lock(&mutex)) == 0) { - pthread_mutex_unlock(&mutex); - printf("Test PASSED\n"); - return PTS_PASS; - } - - /* Check if returned values are tolerable */ - else if(rc == EINVAL) { - fprintf(stderr,"Invalid mutex object\n"); - return PTS_UNRESOLVED; - } - else if(rc == EAGAIN) { - fprintf(stderr,"The maximum number of recursive locks has been exceeded\n"); - return PTS_UNRESOLVED; - } - else if(rc == EDEADLK) { - fprintf(stderr,"The current thread already owns the mutex\n"); - return PTS_UNRESOLVED; - } - - /* Any other returned value means the test failed */ - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/3-1.c deleted file mode 100644 index 42c4276727..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/3-1.c +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This sample test aims to check the following assertion: - * The function does not return an error code of EINTR - - - * The steps are: - * - * -> Create a thread which loops on pthread_mutex_lock and pthread_mutex_unlock - * operations. - * -> Create another thread which loops on sending a signal to the first thread. - * - * - */ - - /* - * - adam.li@intel.com 2004-05-13 - * Add to PTS. Please refer to http://nptl.bullopensource.org/phpBB/ - * for general information - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We enable the following line to have mutex attributes defined */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#define WITH_SYNCHRO -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -char do_it=1; -unsigned long count_ope=0; -pthread_mutex_t count_protect = PTHREAD_MUTEX_INITIALIZER; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif -sem_t semsync; - -typedef struct -{ - pthread_t *thr; - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -/* the following function keeps on sending the signal to the thread pointed by arg - * If WITH_SYNCHRO is defined, the target thread has a handler for the signal */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - if ((ret = pthread_kill (*(thearg->thr), thearg->sig))) - { UNRESOLVED(ret, "Pthread_kill in sendsig"); } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if ((sem_post(&semsig1))) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if ((sem_post(&semsig2))) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* The following function loops on init/destroy some mutex (with different attributes) - * it does check that no error code of EINTR is returned */ - -void * threaded(void * arg) -{ - pthread_mutexattr_t ma[4], *pma[5]; - pthread_mutex_t m[5]; - int i; - int ret; - - /* We need to register the signal handlers */ - struct sigaction sa; - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* Initialize the different mutex */ - pma[4]=NULL; - - for (i=0; i<4; i++) - { - pma[i]=&ma[i]; - if ((ret = pthread_mutexattr_init(pma[i]))) - { UNRESOLVED(ret, "pthread_mutexattr_init"); } - } - - #ifndef WITHOUT_XOPEN - if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_NORMAL))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (normal)"); } - if ((ret = pthread_mutexattr_settype(pma[1], PTHREAD_MUTEX_ERRORCHECK))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (errorcheck)"); } - if ((ret = pthread_mutexattr_settype(pma[2], PTHREAD_MUTEX_RECURSIVE))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (recursive)"); } - if ((ret = pthread_mutexattr_settype(pma[3], PTHREAD_MUTEX_DEFAULT))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (default)"); } - #if VERBOSE >1 - output("Mutex attributes NORMAL,ERRORCHECK,RECURSIVE,DEFAULT initialized\n"); - #endif - #else - #if VERBOSE > 0 - output("Mutex attributes NORMAL,ERRORCHECK,RECURSIVE,DEFAULT unavailable\n"); - #endif - #endif - - for (i=0; i<5; i++) - { - ret = pthread_mutex_init(&m[i], pma[i]); - if (ret == EINTR) - { - FAILED("pthread_mutex_init returned EINTR"); - } - if (ret != 0) - { - UNRESOLVED(ret, "pthread_mutex_init failed"); - } - } - /* The mutex are ready, we will loop on lock/unlock now */ - - while (do_it) - { - for (i=0; i<5; i++) - { - ret = pthread_mutex_lock(&m[i]); - if (ret == EINTR) - { - FAILED("pthread_mutex_lock returned EINTR"); - } - if (ret != 0) - { - UNRESOLVED(ret, "pthread_mutex_lock failed"); - } - ret = pthread_mutex_unlock(&m[i]); - if (ret == EINTR) - { - FAILED("pthread_mutex_unlock returned EINTR"); - } - if (ret != 0) - { - UNRESOLVED(ret, "pthread_mutex_unlock failed"); - } - } - ret = pthread_mutex_lock(&count_protect); - if (ret == EINTR) - { - FAILED("pthread_mutex_lock returned EINTR"); - } - if (ret != 0) - { - UNRESOLVED(ret, "pthread_mutex_lock failed"); - } - count_ope++; - pthread_mutex_unlock(&count_protect); - if (ret == EINTR) - { - FAILED("pthread_mutex_unlock returned EINTR"); - } - if (ret != 0) - { - UNRESOLVED(ret, "pthread_mutex_unlock failed"); - } - } - - /* Now we can destroy the mutex objects */ - for (i=0; i<4; i++) - { - if ((ret = pthread_mutexattr_destroy(pma[i]))) - { UNRESOLVED(ret, "pthread_mutexattr_init"); } - } - for (i=0; i<5; i++) - { - ret = pthread_mutex_destroy(&m[i]); - if (ret == EINTR) - { - FAILED("pthread_mutex_destroy returned EINTR"); - } - if (ret != 0) - { - UNRESOLVED(ret, "pthread_mutex_destroy failed"); - } - } - - do { - ret = sem_wait(&semsync); - } while (ret && (errno == EINTR)); - if (ret) - { UNRESOLVED(errno, "Could not wait for sig senders termination"); } - - return NULL; -} - -/* At last (but not least) we need a main */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - - output_init(); - - #ifdef WITH_SYNCHRO - #if VERBOSE >1 - output("Running in synchronized mode\n"); - #endif - if ((sem_init(&semsig1, 0, 1))) - { UNRESOLVED(errno, "Semsig1 init"); } - if ((sem_init(&semsig2, 0, 1))) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - if ((sem_init(&semsync, 0, 0))) - { UNRESOLVED(errno, "semsync init"); } - - #if VERBOSE >1 - output("Starting the worker thread\n"); - #endif - if ((ret = pthread_create(&th_work, NULL, threaded, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.thr = &th_work; - arg2.thr = &th_work; - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - #if VERBOSE >1 - output("Starting the signal sources\n"); - #endif - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - /* Let's wait for a while now */ - #if VERBOSE >1 - output("Let the worker be killed for a second\n"); - #endif - sleep(1); - - /* Now stop the threads and join them */ - #if VERBOSE >1 - output("Stop everybody\n"); - #endif - do { do_it=0; } - while (do_it); - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - - #if VERBOSE >1 - output("Signal sources are stopped, we can stop the worker\n"); - #endif - if ((sem_post(&semsync))) - { UNRESOLVED(errno, "could not post semsync"); } - - if ((ret = pthread_join(th_work, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" %d mutex lock and unlock were done.\n", count_ope); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/4-1.c deleted file mode 100644 index 187e3cf53a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/4-1.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, 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. - */ - - /* - * - adam.li@intel.com 2004-05-13 - * Add to PTS. Please refer to http://nptl.bullopensource.org/phpBB/ - * for general information - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the setrlimit() function from X/OPEN standard */ - #ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include /* for synchronization */ - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -pthread_mutex_t mtx; -sem_t sem; - -/** child thread function **/ -void * threaded(void * arg) -{ - int ret; - /* Try to lock the mutex once. The call must fail here. */ - ret = pthread_mutex_trylock(&mtx); - if (ret == 0) - { FAILED("Child first trylock succeeded"); } - #if VERBOSE >1 - output("[thrd] Try to lock the mutex.... failed (normal)\n"); - #endif - - /* Free the parent thread and lock the mutex (must success)*/ - if ((ret = sem_post(&sem))) - { UNRESOLVED(errno, "1st post sem in child failed"); } - - if ((ret = pthread_mutex_lock(&mtx))) - { UNRESOLVED(ret, "Child lock failed"); } - #if VERBOSE >1 - output("[thrd] Successfully locked the mutex\n"); - #endif - - /* Wait for the parent to let us go on */ - if ((ret = sem_post(&sem))) - { UNRESOLVED(errno, "2nd post sem in child failed"); } - - /* Unlock and exit */ - if ((ret = pthread_mutex_unlock(&mtx))) - { UNRESOLVED(ret, "Unlock in child failed"); } - - #if VERBOSE >1 - output("[thrd] Unlocked the mutex, ready to terminate.\n"); - #endif - - return NULL; -} - -/** parent thread function **/ -int main(int argc, char * argv[]) -{ - int ret; - int i; - pthread_mutexattr_t ma; - pthread_t child; - - output_init(); - - #if VERBOSE >1 - output("Initialize the PTHREAD_MUTEX_RECURSIVE mutex\n"); - #endif - - /* Initialize the semaphore */ - if ((ret = sem_init(&sem, 0, 0))) - { UNRESOLVED(ret, "Sem init failed"); } - - /* We initialize the recursive mutex */ - if ((ret = pthread_mutexattr_init(&ma))) - { UNRESOLVED(ret, "Mutex attribute init failed"); } - - if ((ret = pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE))) - { UNRESOLVED(ret, "Set type RECURSIVE failed"); } - - if ((ret = pthread_mutex_init(&mtx, &ma))) - { UNRESOLVED(ret, "Recursive mutex init failed"); } - - if ((ret = pthread_mutexattr_destroy(&ma))) - { UNRESOLVED(ret, "Mutex attribute destroy failed"); } - - /* -- The mutex is now ready for testing -- */ - - /* First, we lock it twice and unlock once */ - if ((ret = pthread_mutex_lock(&mtx))) - { UNRESOLVED(ret, "First lock failed"); } - - if ((ret = pthread_mutex_lock(&mtx))) - { FAILED("Second lock failed"); } - - - - if ((ret = pthread_mutex_unlock(&mtx))) - { FAILED("First unlock failed"); } - - #if VERBOSE >1 - output("The mutex has been locked twice and unlocked once, start the thread now.\n"); - #endif - - /* Here this thread owns the mutex and the internal count is "1" */ - - /* We create the child thread */ - if ((ret = pthread_create(&child, NULL, threaded, NULL))) - { UNRESOLVED(ret, "Unable to create child thread"); } - - /* then wait for child to be ready */ - if ((ret = sem_wait(&sem))) - { UNRESOLVED(errno, "Wait sem in child failed"); } - - #if VERBOSE >1 - output("[main] unlock the mutex.\n"); - #endif - - /* We can now unlock the mutex */ - if ((ret = pthread_mutex_unlock(&mtx))) - { FAILED("Second unlock failed"); } - - /* We wait for the child to lock the mutex */ - if ((ret = sem_wait(&sem))) - { UNRESOLVED(errno, "Wait sem in child failed"); } - - /* Then, try to unlock the mutex (owned by the child or unlocked) */ - ret = pthread_mutex_unlock(&mtx); - if (ret == 0) - { FAILED("Unlock of unowned mutex succeeds"); } - - /* Everything seems OK here */ - if ((ret = pthread_join(child, NULL))) - { UNRESOLVED(ret, "Child join failed"); } - - /* Simple loop to double-check */ - #if VERBOSE >1 - output("[main] joined the thread.\n"); - output("Lock & unlock the mutex 50 times.\n"); - #endif - - for (i=0; i<50; i++) - { - if ((ret = pthread_mutex_lock(&mtx))) - { FAILED("Lock failed in loop"); } - } - for (i=0; i<50; i++) - { - if ((ret = pthread_mutex_unlock(&mtx))) - { FAILED("Unlock failed in loop"); } - } - - ret = pthread_mutex_unlock(&mtx); - if (ret == 0) - { FAILED("Unlock succeeds after the loop"); } - - #if VERBOSE >1 - output("Everything went OK; destroy the mutex.\n"); - #endif - /* The test passed, we destroy the mutex */ - if ((ret = pthread_mutex_destroy(&mtx))) - { UNRESOLVED(ret, "Final mutex destroy failed"); } - - PASSED; -} -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/5-1.c deleted file mode 100644 index 956c6062b6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/5-1.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This sample test aims to check the following assertion: - * If a signal is delivered to a thread waiting for a mutex, - * upon return from the signal handler the thread resumes - * waiting for the mutex as if it had not been interrupted. - - - * The steps are: - * -> Create a child thread - * -> Child registers a signal handler - * -> Child tries to lock a mutex owned by another thread - * -> A signal is sent to the child - * -> Check that the signal handler executes and then that the thread still - waits for the mutex. - * -> Release the mutex and check that the child takes it. - * -> Do all of this several times with different mutex attributes - * - * The test shall be considered to FAIL if it hangs! - * a call to alarm() might eventually be added but this is a problem under high - * system stress. - */ - - /* - * - adam.li@intel.com 2004-05-13 - * Add to PTS. Please refer to http://nptl.bullopensource.org/phpBB/ - * for general information - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We enable the following line to have mutex attributes defined */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -pthread_mutex_t mtx[5]; -sem_t semsig, semstart; -int ctrl=0; - -/********* signal handler **********/ -void sighdl(int sig) -{ - if (sem_post(&semsig)) - { UNRESOLVED(errno, "Sem_post in signal handler"); } -} - -/********** thread *********/ -void * threaded(void * arg) -{ - int ret, i; - - /* We register the signal handler */ - struct sigaction sa; - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler"); } - - /* Start the real work */ - for (i=0; i<5; i++) /* We'll do this with the 5 kinds of mutex */ - { - if (sem_post(&semstart)) /* Tell the father we are ready */ - { UNRESOLVED(errno, "Sem post in thread"); } - - if ((ret = pthread_mutex_lock(&mtx[i]))) /* Attempt to lock the mutex */ - { UNRESOLVED(ret, "Mutex lock failed in thread"); } - - ctrl++; /* Notify the main we have passed the lock */ - - if ((ret = pthread_mutex_unlock(&mtx[i]))) /* We don't need the mutex anymore */ - { UNRESOLVED(ret, "Mutex unlock failed in thread"); } - } - return NULL; -} - - -/********* main ********/ -int main (int argc, char * argv[]) -{ - int ret, i, j; - pthread_t th; - pthread_mutexattr_t ma[4], *pma[5]; - pma[4]=NULL; - - output_init(); - - /* Initialize the mutex attributes */ - for (i=0; i<4; i++) - { - pma[i]=&ma[i]; - if ((ret = pthread_mutexattr_init(pma[i]))) - { UNRESOLVED(ret, "pthread_mutexattr_init"); } - } - #ifndef WITHOUT_XOPEN - if ((ret = pthread_mutexattr_settype(pma[0], PTHREAD_MUTEX_NORMAL))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (normal)"); } - if ((ret = pthread_mutexattr_settype(pma[1], PTHREAD_MUTEX_ERRORCHECK))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (errorcheck)"); } - if ((ret = pthread_mutexattr_settype(pma[2], PTHREAD_MUTEX_RECURSIVE))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (recursive)"); } - if ((ret = pthread_mutexattr_settype(pma[3], PTHREAD_MUTEX_DEFAULT))) - { UNRESOLVED(ret, "pthread_mutexattr_settype (default)"); } - #if VERBOSE >1 - output("Mutex attributes NORMAL,ERRORCHECK,RECURSIVE,DEFAULT initialized\n"); - #endif - #else - #if VERBOSE > 0 - output("Mutex attributes NORMAL,ERRORCHECK,RECURSIVE,DEFAULT unavailable\n"); - #endif - #endif - - /* Initialize the 5 mutex */ - for (i=0; i<5; i++) - { - if ((ret = pthread_mutex_init(&mtx[i], pma[i]))) - { UNRESOLVED(ret, "pthread_mutex_init failed")} - if ((ret = pthread_mutex_lock(&mtx[i]))) - { UNRESOLVED(ret, "Initial pthread_mutex_lock failed")} - } - - #if VERBOSE >1 - output("Mutex objects are initialized\n"); - #endif - - /* We don't need the mutex attribute objects anymore */ - for (i=0; i<4; i++) - { - if ((ret = pthread_mutexattr_destroy(pma[i]))) - { UNRESOLVED(ret, "pthread_mutexattr_destroy"); } - } - - /* Initialize the semaphores */ - if (sem_init(&semsig, 0, 1)) - { UNRESOLVED(errno, "Sem init (1) failed"); } - if (sem_init(&semstart, 0, 0)) - { UNRESOLVED(errno, "Sem init (0) failed"); } - - - #if VERBOSE >1 - output("Going to create the child thread\n"); - #endif - /* Start the child */ - if ((ret = pthread_create(&th, NULL, threaded, NULL))) - { UNRESOLVED(ret, "Unable to create the thread"); } - #if VERBOSE >1 - output("Child created\n"); - #endif - - - /* Monitor the child */ - for (i=0; i<5; i++) /* We will do this for the 5 kinds of mutex */ - { - if (sem_wait(&semstart)) /* Wait for the thread to be ready */ - { UNRESOLVED(errno, "Unable to wait for the child"); } - - #if VERBOSE >1 - output("Child is ready for iteration %i\n", i+1); - #endif - - - ctrl=0; /* init the ctrl var */ - - /* Send some signals to the thread */ - for (j=0; j<10; j++) - { - if ((ret = sem_wait(&semsig))) - { UNRESOLVED(errno, "Sem_wait failed from the signal handler"); } - - sched_yield(); /* Let the child do its stuff - might be a nanosleep here*/ - - if ((ret = pthread_kill (th, SIGUSR1))) - { UNRESOLVED(ret, "Pthread_kill failed"); } - } - #if VERBOSE >1 - output("Child was killed 10 times\n"); - #endif - - /* Now check the thread is still waiting for the mutex */ - if (ctrl != 0) - { - FAILED("Killed child passed the pthread_mutex_lock without owning it"); - } - - #if VERBOSE >1 - output("Control was OK\n"); - #endif - - /* Unlock the mutex so the thread can proceed to the next one */ - if ((ret = pthread_mutex_unlock(&mtx[i]))) - { UNRESOLVED(ret, "Mutex unlock in main failed"); } - } - - #if VERBOSE >1 - output("The test has passed, we are now going to clean up everything.\n"); - #endif - - /* Clean everything: the test has passed */ - if ((ret = pthread_join(th, NULL))) - { UNRESOLVED(ret, "Unable to join the child"); } - - for (i=0; i<5; i++) - { - if ((ret = pthread_mutex_destroy(&mtx[i]))) - { UNRESOLVED(ret, "Unable to finally destroy a mutex"); } - } - - if (sem_destroy(&semstart)) - { UNRESOLVED(errno, "Unable to destroy semstart semaphore"); } - - if (sem_destroy(&semsig)) - { UNRESOLVED(errno, "Unable to destroy semsig semaphore"); } - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/assertions.xml deleted file mode 100644 index c8c14215dc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/assertions.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - The function - - int pthread_mutex_lock(pthread_mutex_t *mutex); - - locks the mutex object referenced by 'mutex'. If the mutex is - already locked, the calling thread shall block until the mutex becomes - available. This operation returns with the mutex object referenced - by 'mutex' in the locked state with the calling thread as its owner. - - - - Upon success, it returns 0. - - - - Upon failure, it shall return: - -[EINVAL] The mutex was created with the protocol attribute - PTHREAD_PRIO_PROTECT and the calling thread's priority - is higher than the mutex's current priority calling. - It may fail if: - -[EINVAL] 'mutex' does not refer to an initialized mutex object - -[EDEADLK] The current thread already owns the mutex - It shall not return [EINTR]. - - - - If the mutex type is PTHREAD_MUTEX_RECURSIVE, - the mutex shall maintain the concept of a lock count - - - - If a signal is delivered to a thread waiting for a mutex, - when return from the signal handler the thread shall resume waiting. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/coverage.txt deleted file mode 100644 index 9568000bb4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/coverage.txt +++ /dev/null @@ -1,10 +0,0 @@ -This document defines the coverage for the pthread_mutex_lock function: - -Assertion Tested? -1 YES -2 YES -3 YES - 3-1.c: Test [EINTR] -4 YES -5 YES -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/testfrmw.c deleted file mode 100644 index 575dbe8c3e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/testfrmw.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - pthread_mutex_lock(&m_trace); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/testfrmw.h deleted file mode 100644 index 3fd8c3a3c9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_lock/testfrmw.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i on line %i (%s)\n", __FILE__, x, __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i on line %i (%s)\n", x, __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/1-1.c deleted file mode 100644 index 9432663b96..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/1-1.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_timedlock() - * locks the mutex object referenced by 'mutex'. If the mutex is - * already locked, the calling thread shall block until the mutex becomes - * available. The wait will end when the specified timeout time has expired. - - * The timeout expires when the absolute time 'abs_timeout' passes, or if 'abs_timeout' - * has already been passed the time of the call. - - * Steps: - * - * 1. Create a mutex in the main() thread and lock it. - * 2. Create a thread, and call pthread_mutex_timedlock inside of it. It should block for - * the set time of (3 secs.). - * 3. Save the time before and after the thread tried to lock the mutex. - * 4. After the thread has ended, main() will compare the times before and after the mutex - * tried to lock in the thread. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 3 /* 3 seconds of timeout time for - pthread_mutex_timedlock(). */ -void *f1(void *parm); - -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */ -struct timeval currsec1, currsec2; /* Variables for saving time before - and after locking the mutex using - pthread_mutex_timedlock(). */ -/**************************** - * - * MAIN() - * - * *************************/ -int main() -{ - pthread_t new_th; - struct timeval time_diff; - - /* Lock the mutex. */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock().\n"); - return PTS_UNRESOLVED; - } - - /* Create a thread that will call pthread_mutex_timedlock */ - if(pthread_create(&new_th, NULL, f1, NULL) != 0) - { - perror("Error in pthread_create().\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join().\n"); - return PTS_UNRESOLVED; - } - - /* Cleaning up the mutexes. */ - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error in pthread_mutex_unlock().\n"); - return PTS_UNRESOLVED; - } - if(pthread_mutex_destroy(&mutex) != 0) - { - perror("Error in pthread_mutex_destroy().\n"); - return PTS_UNRESOLVED; - } - - /* Compare time before the mutex locked and after the mutex lock timed out. */ - time_diff.tv_sec = currsec2.tv_sec - currsec1.tv_sec; - time_diff.tv_usec = currsec2.tv_usec - currsec1.tv_usec; - if (time_diff.tv_usec < 0) - { - --time_diff.tv_sec; - time_diff.tv_usec += 1000000; - } - if(time_diff.tv_sec < TIMEOUT) - { - printf("Test FAILED: Timed lock did not wait long enough. (%d secs.)\n", TIMEOUT); - printf("time before mutex locked: %ld.%06ld, time after mutex timed out: %ld.%06ld.\n", (long)currsec1.tv_sec, (long)currsec1.tv_usec, (long)currsec2.tv_sec, (long)currsec2.tv_usec); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - -/**************************** - * - * Thread's start routine. - * f1() - * - * *************************/ -void *f1(void *parm) -{ - struct timespec timeout; - - /* Get the current time before the mutex locked. */ - gettimeofday(&currsec1, NULL); - - /* Absolute time, not relative. */ - timeout.tv_sec = currsec1.tv_sec + TIMEOUT; - timeout.tv_nsec = currsec1.tv_usec * 1000; - - printf("Timed mutex lock will block for %d seconds starting from: %ld.%06ld\n", TIMEOUT, (long)currsec1.tv_sec, (long)currsec1.tv_usec); - if(pthread_mutex_timedlock(&mutex, &timeout) != ETIMEDOUT) - { - perror("Error in pthread_mutex_timedlock().\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - /* Get time after the mutex timed out in locking. */ - gettimeofday(&currsec2, NULL); - - pthread_exit(0); - return (void*)(0); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/2-1.c deleted file mode 100644 index 6b0a1c7096..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/2-1.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_timedlock() - * locks the mutex object referenced by 'mutex'. If the mutex is - * already locked, the calling thread shall block until the mutex becomes - * available. The wait will end when the specified timeout time has expired. - - * The timeout expires when the absolute time 'abs_timeout' passes, or if 'abs_timeout' - * has already been passed the time of the call. - - * Steps: - * - * 1. Create a mutex in the main() thread and lock it. - * 2. Create a thread, and call pthread_mutex_timedlock inside of it. It should block for - * the set time of (3 secs.). - * 3. Save the time before and after the thread tried to lock the mutex. - * 4. After the thread has ended, main() will compare the times before and after the mutex - * tried to lock in the thread. - */ - -/* Test for CLOCK_REALTIME */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 3 /* 3 seconds of timeout time for - pthread_mutex_timedlock(). */ -void *f1(void *parm); - -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */ -struct timeval currsec1, currsec2; /* Variables for saving time before - and after locking the mutex using - pthread_mutex_timedlock(). */ -/**************************** - * - * MAIN() - * - * *************************/ -int main() -{ - pthread_t new_th; - struct timeval time_diff; - - /* Lock the mutex. */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock().\n"); - return PTS_UNRESOLVED; - } - - /* Create a thread that will call pthread_mutex_timedlock */ - if(pthread_create(&new_th, NULL, f1, NULL) != 0) - { - perror("Error in pthread_create().\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join().\n"); - return PTS_UNRESOLVED; - } - - /* Cleaning up the mutexes. */ - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error in pthread_mutex_unlock().\n"); - return PTS_UNRESOLVED; - } - if(pthread_mutex_destroy(&mutex) != 0) - { - perror("Error in pthread_mutex_destroy().\n"); - return PTS_UNRESOLVED; - } - - /* Compare time before the mutex locked and after the mutex lock timed out. */ - time_diff.tv_sec = currsec2.tv_sec - currsec1.tv_sec; - time_diff.tv_usec = currsec2.tv_usec - currsec1.tv_usec; - if (time_diff.tv_usec < 0) - { - --time_diff.tv_sec; - time_diff.tv_usec += 1000000; - } - if(time_diff.tv_sec < TIMEOUT) - { - printf("Test FAILED: Timed lock did not wait long enough. (%d secs.)\n", TIMEOUT); - printf("time before mutex locked: %ld.%06ld, time after mutex timed out: %ld.%06ld.\n", (long)currsec1.tv_sec, (long)currsec1.tv_usec, (long)currsec2.tv_sec, (long)currsec2.tv_usec); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - -/**************************** - * - * Thread's start routine. - * f1() - * - * *************************/ -void *f1(void *parm) -{ - struct timespec timeout, ts; - int rc; - /* Get the current time before the mutex locked. */ -#ifdef CLOCK_REALTIME - printf("Test CLOCK_REALTIME\n"); - rc = clock_gettime(CLOCK_REALTIME, &ts); - if (rc != 0) - { - perror("clock_gettime()"); - exit(PTS_UNRESOLVED); - } - currsec1.tv_sec = ts.tv_sec; - currsec1.tv_usec = ts.tv_nsec / 1000; -#else - (void)ts; - (void)rc; - gettimeofday(&currsec1, NULL); -#endif - /* Absolute time, not relative. */ - timeout.tv_sec = currsec1.tv_sec + TIMEOUT; - timeout.tv_nsec = currsec1.tv_usec * 1000; - - printf("Timed mutex lock will block for %d seconds starting from: %ld.%06ld\n", TIMEOUT, (long)currsec1.tv_sec, (long)currsec1.tv_usec); - if(pthread_mutex_timedlock(&mutex, &timeout) != ETIMEDOUT) - { - perror("Error in pthread_mutex_timedlock().\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - /* Get time after the mutex timed out in locking. */ -#ifdef CLOCK_REALTIME - rc = clock_gettime(CLOCK_REALTIME, &ts); - if (rc != 0) - { - perror("clock_gettime()"); - exit(PTS_UNRESOLVED); - } - currsec2.tv_sec = ts.tv_sec; - currsec2.tv_usec = ts.tv_nsec / 1000; -#else - gettimeofday(&currsec2, NULL); -#endif - pthread_exit(0); - return (void*)(0); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c deleted file mode 100644 index 649a278dc0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_timedlock() - * - * Upon success, it returns 0. - * - * Steps: - * - * 1. Create a thread, and call pthread_mutex_timedlock inside of it. It should not block - * and should return 0 since it will be the only one owning the mutex. - * 2. Save the return value of pthread_mutex_timedlock(). It should be 0. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 3 /* 3 seconds of timeout time for - pthread_mutex_timedlock(). */ -void *f1(void *parm); - -int ret; /* Save return value of - pthread_mutex_timedlock(). */ -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */ -time_t currsec1, currsec2; /* Variables for saving time before - and afer locking the mutex using - pthread_mutex_timedlock(). */ -/**************************** - * - * MAIN() - * - * *************************/ -int main() -{ - pthread_t new_th; - - /* Create a thread that will call pthread_mutex_timedlock */ - if(pthread_create(&new_th, NULL, f1, NULL) != 0) - { - perror("Error in pthread_create().\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join().\n"); - return PTS_UNRESOLVED; - } - - /* Check the return status of pthread_mutex_timedlock(). */ - if(ret != 0) - { - printf("Test FAILED: Expected return code 0, got: %d.\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - -/**************************** - * - * Thread's start routine. - * f1() - * - * *************************/ -void *f1(void *parm) -{ - struct timespec timeout; - - timeout.tv_sec = time(NULL) + TIMEOUT; - timeout.tv_nsec = 0; - - /* This should not block since the mutex is not owned by anyone right now. - * Save the return value. */ - ret = pthread_mutex_timedlock(&mutex, &timeout); - - /* Cleaning up the mutexes. */ - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error in pthread_mutex_unlock().\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - if(pthread_mutex_destroy(&mutex) != 0) - { - perror("Error in pthread_mutex_destroy().\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - pthread_exit(0); - return (void*)(0); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c deleted file mode 100644 index 2df25531a5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_timedlock() - * - * It SHALL fail if: - * - * [EINVAL] - The process or thread would have blocked, and the abs_timeout parameter - * specified in nano-seconds field value is less than 0 or greater than or equal - * to 1,000 million. - * - * Steps: - * - * 1. Create a thread. - * 2. Call pthread_mutex_timedlock inside of the thread passing to it a negative number in the - * nano-seconds field of the 'abs_timeout'. - * 3. Save the return value of pthread_mutex_timedlock(). It should be EINVAL. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define INVALID_TIME -1 /* Invalid value of negative value - in the nano-seonds field of - 'abs_timeout. */ -#define TIMEOUT 3 /* 3 seconds of timeout time for - pthread_mutex_timedlock(). */ -void *f1(void *parm); - -int ret; /* Save return value of - pthread_mutex_timedlock(). */ -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */ -time_t currsec1, currsec2; /* Variables for saving time before - and afer locking the mutex using - pthread_mutex_timedlock(). */ -/**************************** - * - * MAIN() - * - * *************************/ -int main() -{ - pthread_t new_th; - - /* Create a thread that will call pthread_mutex_timedlock */ - if(pthread_create(&new_th, NULL, f1, NULL) != 0) - { - perror("Error in pthread_create().\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join().\n"); - return PTS_UNRESOLVED; - } - - /* Check the return status of pthread_mutex_timedlock(). */ - if(ret != EINVAL) - { - printf("Test FAILED: Expected return code EINVAL, got: %d.\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - -/**************************** - * - * Thread's start routine. - * f1() - * - * *************************/ -void *f1(void *parm) -{ - struct timespec timeout; - - /* Lock the mutex */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - /* Set nano-seconds to negative value. */ - timeout.tv_sec = time(NULL) + TIMEOUT; - timeout.tv_nsec = INVALID_TIME; - - /* This should return EINVAL */ - ret = pthread_mutex_timedlock(&mutex, &timeout); - - /* Cleaning up the mutexes. */ - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error in pthread_mutex_unlock().\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - if(pthread_mutex_destroy(&mutex) != 0) - { - perror("Error in pthread_mutex_destroy().\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - pthread_exit(0); - return (void*)(0); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c deleted file mode 100644 index 6b694a2127..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_timedlock() - * - * It SHALL fail if: - * - * [EINVAL] - The process or thread would have blocked, and the abs_timeout parameter - * specified in nano-seconds field value is less than 0 or greater than or equal - * to 1,000 million. - * - * Steps: - * - * 1. Create a thread. - * 2. Call pthread_mutex_timedlock inside of the thread passing to it - * 1000 million in the nano-seconds field of the 'abs_timeout'. - * 3. Save the return value of pthread_mutex_timedlock(). It should be EINVAL. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define INVALID_TIME 1000000000 /* Invalid value of 1,000 million - in the nano-seonds field of - 'abs_timeout. */ -#define TIMEOUT 3 /* 3 seconds of timeout time for - pthread_mutex_timedlock(). */ -void *f1(void *parm); - -int ret; /* Save return value of - pthread_mutex_timedlock(). */ -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */ -time_t currsec1, currsec2; /* Variables for saving time before - and afer locking the mutex using - pthread_mutex_timedlock(). */ -/**************************** - * - * MAIN() - * - * *************************/ -int main() -{ - pthread_t new_th; - - /* Create a thread that will call pthread_mutex_timedlock */ - if(pthread_create(&new_th, NULL, f1, NULL) != 0) - { - perror("Error in pthread_create().\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join().\n"); - return PTS_UNRESOLVED; - } - - /* Check the return status of pthread_mutex_timedlock(). */ - if(ret != EINVAL) - { - printf("Test FAILED: Expected return code EINVAL, got: %d.\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - -/**************************** - * - * Thread's start routine. - * f1() - * - * *************************/ -void *f1(void *parm) -{ - struct timespec timeout; - - /* Lock the mutex */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - /* Set nano-seconds to negative value. */ - timeout.tv_sec = time(NULL) + TIMEOUT; - timeout.tv_nsec = INVALID_TIME; - - /* This should return EINVAL */ - ret = pthread_mutex_timedlock(&mutex, &timeout); - - /* Cleaning up the mutexes. */ - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error in pthread_mutex_unlock().\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - if(pthread_mutex_destroy(&mutex) != 0) - { - perror("Error in pthread_mutex_destroy().\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - pthread_exit(0); - return (void*)(0); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c deleted file mode 100644 index 72b3e28705..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_timedlock() - * - * It shall fail if: - * - * [ETIMEDOUT] - The timeout expried and the mutex could not be locked. - * - * Steps: - * - * 1. In main(), lock the mutex then create a thread. - * 2. Inside the thread, call pthread_mutex_timedlock. It should block and return - * ETIMEDOUT. - * 3. Save the return value of pthread_mutex_timedlock() and cleanup mutex stuff. - * 4. Anaylse the return value. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 3 /* 3 seconds of timeout time for - pthread_mutex_timedlock(). */ -void *f1(void *parm); - -int ret; /* Save return value of - pthread_mutex_timedlock(). */ -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */ -time_t currsec1, currsec2; /* Variables for saving time before - and afer locking the mutex using - pthread_mutex_timedlock(). */ -/**************************** - * - * MAIN() - * - * *************************/ -int main() -{ - pthread_t new_th; - - /* Lock the mutex before creating the thread. */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock in main().\n"); - return PTS_UNRESOLVED; - } - - /* Create a thread that will call pthread_mutex_timedlock */ - if(pthread_create(&new_th, NULL, f1, NULL) != 0) - { - perror("Error in pthread_create().\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join().\n"); - return PTS_UNRESOLVED; - } - - /* Cleaning up the mutexes. */ - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error in pthread_mutex_unlock().\n"); - return PTS_UNRESOLVED; - } - - if(pthread_mutex_destroy(&mutex) != 0) - { - perror("Error in pthread_mutex_destroy().\n"); - return PTS_UNRESOLVED; - } - - /* Check the return status of pthread_mutex_timedlock(). */ - if(ret != ETIMEDOUT) - { - printf("Test FAILED: Expected return code ETIMEDOUT, got: %d.\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - -/**************************** - * - * Thread's start routine. - * f1() - * - * *************************/ -void *f1(void *parm) -{ - struct timespec timeout; - - timeout.tv_sec = time(NULL); - timeout.tv_nsec = 0; - - /* This should block since the mutex is not owned by anyone right now. - * Save the return value. */ - ret = pthread_mutex_timedlock(&mutex, &timeout); - - pthread_exit(0); - return (void*)(0); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/assertions.xml deleted file mode 100644 index 47c0bf0bcd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/assertions.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - The function - - int pthread_mutex_timedlock(pthread_mutex_t *restrict mutex, - const struct timespec *restrict abs_timeout); - - locks the mutex object referenced by 'mutex'. If the mutex is - already locked, the calling thread shall block until the mutex becomes - available. The wait will end when the specified timeout time has expired. - - The timeout expires when the absolute time 'abs_timeout' passes, or if 'abs_timeout' - has already been passed the time of the call. - - - - If the Timers option (TMR) is supported, the timeout will be based on the CLOCK_REALTIME - clock. Otherwise, it will be based on the system clock as returned by time() - - - For mutexes initialized with the PRIO_INHERIT protocol, if a timed mutex wait is - terminated because its timeout expired, the priority of the owner of the mutex shall be - adjusted to show the fact that this thread no longer is among those that are waiting for - the mutex. - - - Upon success, it returns 0. - - - It SHALL fail if: - - [EINVAL] - The mutex was created with the protocol attribute of - PTHREAD_PRIO_PROTECT and the calling thread's priority is higher than - the mutex's current priority ceiling. - - [EINVAL] - The process or thread would have blocked, and the abs_timeout parameter - specified in nano-seconds field value is less than 0 or greater than or equal - to 1,000 million. - - [ETIMEDOUT] - The timeout expried and the mutex could not be locked. - - It MAY fail if: - - [EVINAL] - 'mutex' does not refer to an initialized mutex object. - - [EAGAIN] - (XSI) The mutex could not be acquired, the max number of recursive locks for - 'mutex' has been exceeded. - - [EDEADLK] - The current thread already owns the mutex. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/coverage.txt deleted file mode 100644 index 7d80ed1754..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_timedlock/coverage.txt +++ /dev/null @@ -1,10 +0,0 @@ -This document defines the coverage for the pthread_mutex_timedlock function: - -Assertion Tested? -1 YES -2 YES -3 NO -4 YES -5 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/1-1.c deleted file mode 100644 index 55055d712e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/1-1.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_trylock() - * is equivalent to pthread_mutex_lock() except that if the mutex object - * referenced by 'mutex' is currently locked (by any thread, including the - * current thread), the call shall return immediately. - - * Steps: - * -- Initilize a mutex object - * -- Create a secondary thread and have it lock the mutex - * -- Within the main thread, try to lock the mutex using - pthread_mutex_trylock() and EBUSY is expected - * -- Have the secondary thread unlock the mutex - * -- Within the main thread, try to lock the mutex again - and expect a successful locking. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -void *func(void *parm); - -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -int t1_start=0; -int t1_pause=1; - -int main() -{ - int i, rc; - pthread_t t1; - - /* Create a secondary thread and wait until it has locked the mutex */ - pthread_create(&t1, NULL, func, NULL); - while(!t1_start) - sleep(1); - - /* Trylock the mutex and expect it returns EBUSY */ - rc = pthread_mutex_trylock(&mutex); - if(rc!=EBUSY) { - fprintf(stderr,"Expected %d(EBUSY), got %d\n",EBUSY,rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Allow the secondary thread to go ahead */ - t1_pause=0; - - /* Trylock the mutex for N times */ - for(i=0; i<5; i++) { - rc = pthread_mutex_trylock(&mutex); - if(rc==0) { - pthread_mutex_unlock(&mutex); - break; - } - else if(rc==EBUSY) { - sleep(1); - continue; - } - else { - fprintf(stderr,"Unexpected error code(%d) for pthread_mutex_lock()\n", rc); - return PTS_UNRESOLVED; - } - } - - /* Clean up */ - pthread_join(t1, NULL); - pthread_mutex_destroy(&mutex); - - if(i>=5) { - fprintf(stderr,"Have tried %d times but failed to get the mutex\n", i); - return PTS_UNRESOLVED; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - -void *func(void *parm) -{ - int rc; - - if((rc=pthread_mutex_lock(&mutex))!=0) { - fprintf(stderr,"Error at pthread_mutex_lock(), rc=%d\n",rc); - pthread_exit((void*)PTS_UNRESOLVED); - } - t1_start=1; - - while(t1_pause) - sleep(1); - - if((rc=pthread_mutex_unlock(&mutex))!=0) { - fprintf(stderr,"Error at pthread_mutex_unlock(), rc=%d\n",rc); - pthread_exit((void*)PTS_UNRESOLVED); - } - - pthread_exit(0); - return (void*)(0); -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c deleted file mode 100644 index 95624ba667..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, 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. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes - and the mkstemp() routine */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -typedef struct -{ - pthread_mutex_t mtx; - int status; /* error code */ -} testdata_t; - -struct _scenar -{ - int m_type; /* Mutex type to use */ - int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */ - int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_DEFAULT, 0, 0, "Default mutex"} -#ifndef WITHOUT_XOPEN - ,{PTHREAD_MUTEX_NORMAL, 0, 0, "Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 0, "Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 0, "Recursive mutex"} -#endif - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, "Pshared mutex"} -#ifndef WITHOUT_XOPEN - ,{PTHREAD_MUTEX_NORMAL, 1, 0, "Pshared Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, "Pshared Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, "Pshared Recursive mutex"} -#endif - - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, "Pshared mutex across processes"} -#ifndef WITHOUT_XOPEN - ,{PTHREAD_MUTEX_NORMAL, 1, 1, "Pshared Normal mutex across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, "Pshared Errorcheck mutex across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, "Pshared Recursive mutex across processes"} -#endif -}; -#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0])) - -/* The test function will only perform a trylock operation then return. */ -void * tf(void * arg) -{ - testdata_t * td = (testdata_t *)arg; - - td->status = pthread_mutex_trylock(&(td->mtx)); - - if (td->status == 0) - { - int ret; - - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock a locked semaphore"); } - } - - return NULL; -} - -/* Main entry point. */ -int main(int argc, char * argv[]) -{ - int ret; - int sc; - pthread_mutexattr_t ma; - - testdata_t * td; - testdata_t alternativ; - - int do_fork; - - pid_t child_pr=0, chkpid; - int status; - pthread_t child_th; - - long pshared, mf; - - /* Initialize output */ - output_init(); - - /* Test system abilities */ - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TSH : %li\n", pshared); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - #endif - - #ifdef WITHOUT_XOPEN - #if VERBOSE > 0 - output("As XSI extension is disabled, we won't test the feature across process\n"); - #endif - mf = -1; - #endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file (or not interested in this), we use an alternative method */ - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - #ifndef WITHOUT_XOPEN - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/mutex_trylock_1-2-XXXXXX"; - size_t sz; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - sz= (size_t)sysconf(_SC_PAGESIZE); - - tmp = calloc(1, sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory.\n"); - #endif - } - #endif - -/********** - * For each test scenario, initialize the attributes and other variables. - * Do the whole thing for each time to test. - */ - for ( sc=0; sc < NSCENAR ; sc++) - { - #if VERBOSE > 1 - output("[parent] Preparing attributes for: %s\n", scenarii[sc].descr); - #endif - /* set / reset everything */ - do_fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - - #ifndef WITHOUT_XOPEN - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[sc].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #if VERBOSE > 1 - output("[parent] Mutex type : %i\n", scenarii[sc].m_type); - #endif - #endif - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[sc].m_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - #if VERBOSE > 1 - output("[parent] Mutex is process-shared\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Mutex is process-private\n"); - } - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[sc].fork != 0)) - { - do_fork = 1; - #if VERBOSE > 1 - output("[parent] Child will be a new process\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Child will be a new thread\n"); - } - #endif - -/********** - * Initialize the testdata_t structure with the previously defined attributes - */ - /* Initialize the mutex */ - ret = pthread_mutex_init(&(td->mtx), &ma); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Mutex init failed"); } - - /* Initialize the other datas from the test structure */ - td->status=0; - -/********** - * Proceed to the actual testing - */ - /* Trylock the mutex twice before creating children */ - ret = pthread_mutex_trylock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to trylock the mutex"); } - ret = pthread_mutex_trylock(&(td->mtx)); - #ifndef WITHOUT_XOPEN - if (scenarii[sc].m_type == PTHREAD_MUTEX_RECURSIVE) - { - if (ret != 0) { UNRESOLVED(ret, "Failed to pthread_mutex_trylock() twice a recursive mutex"); } - - /* Unlock once so the count is "1" */ - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex"); } - } - else - #endif - if (ret == 0) { FAILED("Main was able to pthread_mutex_trylock() twice without error"); } - - /* Create the children */ - if (do_fork != 0) - { - /* We are testing across processes */ - child_pr = fork(); - if (child_pr == -1) - { UNRESOLVED(errno, "[parent] Fork failed"); } - - if (child_pr == 0) - { - #if VERBOSE > 3 - output("[child] Child process is starting...\n"); - #endif - - if (tf((void *)td) != NULL) - { - UNRESOLVED( -1, "[child] Got an unexpected return value from test function"); - } - else - { - /* We cannot use the PASSED macro here since it would terminate the output */ - exit (0); - } - } - /* Only the parent process goes further */ - } - else /* do_fork == 0 */ - { - /* We are testing across two threads */ - ret = pthread_create(&child_th, NULL, tf, td); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to create the child thread."); } - } - - /* Wait for the child to terminate */ - if (do_fork != 0) - { - /* We were testing across processes */ - ret = 0; - chkpid = waitpid(child_pr, &status, 0); - if (chkpid != child_pr) - { - output("Expected pid: %i. Got %i\n", (int)child_pr, (int)chkpid); - UNRESOLVED(errno, "Waitpid failed"); - } - if (WIFSIGNALED(status)) - { - output("Child process killed with signal %d\n",WTERMSIG(status)); - UNRESOLVED( -1 , "Child process was killed"); - } - - if (WIFEXITED(status)) - { - ret = WEXITSTATUS(status); - } - else - { - UNRESOLVED( -1, "Child process was neither killed nor exited"); - } - - if (ret != 0) - { - exit(ret); /* Output has already been closed in child */ - } - - } - else /* child was a thread */ - { - ret = pthread_join(child_th, NULL); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to join the thread"); } - } - - /* Check the child status */ - if (td->status != EBUSY) - { - output("Unexpected return value: %d (%s)\n", td->status, strerror(td->status)); - FAILED("pthread_mutex_trylock() did not return EBUSY in the child"); - } - - /* Unlock the mutex */ - ret= pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex"); } - -/********** - * Destroy the data - */ - ret = pthread_mutex_destroy(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - } /* Proceed to the next scenario */ - - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c deleted file mode 100644 index 9e460d3ef5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, 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. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes - and the mkstemp() routine */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -#ifndef WITHOUT_XOPEN - -typedef struct -{ - pthread_mutex_t mtx; - int status; /* error code */ -} testdata_t; - -struct _scenar -{ - int m_type; /* Mutex type to use */ - int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */ - int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_RECURSIVE, 0, 0, "Recursive mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, "Pshared Recursive mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, "Pshared Recursive mutex across processes"} -}; -#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0])) - -/* The test function will only perform a trylock operation then return. */ -void * tf(void * arg) -{ - testdata_t * td = (testdata_t *)arg; - - td->status = pthread_mutex_trylock(&(td->mtx)); - - if (td->status == 0) - { - int ret; - - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock a locked semaphore"); } - } - - return NULL; -} - -/* Main entry point. */ -int main(int argc, char * argv[]) -{ - int ret; - int sc; - pthread_mutexattr_t ma; - - testdata_t * td; - testdata_t alternativ; - - int do_fork; - - pid_t child_pr=0, chkpid; - int status; - pthread_t child_th; - - long pshared, mf; - - /* Initialize output */ - output_init(); - - /* Test system abilities */ - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TSH : %li\n", pshared); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - #endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file (or not interested in this), we use an alternative method */ - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/mutex_trylock_2-1-XXXXXX"; - size_t sz; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - sz= (size_t)sysconf(_SC_PAGESIZE); - - tmp = calloc(1, sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory.\n"); - #endif - } - -/********** - * For each test scenario, initialize the attributes and other variables. - * Do the whole thing for each time to test. - */ - for ( sc=0; sc < NSCENAR ; sc++) - { - #if VERBOSE > 1 - output("[parent] Preparing attributes for: %s\n", scenarii[sc].descr); - #endif - /* set / reset everything */ - do_fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[sc].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #if VERBOSE > 1 - output("[parent] Mutex type : %i\n", scenarii[sc].m_type); - #endif - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[sc].m_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - #if VERBOSE > 1 - output("[parent] Mutex is process-shared\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Mutex is process-private\n"); - } - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[sc].fork != 0)) - { - do_fork = 1; - #if VERBOSE > 1 - output("[parent] Child will be a new process\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Child will be a new thread\n"); - } - #endif - -/********** - * Initialize the testdata_t structure with the previously defined attributes - */ - /* Initialize the mutex */ - ret = pthread_mutex_init(&(td->mtx), &ma); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Mutex init failed"); } - - /* Initialize the other datas from the test structure */ - td->status=0; - -/********** - * Proceed to the actual testing - */ - /* Trylock the mutex twice before creating children */ - ret = pthread_mutex_trylock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to trylock the mutex"); } - ret = pthread_mutex_trylock(&(td->mtx)); - - if (scenarii[sc].m_type == PTHREAD_MUTEX_RECURSIVE) - { - if (ret != 0) { FAILED("Failed to pthread_mutex_trylock() twice a recursive mutex"); } - - /* Unlock once so the count is "1" */ - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex"); } - } - else - if (ret == 0) { UNRESOLVED(-1, "Main was able to pthread_mutex_trylock() twice without error"); } - - /* Create the children */ - if (do_fork != 0) - { - /* We are testing across processes */ - child_pr = fork(); - if (child_pr == -1) - { UNRESOLVED(errno, "[parent] Fork failed"); } - - if (child_pr == 0) - { - #if VERBOSE > 3 - output("[child] Child process is starting...\n"); - #endif - - if (tf((void *)td) != NULL) - { - UNRESOLVED( -1, "[child] Got an unexpected return value from test function"); - } - else - { - /* We cannot use the PASSED macro here since it would terminate the output */ - exit (0); - } - } - /* Only the parent process goes further */ - } - else /* do_fork == 0 */ - { - /* We are testing across two threads */ - ret = pthread_create(&child_th, NULL, tf, td); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to create the child thread."); } - } - - /* Wait for the child to terminate */ - if (do_fork != 0) - { - /* We were testing across processes */ - ret = 0; - chkpid = waitpid(child_pr, &status, 0); - if (chkpid != child_pr) - { - output("Expected pid: %i. Got %i\n", (int)child_pr, (int)chkpid); - UNRESOLVED(errno, "Waitpid failed"); - } - if (WIFSIGNALED(status)) - { - output("Child process killed with signal %d\n",WTERMSIG(status)); - UNRESOLVED( -1 , "Child process was killed"); - } - - if (WIFEXITED(status)) - { - ret = WEXITSTATUS(status); - } - else - { - UNRESOLVED( -1, "Child process was neither killed nor exited"); - } - - if (ret != 0) - { - exit(ret); /* Output has already been closed in child */ - } - - } - else /* child was a thread */ - { - ret = pthread_join(child_th, NULL); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to join the thread"); } - } - - /* Check the child status */ - if (td->status != EBUSY) - { - output("Unexpected return value: %d (%s)\n", td->status, strerror(td->status)); - FAILED("pthread_mutex_trylock() did not return EBUSY in the child"); - } - - /* Unlock the mutex */ - ret= pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { FAILED("Failed to unlock the mutex -- count is broken?"); } - - ret= pthread_mutex_unlock(&(td->mtx)); - if (ret == 0) { FAILED("Was able to unlock once more the mutex -- count is broken?"); } - -/********** - * Destroy the data - */ - ret = pthread_mutex_destroy(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - } /* Proceed to the next scenario */ - - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/3-1.c deleted file mode 100644 index d349cb9c3f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/3-1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_trylock() - * Upon succesful completion, it shall return a 0 - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutex_t mutex; - int rc; - - /* Initialize a mutex object with the default mutex attributes */ - if((rc=pthread_mutex_init(&mutex,NULL)) != 0) { - fprintf(stderr,"Error at pthread_mutex_init(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Try to lock the mutex using pthread_mutex_trylock() */ - if((rc=pthread_mutex_trylock(&mutex)) == 0) { - pthread_mutex_unlock(&mutex); - printf("Test PASSED\n"); - return PTS_PASS; - } - - /* Check if returned values are tolerable */ - /* PATCH: since we are using the mutex properly,*/ - /* errors are NOT tolerable here */ - else if(rc == EBUSY) { - fprintf(stderr,"The mutex was already locked\n"); - } - else if(rc == EINVAL) { - fprintf(stderr,"Invalid mutex object\n"); - } - else if(rc == EAGAIN) { - fprintf(stderr,"The maximum number of recursive locks has been exceeded\n"); - } - - /* Any other returned value means the test failed */ - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/4-1.c deleted file mode 100644 index 90195be11c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/4-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_trylock() - * Upon failure, it shall return: - * -[EBUSY] The mutex could not be acquired because it was already locked. - - * Steps: - * -- Initilize a mutex object - * -- Lock the mutex using pthread_mutex_lock() - * -- Try to lock the mutex using pthread_mutex_trylock() and expect EBUSY - * - */ - -#include -#include -#include -#include "posixtest.h" - -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - -int main() -{ - int rc; - - if((rc=pthread_mutex_lock(&mutex))!=0) { - fprintf(stderr,"Error at pthread_mutex_lock(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - rc = pthread_mutex_trylock(&mutex); - if(rc!=EBUSY) { - fprintf(stderr,"Expected %d(EBUSY), got %d\n",EBUSY,rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - pthread_mutex_unlock(&mutex); - pthread_mutex_destroy(&mutex); - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/4-2.c deleted file mode 100644 index f0423f3cbf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/4-2.c +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, 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. - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes - and the mkstemp() routine */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -typedef struct -{ - pthread_mutex_t mtx; - int status; /* error code */ -} testdata_t; - -struct _scenar -{ - int m_type; /* Mutex type to use */ - int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */ - int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_DEFAULT, 0, 0, "Default mutex"} -#ifndef WITHOUT_XOPEN - ,{PTHREAD_MUTEX_NORMAL, 0, 0, "Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, 0, "Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, 0, "Recursive mutex"} -#endif - - ,{PTHREAD_MUTEX_DEFAULT, 1, 0, "Pshared mutex"} -#ifndef WITHOUT_XOPEN - ,{PTHREAD_MUTEX_NORMAL, 1, 0, "Pshared Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 0, "Pshared Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 0, "Pshared Recursive mutex"} -#endif - - ,{PTHREAD_MUTEX_DEFAULT, 1, 1, "Pshared mutex across processes"} -#ifndef WITHOUT_XOPEN - ,{PTHREAD_MUTEX_NORMAL, 1, 1, "Pshared Normal mutex across processes"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, 1, "Pshared Errorcheck mutex across processes"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, 1, "Pshared Recursive mutex across processes"} -#endif -}; -#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0])) - -/* The test function will only perform a trylock operation then return. */ -void * tf(void * arg) -{ - testdata_t * td = (testdata_t *)arg; - - td->status = pthread_mutex_trylock(&(td->mtx)); - - if (td->status == 0) - { - int ret; - - ret = pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock a locked semaphore"); } - } - - return NULL; -} - -/* Main entry point. */ -int main(int argc, char * argv[]) -{ - int ret; - int sc; - pthread_mutexattr_t ma; - - testdata_t * td; - testdata_t alternativ; - - int do_fork; - - pid_t child_pr=0, chkpid; - int status; - pthread_t child_th; - - long pshared, mf; - - /* Initialize output */ - output_init(); - - /* Initialize the timeout */ - alarm(30); - - /* Test system abilities */ - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - mf =sysconf(_SC_MAPPED_FILES); - - #if VERBOSE > 0 - output("Test starting\n"); - output("System abilities:\n"); - output(" TSH : %li\n", pshared); - output(" MF : %li\n", mf); - if ((mf < 0) || (pshared < 0)) - output("Process-shared attributes won't be tested\n"); - #endif - - #ifdef WITHOUT_XOPEN - #if VERBOSE > 0 - output("As XSI extension is disabled, we won't test the feature across process\n"); - #endif - mf = -1; - #endif - -/********** - * Allocate space for the testdata structure - */ - if (mf < 0) - { - /* Cannot mmap a file (or not interested in this), we use an alternative method */ - td = &alternativ; - pshared = -1; /* We won't do this testing anyway */ - #if VERBOSE > 0 - output("Testdata allocated in the process memory.\n"); - #endif - } - #ifndef WITHOUT_XOPEN - else - { - /* We will place the test data in a mmaped file */ - char filename[] = "/tmp/mutex_trylock_4-2-XXXXXX"; - size_t sz; - void * mmaped; - int fd; - char * tmp; - - /* We now create the temp files */ - fd = mkstemp(filename); - if (fd == -1) - { UNRESOLVED(errno, "Temporary file could not be created"); } - - /* and make sure the file will be deleted when closed */ - unlink(filename); - - #if VERBOSE > 1 - output("Temp file created (%s).\n", filename); - #endif - - sz= (size_t)sysconf(_SC_PAGESIZE); - - tmp = calloc(1, sz); - if (tmp == NULL) - { UNRESOLVED(errno, "Memory allocation failed"); } - - /* Write the data to the file. */ - if (write (fd, tmp, sz) != (ssize_t) sz) - { UNRESOLVED(sz, "Writting to the file failed"); } - - free(tmp); - - /* Now we can map the file in memory */ - mmaped = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (mmaped == MAP_FAILED) - { UNRESOLVED(errno, "mmap failed"); } - - td = (testdata_t *) mmaped; - - /* Our datatest structure is now in shared memory */ - #if VERBOSE > 1 - output("Testdata allocated in shared memory.\n"); - #endif - } - #endif - -/********** - * For each test scenario, initialize the attributes and other variables. - * Do the whole thing for each time to test. - */ - for ( sc=0; sc < NSCENAR ; sc++) - { - #if VERBOSE > 1 - output("[parent] Preparing attributes for: %s\n", scenarii[sc].descr); - #endif - /* set / reset everything */ - do_fork=0; - ret = pthread_mutexattr_init(&ma); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - - #ifndef WITHOUT_XOPEN - /* Set the mutex type */ - ret = pthread_mutexattr_settype(&ma, scenarii[sc].m_type); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set mutex type"); } - #if VERBOSE > 1 - output("[parent] Mutex type : %i\n", scenarii[sc].m_type); - #endif - #endif - - /* Set the pshared attributes, if supported */ - if ((pshared > 0) && (scenarii[sc].m_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - #if VERBOSE > 1 - output("[parent] Mutex is process-shared\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Mutex is process-private\n"); - } - #endif - - /* Tell whether the test will be across processes */ - if ((pshared > 0) && (scenarii[sc].fork != 0)) - { - do_fork = 1; - #if VERBOSE > 1 - output("[parent] Child will be a new process\n"); - #endif - } - #if VERBOSE > 1 - else { - output("[parent] Child will be a new thread\n"); - } - #endif - -/********** - * Initialize the testdata_t structure with the previously defined attributes - */ - /* Initialize the mutex */ - ret = pthread_mutex_init(&(td->mtx), &ma); - if (ret != 0) - { UNRESOLVED(ret, "[parent] Mutex init failed"); } - - /* Initialize the other datas from the test structure */ - td->status=0; - -/********** - * Proceed to the actual testing - */ - /* Trylock the mutex twice before creating children */ - ret = pthread_mutex_lock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to lock the mutex"); } - - /* Create the children */ - if (do_fork != 0) - { - /* We are testing across processes */ - child_pr = fork(); - if (child_pr == -1) - { UNRESOLVED(errno, "[parent] Fork failed"); } - - if (child_pr == 0) - { - #if VERBOSE > 3 - output("[child] Child process is starting...\n"); - #endif - - if (tf((void *)td) != NULL) - { - UNRESOLVED( -1, "[child] Got an unexpected return value from test function"); - } - else - { - /* We cannot use the PASSED macro here since it would terminate the output */ - exit (0); - } - } - /* Only the parent process goes further */ - } - else /* do_fork == 0 */ - { - /* We are testing across two threads */ - ret = pthread_create(&child_th, NULL, tf, td); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to create the child thread."); } - } - - /* Wait for the child to terminate */ - if (do_fork != 0) - { - /* We were testing across processes */ - ret = 0; - chkpid = waitpid(child_pr, &status, 0); - if (chkpid != child_pr) - { - output("Expected pid: %i. Got %i\n", (int)child_pr, (int)chkpid); - UNRESOLVED(errno, "Waitpid failed"); - } - if (WIFSIGNALED(status)) - { - output("Child process killed with signal %d\n",WTERMSIG(status)); - UNRESOLVED( -1 , "Child process was killed"); - } - - if (WIFEXITED(status)) - { - ret = WEXITSTATUS(status); - } - else - { - UNRESOLVED( -1, "Child process was neither killed nor exited"); - } - - if (ret != 0) - { - exit(ret); /* Output has already been closed in child */ - } - - } - else /* child was a thread */ - { - ret = pthread_join(child_th, NULL); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to join the thread"); } - } - - /* Check the child status */ - if (td->status != EBUSY) - { - output("Unexpected return value: %d (%s)\n", td->status, strerror(td->status)); - FAILED("pthread_mutex_trylock() did not return EBUSY in the child"); - } - - /* Unlock the mutex */ - ret= pthread_mutex_unlock(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex"); } - -/********** - * Destroy the data - */ - ret = pthread_mutex_destroy(&(td->mtx)); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attribute object"); } - - } /* Proceed to the next scenario */ - - #if VERBOSE > 0 - output("Test passed\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c deleted file mode 100644 index 76c2c3e019..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The function does not return EINTR - - * The steps are: - * -> A thread is killed several times while calling pthread_mutex_trylock - * -> check that EINTR is never returned - - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We need the XSI extention for the mutex attributes - and the mkstemp() routine */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif - /********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ -struct _scenar -{ - int m_type; /* Mutex type to use */ - int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */ - char * descr; /* Case description */ -} -scenarii[] = -{ - {PTHREAD_MUTEX_DEFAULT, 0, "Default mutex"} -#ifndef WITHOUT_XOPEN - ,{PTHREAD_MUTEX_NORMAL, 0, "Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 0, "Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 0, "Recursive mutex"} -#endif - - ,{PTHREAD_MUTEX_DEFAULT, 1, "Pshared mutex"} -#ifndef WITHOUT_XOPEN - ,{PTHREAD_MUTEX_NORMAL, 1, "Pshared Normal mutex"} - ,{PTHREAD_MUTEX_ERRORCHECK, 1, "Pshared Errorcheck mutex"} - ,{PTHREAD_MUTEX_RECURSIVE, 1, "Pshared Recursive mutex"} -#endif -}; -#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0])) - - -char do_it=1; -char woken=0; -unsigned long count_ope=0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - pid_t process; - - process=getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - ret = kill(process, thearg->sig); - if (ret != 0) { UNRESOLVED(errno, "Kill in sendsig"); } - - } - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -/* This one is registered for signal SIGUSR2 */ -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - - -/* Test function -- This one calls pthread_mutex_trylock and check that no EINTR is returned. */ -void * test(void * arg) -{ - int ret=0; - int i; - long pshared; - pthread_mutex_t mtx[NSCENAR+2]; - pthread_mutexattr_t ma[NSCENAR+1]; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_UNBLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread"); } - - /* System abilities */ - pshared = sysconf(_SC_THREAD_PROCESS_SHARED); - - /* Initialize the mutex objects according to the scenarii */ - for (i=0; i 0) && (scenarii[i].m_pshared != 0)) - { - ret = pthread_mutexattr_setpshared(&ma[i], PTHREAD_PROCESS_SHARED); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to set the mutex process-shared"); } - } - - /* Initialize the mutex */ - ret = pthread_mutex_init(&mtx[i], &ma[i]); - if (ret != 0) { UNRESOLVED(ret, "[parent] Mutex init failed"); } - - } - /* Default mutexattr object */ - ret = pthread_mutexattr_init(&ma[i]); - if (ret != 0) { UNRESOLVED(ret, "[parent] Unable to initialize the mutex attribute object"); } - ret = pthread_mutex_init(&mtx[i], &ma[i]); - if (ret != 0) { UNRESOLVED(ret, "[parent] Mutex init failed"); } - /* Default mutex */ - ret = pthread_mutex_init(&mtx[i+1], NULL); - if (ret != 0) { UNRESOLVED(ret, "[parent] Mutex init failed"); } - - - /* do the real testing */ - while (do_it) - { - count_ope++; - - ret = pthread_mutex_trylock(&mtx[count_ope % (NSCENAR+2)]); - if (ret == EINTR) { FAILED("EINTR was returned"); } - if (ret != 0) { UNRESOLVED(ret, "1st trylock failed"); } - - ret = pthread_mutex_trylock(&mtx[count_ope % (NSCENAR+2)]); - if (ret == EINTR) { FAILED("EINTR was returned"); } - if (ret == 0) - { - ret = pthread_mutex_unlock(&mtx[count_ope % (NSCENAR+2)]); - if (ret != 0) { UNRESOLVED(ret, "Unlocking the mutex failed"); } - ret = EBUSY; - } - if (ret != EBUSY) { UNRESOLVED(ret, "Unexpected error was returned."); } - - ret = pthread_mutex_unlock(&mtx[count_ope % (NSCENAR+2)]); - if (ret != 0) { UNRESOLVED(ret, "Failed to unlock the mutex"); } - } - - /* Destroy everything */ - for (i=0; i <= NSCENAR; i++) - { - ret = pthread_mutex_destroy(&mtx[i]); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - ret = pthread_mutexattr_destroy(&ma[i]); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex attr object"); } - } - ret = pthread_mutex_destroy(&mtx[i]); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy the mutex"); } - - return NULL; -} - - - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset(&usersigs); - ret = sigaddset(&usersigs, SIGUSR1); - ret |= sigaddset(&usersigs, SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Unable to add SIGUSR1 or 2 to a signal set"); } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread"); } - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - if ((ret = pthread_create(&th_work, NULL, test, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - - /* Let's wait for a while now */ - sleep(1); - - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - - if ((ret = pthread_join(th_work, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" %d mutex locks.\n", count_ope); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/assertions.xml deleted file mode 100644 index e0118f7249..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/assertions.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - The function - - int pthread_mutex_trylock(pthread_mutex_t *mutex); - - is equivalent to pthread_mutex_lock() except that if the mutex object - referenced by 'mutex' is currently locked (by any thread, including the - current thread), the call returns immediately. - - - If the mutex type is PTHREAD_MUTEX_RECURSIVE and the mutex is currently - owned by the calling thread, the mutex lock count shall be incremented - by one and the pthread_mutex_trylock() function immediately returns - success. - - - It returns 0 if a lock on the mutex object referenced by 'mutex' is - acquired. - - - Upon failure, it shall return: - -[EINVAL] The mutex was created with the protocol attribute - PTHREAD_PRIO_PROTECT and the calling thread's priority is higher - than the mutex's current priority calling. - -[EBUSY] The mutex could not be acquired because it was already locked. - - It may fail if: - -[EINVAL] 'mutex' does not refer to an initialized mutex object - - It shall not return [EINTR]. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/coverage.txt deleted file mode 100644 index a7d3a3bdbc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/coverage.txt +++ /dev/null @@ -1,13 +0,0 @@ -This document defines the coverage for the pthread_mutex_trylock function: - -Assertion Tested? -1 YES -2 NO * PTHREAD_MUTEX_RECURSIVE is a new XSI feature, which may not - be available in pthread implementations -3 YES -4 YES * EINVAL and EAGAIN are relevant to low-priority mutex - attributes, which cannot be tested by now - * When it specifies it 'may' fail and not 'shall' fail, - it will always return PASS, but will return a - PASS and print out a warning if it fails. -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_trylock/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/1-1.c deleted file mode 100644 index ef7a0247ee..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/1-1.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_unlock() - * shall release the mutex object 'mutex'. - - * Steps: - * -- Initilize a mutex object - * -- Get the mutex using pthread_mutex_lock() - * -- Release the mutex using pthread_mutex_unlock() - * -- Try to get the mutex using pthread_mutex_trylock() - * -- Release the mutex using pthread_mutex_unlock() - * - */ - -#include -#include -#include -#include "posixtest.h" - -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - -int main() -{ - int rc; - - /* Get the mutex using pthread_mutex_lock() */ - if((rc=pthread_mutex_lock(&mutex)) != 0) { - fprintf(stderr,"Error at pthread_mutex_lock(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Release the mutex using pthread_mutex_unlock() */ - if((rc=pthread_mutex_unlock(&mutex)) != 0) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Get the mutex using pthread_mutex_trylock() */ - if((rc=pthread_mutex_trylock(&mutex)) != 0) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* Release the mutex using pthread_mutex_unlock() */ - if((rc=pthread_mutex_unlock(&mutex)) != 0) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c deleted file mode 100644 index b141953cc7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutex_unlock() - * If there are threads blocked on the mutex object referenced by 'mutex' when - * pthread_mutex_unlock() is called, resulting in the mutex becoming available, - * the scheduling policy shall determine which thread shall acquire the mutex. - - * NOTES: - * The default scheduling policy is implementation dependent, thus this case - * will only demo the scheduling sequence instead of testing it. - - * Steps: - * -- Initialize a mutex to protect a global variable 'value' - * -- Create N threads. Each is looped M times to acquire the mutex, - increase the value, and then release the mutex. - * -- Check if the value has increased properly (M*N); a broken mutex - implementation may cause lost augments. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -#define THREAD_NUM 6 -#define LOOPS 3 - -void *func(void *parm); - -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -int value; /* value protected by mutex */ - -int main() -{ - int i, rc; - pthread_t threads[THREAD_NUM]; - - /* Create threads */ - fprintf(stderr,"Creating %d threads\n", THREAD_NUM); - for (i=0; i -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutex_t mutex; - int rc; - - /* Initialize a mutex object */ - if((rc=pthread_mutex_init(&mutex,NULL)) != 0) { - fprintf(stderr,"Error at pthread_mutex_init(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - if((rc=pthread_mutex_lock(&mutex)) != 0) { - fprintf(stderr,"Error at pthread_mutex_lock(), rc=%d\n",rc); - return PTS_UNRESOLVED; - } - - /* Release the mutex using pthread_mutex_unlock() */ - if((rc=pthread_mutex_unlock(&mutex)) == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - /* Check if returned values are tolerable */ - else if(rc == EPERM) { - fprintf(stderr,"Current thread does not own the mutex\n"); - return PTS_UNRESOLVED; - } - else if(rc == EINVAL) { - fprintf(stderr,"Invalid mutex object\n"); - return PTS_UNRESOLVED; - } - else if(rc == EAGAIN) { - fprintf(stderr,"The maximum number of recursive locks has been exceeded\n"); - return PTS_UNRESOLVED; - } - - /* Any other returned value means the test failed */ - else { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/5-1.c deleted file mode 100644 index 1920e36012..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/5-1.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, 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 error is returned. - - * The steps are: - * -> Initialize and lock a recursive mutex - * -> create a child thread which tries to unlock this mutex. * - */ - - /* - * - adam.li@intel.com 2004-05-20 - * Add to PTS. Please refer to http://nptl.bullopensource.org/phpBB/ - * for general information - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We enable the following line to have mutex attributes defined */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - - #include /* needed for EPERM test */ - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -pthread_mutex_t m; - -/** child thread function **/ -void * threaded(void * arg) -{ - int ret; - ret = pthread_mutex_unlock(&m); - if (ret == 0) - { UNRESOLVED(ret, "Unlocking a not owned recursive mutex succeeded"); } - - if (ret != EPERM) /* This is a "may" assertion */ - output("Unlocking a not owned recursive mutex did not return EPERM\n"); - - return NULL; -} - -/** parent thread function **/ -int main(int argc, char * argv[]) -{ - int ret; - pthread_mutexattr_t ma; - pthread_t th; - - output_init(); - - #if VERBOSE >1 - output("Initialize the PTHREAD_MUTEX_RECURSIVE mutex\n"); - #endif - - ret = pthread_mutexattr_init(&ma); - if (ret != 0) - { UNRESOLVED(ret, "Mutex attribute init failed"); } - - ret = pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE); - if (ret != 0) - { UNRESOLVED(ret, "Set type recursive failed"); } - - ret = pthread_mutex_init(&m, &ma); - if (ret != 0) - { UNRESOLVED(ret, "Mutex init failed"); } - - #if VERBOSE >1 - output("Lock the mutex\n"); - #endif - - ret = pthread_mutex_lock(&m); - if (ret != 0) - { UNRESOLVED(ret, "Mutex lock failed"); } - - /* destroy the mutex attribute object */ - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) - { UNRESOLVED(ret, "Mutex attribute destroy failed"); } - - #if VERBOSE >1 - output("Create the thread\n"); - #endif - - ret = pthread_create(&th, NULL, threaded, NULL); - if (ret != 0) - { UNRESOLVED(ret, "Thread creation failed"); } - - /* Let the thread terminate */ - ret = pthread_join(th, NULL); - if (ret != 0) - { UNRESOLVED(ret, "Thread join failed"); } - - #if VERBOSE >1 - output("Joined the thread\n"); - #endif - - /* We can clean everything and exit */ - ret = pthread_mutex_unlock(&m); - if (ret != 0) - { UNRESOLVED(ret, "Mutex unlock failed. Mutex got corrupted?"); } - - PASSED; -} -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/5-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/5-2.c deleted file mode 100644 index 7ea6784f7b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/5-2.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, 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 error 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. - */ - - /* - * - adam.li@intel.com 2004-05-20 - * Add to PTS. Please refer to http://nptl.bullopensource.org/phpBB/ - * for general information - */ - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* We enable the following line to have mutex attributes defined */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - - -/** parent thread function **/ -int main(int argc, char * argv[]) -{ - int ret; - pthread_mutexattr_t ma; - pthread_mutex_t m; - - output_init(); - - #if VERBOSE >1 - output("Initialize the PTHREAD_MUTEX_RECURSIVE mutex\n"); - #endif - - ret = pthread_mutexattr_init(&ma); - if (ret != 0) - { UNRESOLVED(ret, "Mutex attribute init failed"); } - - ret = pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE); - if (ret != 0) - { UNRESOLVED(ret, "Set type recursive failed"); } - - ret = pthread_mutex_init(&m, &ma); - if (ret != 0) - { UNRESOLVED(ret, "Mutex init failed"); } - - #if VERBOSE >1 - output("Unlock unlocked mutex\n"); - #endif - - ret = pthread_mutex_unlock(&m); - if (ret == 0) - { FAILED("Unlocking an unlocked recursive mutex succeeded"); } - - #if VERBOSE >1 - output("Lock and unlock the mutex\n"); - #endif - - ret = pthread_mutex_lock(&m); - if (ret != 0) - { UNRESOLVED(ret, "Mutex lock failed"); } - ret = pthread_mutex_lock(&m); - if (ret != 0) - { UNRESOLVED(ret, "Mutex recursive lock failed"); } - ret = pthread_mutex_unlock(&m); - if (ret != 0) - { UNRESOLVED(ret, "Mutex unlock failed"); } - ret = pthread_mutex_unlock(&m); - if (ret != 0) - { UNRESOLVED(ret, "Mutex recursive unlock failed"); } - - /* destroy the mutex attribute object */ - ret = pthread_mutexattr_destroy(&ma); - if (ret != 0) - { UNRESOLVED(ret, "Mutex attribute destroy failed"); } - - ret = pthread_mutex_unlock(&m); - if (ret == 0) - { FAILED("Unlocking an unlocked recursive mutex succeeded"); } - - PASSED; -} -#else /* WITHOUT_XOPEN */ -int main(int argc, char * argv[]) -{ - output_init(); - UNTESTED("This test requires XSI features"); -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/assertions.xml deleted file mode 100644 index fd3db8e0b5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/assertions.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - The function - int pthread_mutex_unlock(pthread_mutex_t *mutex); - - releases the mutex object 'mutex'. - - - - If there are threads blocked on the mutex object referenced by 'mutex' when - pthread_mutex_unlock() is called, resulting in the mutex becoming available, - the scheduling policy shall determine which thread shall acquire the mutex. - - - - Upon success, it returns 0. - - - - Upon failure, it may return: - -[EINVAL] 'mutex' does not refer to an initialized mutex object - -[EPERM] The current thread does not own 'mutex' - - It shall not return [EINTR]. - - - If the mutex type is PTHREAD_MUTEX_RECURSIVE: - 1. If a thread attempts to unlock a mutex that it does not own - 2. or an unlocked mutex, - an error is returned. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/coverage.txt deleted file mode 100644 index f05b07ffc3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/coverage.txt +++ /dev/null @@ -1,15 +0,0 @@ -This document defines the coverage for the pthread_mutex_unlock function: - -Assertion Tested? -1 YES -2 YES * Because the default scheduling policy is implementation - dependent, the case only will only demo the scheduling - sequence instead of testing it. -3 YES -4 NO * The related error codes are all implementation dependent - * Keeping in mind it 'may' fail and not 'shall' fail, - so it will always return PASS, but will return a - PASS and print out a warning if it fails. -5 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/testfrmw.c deleted file mode 100644 index 575dbe8c3e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/testfrmw.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - pthread_mutex_lock(&m_trace); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/testfrmw.h deleted file mode 100644 index 3fd8c3a3c9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutex_unlock/testfrmw.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i on line %i (%s)\n", __FILE__, x, __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i on line %i (%s)\n", x, __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/1-1.c deleted file mode 100644 index ab39f20018..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/1-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_destroy() - * shall destroy a mutex attributes object. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object using pthread_mutexattr_init() - * 2. Destroy the attributes object using pthread_mutexattr_destroy() - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_mutexattr_t mta; - int rc; - - /* Initialize a mutex attributes object */ - if((rc=pthread_mutexattr_init(&mta)) != 0) - { - fprintf(stderr,"Cannot initialize mutex attributes object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy the mutex attributes object */ - if(pthread_mutexattr_destroy(&mta) != 0) - { - fprintf(stderr,"Error at pthread_mutexattr_destroy(), rc=%d\n", rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/2-1.c deleted file mode 100644 index b61b12834e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/2-1.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutexattr_destroy() - * A destroyed 'attr' attributes object can be reinitialized using - * pthread_mutexattr_init(); the results of otherwise referencing the - * object after it has been destroyed are undefined. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object using pthread_mutexattr_init() - * 2. Destroy that initialized attribute using pthread_mutexattr_destroy() - * 3. Initialize the pthread_mutexattr_t object again. This should not result - * in any error. - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_mutexattr_t mta; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - fprintf(stderr,"Cannot initialize mutex attributes object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy the mutex attributes object */ - if(pthread_mutexattr_destroy(&mta) != 0) - { - fprintf(stderr,"Cannot destroy the mutex attributes object\n"); - return PTS_UNRESOLVED; - } - - /* Initialize the mutex attributes object again. This shouldn't result in an error. */ - if(pthread_mutexattr_init(&mta) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/3-1.c deleted file mode 100644 index 3b1118b6b8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/3-1.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutexattr_destroy() - * Upon successful completion, pthread_mutexattr_destroy() shall - * return a value of 0. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object using pthread_mutexattr_init() - * 2. Destroy that initialized attribute using pthread_mutexattr_destroy(). - * This should return 0; - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_mutexattr_t mta; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - fprintf(stderr,"Cannot initialize mutex attributes object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy the mutex attributes object */ - if(pthread_mutexattr_destroy(&mta) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/4-1.c deleted file mode 100644 index 6f6c679c0a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/4-1.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutexattr_destroy() - * If it fails, an error number shall be returned to indicate the error: - * [EINVAL] The value specified by 'attr' is invalid - * - * Steps: - * Try to destroy a NULL mutex attributes object using pthread_mutexattr_destroy(). - * If it returns EINVAL, the test passes. - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_mutexattr_t *mta=NULL; - int rc; - - /* Try to destroy a NULL mutex attributes object using pthread_mutexattr_destroy() - * It should return EINVAL */ - if((rc=pthread_mutexattr_destroy(mta)) == EINVAL) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - printf("Test PASSED: *NOTE: Expect %d(EINVAL), but return %d, though standard states 'may' fail\n", EINVAL, rc); - return PTS_PASS; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/assertions.xml deleted file mode 100644 index 0c7a268dff..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/assertions.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - The function - int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) - - destroys a mutex attributes object; the object becomes, in effect, - uninitialized. An implementation may cause pthread_mutexattr_destroy() - to set the object referenced by 'attr' to an invalid value. - - *NOTE: What the last sentence states is implementation specific, thus - it will not be covered. - - - A destroyed 'attr' attributes object can be reinitialized using - pthread_mutexattr_init(); the results of referencing an 'attr' object - after it has been destroyed are undefined. - - - If success, it returns 0. - - - An error number may be returned if: - - [EINVAL] The value specified by 'attr' is invalid - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/coverage.txt deleted file mode 100644 index cf790be42c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_destroy/coverage.txt +++ /dev/null @@ -1,10 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_destroy function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES ** Keeping in mind it 'may' fail and not 'shall' fail, - so it will always return PASS, but will return a - PASS and print out a warning if it fails. -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/1-1.c deleted file mode 100644 index 184b26c667..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/1-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_getprioceiling() - * - * Gets the priority ceiling attribute of a mutexattr object (which was prev. created - * by the function pthread_mutexattr_init()). - * - * Steps:i - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Call pthread_mutexattr_getprioceiling() to obtain the prioceiling. - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is prioceiling capability. */ - /* #ifndef _POSIX_PRIORITY_SCHEDULING - fprintf(stderr,"prioceiling attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif */ - - pthread_mutexattr_t mta; - int prioceiling, max_prio, min_prio; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Get the prioceiling mutex attr. */ - if(pthread_mutexattr_getprioceiling(&mta, &prioceiling) != 0) - { - fprintf(stderr,"Error obtaining the attribute process-shared\n"); - return PTS_UNRESOLVED; - } - - /* Get the max and min prio according to SCHED_FIFO (posix scheduling policy) */ - max_prio = sched_get_priority_max(SCHED_FIFO); - min_prio = sched_get_priority_min(SCHED_FIFO); - - /* Make sure that prioceiling is withing the legal SCHED_FIFO boundries. */ - if((prioceiling < min_prio) || (prioceiling > max_prio)) - { - printf("Test FAILED: Default prioceiling %d is not compliant with SCHED_FIFO boundry. \n", prioceiling); - return PTS_FAIL; - } - - printf("Test PASSED: Prioceiling %d\n", prioceiling); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/1-2.c deleted file mode 100644 index d483cb5bc8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/1-2.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_getprioceiling() - * - * Gets the priority ceiling attribute of a mutexattr object (which was prev. created - * by the function pthread_mutexattr_init()). - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Get the min and max boundries for SCHED_FIFO of what prioceiling can be. - * 3. In a for loop, go through each valid SCHED_FIFO value, set the prioceiling, then - * get the prio ceiling. These should always be the same. If not, fail the test. - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is prioceiling capability. */ - /* #ifndef _POSIX_PRIORITY_SCHEDULING - fprintf(stderr,"prioceiling attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif */ - - pthread_mutexattr_t mta; - int prioceiling, max_prio, min_prio, i; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Get the max and min prio according to SCHED_FIFO (posix scheduling policy) */ - max_prio = sched_get_priority_max(SCHED_FIFO); - min_prio = sched_get_priority_min(SCHED_FIFO); - - for(i=min_prio;(i -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - int prioceiling, ret; - pthread_mutexattr_t mta; - - /* Get the prioceiling of an unintialized mutex attr. */ - if((ret=pthread_mutexattr_getprioceiling(&mta, &prioceiling)) == 0) - { - printf("Test PASSED: *Note: Returned 0 instead of EINVAL when passed an uninitialized mutex attribute object to pthread_mutexattr_getprioceiling, but standard says 'may' fail.\n"); - return PTS_PASS; - - }else if(ret != EINVAL) - { - printf("Test FAILED: Invalid return code %d. Expected EINVAL or 0.\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/assertions.xml deleted file mode 100644 index 8dc9bf4dd8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/assertions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - The function - - int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *restrict attr, - int *restrict prioceiling); - - Gets the priority ceiling attribute of a mutexattr object (which was prev. created - by the function pthread_mutexattr_init()). - - - Upon success, it returns 0, and stores the value of the prioceiling in 'prioceiling'. - - - It MAY fail if: - - [EINVAL] - 'attr' or 'prioceiling' is invalid. - [EPERM] - The caller doesn't have the privilege to perform the operation. - - Shall not return an error code of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/coverage.txt deleted file mode 100644 index 2baa4d584c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprioceiling/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_getprioceiling function: - -Assertion Tested? -1 YES -2 YES -3 NO. Only test [EINVAL] - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/1-1.c deleted file mode 100644 index 0a91139397..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/1-1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_getprotocol() - * - * Gets the protocol attribute of a mutexattr object (which was prev. created - * by the function pthread_mutexattr_init()). - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Call pthread_mutexattr_getprotocol() to obtain the protocol. - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - pthread_mutexattr_t mta; - int protocol,rc; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Get the protocol mutex attr. */ - if((rc=pthread_mutexattr_getprotocol(&mta, &protocol)) != 0) - { - printf("Test FAILED: Error in pthread_mutexattr_getprotocol rc=%d\n", rc); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/1-2.c deleted file mode 100644 index 65b312cf90..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/1-2.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_getprotocol() - * - * Gets the protocol attribute of a mutexattr object (which was prev. created - * by the function pthread_mutexattr_init()). - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - pthread_mutexattr_t mta; - int protocol, protcls[3],i; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - protcls[0]=PTHREAD_PRIO_NONE; - protcls[1]=PTHREAD_PRIO_INHERIT; - protcls[2]=PTHREAD_PRIO_PROTECT; - - for(i=0;i<3;i++) - { - /* Set the protocol to one of the 3 valid protocols. */ - if(pthread_mutexattr_setprotocol(&mta,protcls[i])) - { - printf("Error setting protocol to %d\n", protcls[i]); - return PTS_UNRESOLVED; - } - - /* Get the protocol mutex attr. */ - if(pthread_mutexattr_getprotocol(&mta, &protocol) != 0) - { - fprintf(stderr,"Error obtaining the protocol attribute.\n"); - return PTS_UNRESOLVED; - } - - /* Make sure that the protocol set is the protocl we get when calling - * pthread_mutexattr_getprocol() */ - if(protocol != protcls[i]) - { - printf("Test FAILED: Set protocol %d, but instead got protocol %d.\n", protcls[i], protocol); - return PTS_FAIL; - } - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/assertions.xml deleted file mode 100644 index f7aa45353f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/assertions.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - The function - - int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict attr, - int *restrict protocol); - - Gets the protocol attribute of a mutexattr object (which was prev. created - by the function pthread_mutexattr_init()). - - - Upon success, it returns 0. - - - It MAY fail if: - - [EINVAL] - 'attr' or 'protocol' is invalid. - [EPERM] - The caller doesn't have the privilege to perform the operation. - - Shall not return error code of [EINTR]. - - - - When a thread owns a mutex with the PTHREAD_PRIO_NONE protocol attribute, - its priority and scheduling shall not be affected by its mutex ownership. - - - - When a thread is blocking higher priority threads because of owning one or - more mutexes with the PTHREAD_PRIO_INHERIT protocol attribute, it shall - execute at the higher of its priority or the priority of the highest priority - thread waiting on any of the mutexes owned by this thread and initialized - with this protocol. - - - - When a thread owns one or more mutexes initialized with the PTHREAD_PRIO_PROTECT - protocol, it shall execute at the higher of its priority or the highest of the - priority ceilings of all the mutexes owned by this thread and initialized with - this attribute, regardless of whether other threads are blocked on any of these - mutexes or not. - - - - - While a thread is holding a mutex which has been initialized with the - PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT protocol attributes, it shall - not be subject to being moved to the tail of the scheduling queue at its - priority in the event that its original priority is changed, such as by a call - to sched_setparam( ). Likewise, when a thread unlocks a mutex that has been - initialized with the PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT protocol - attributes, it shall not be subject to being moved to the tail of the scheduling - queue at its priority in the event that its original priority is changed. - - - - - If a thread simultaneously owns several mutexes initialized with different - protocols, it shall execute at the highest of the priorities that it would - have obtained by each of these protocols. - - - - - When a thread makes a call to pthread_mutex_lock( ), the mutex was initialized - with the protocol attribute having the value PTHREAD_PRIO_INHERIT, when the - calling thread is blocked because the mutex is owned by another thread, that - owner thread shall inherit the priority level of the calling thread as long as - it continues to own the mutex. The implementation shall update its execution - priority to the maximum of its assigned priority and all its inherited priorities. - Furthermore, if this owner thread itself becomes blocked on another mutex, - the same priority inheritance effect shall be propagated to this other owner - thread, in a recursive manner - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/coverage.txt deleted file mode 100644 index e262e0aa1e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getprotocol/coverage.txt +++ /dev/null @@ -1,13 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_getprotocol function: - -Assertion Tested? -1 YES -2 YES -3 NO -4 NO -5 No -6 No -7 NO -8 NO -9 NO -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/1-1.c deleted file mode 100644 index 5894b2dcfd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/1-1.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_getpshared() - * - * It shall obtain the value of the process-shared attribute from 'attr'. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Call pthread_mutexattr_getpshared() to check if the process-shared - * attribute is set as the default value PTHREAD_PROCESS_PRIVATE. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_mutexattr_t mta; - int pshared; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* The default 'pshared' attribute should be PTHREAD_PROCESS_PRIVATE */ - if(pthread_mutexattr_getpshared(&mta, &pshared) != 0) - { - fprintf(stderr,"Error obtaining the attribute process-shared\n"); - return PTS_UNRESOLVED; - } - - if(pshared != PTHREAD_PROCESS_PRIVATE) - { - printf("Test FAILED: Incorrect default pshared value: %d\n", pshared); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/1-2.c deleted file mode 100644 index f8871d8925..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/1-2.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_getpshared() - * - * It shall obtain the value of the process-shared attribute from 'attr'. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Set 'pshared' of the object to PTHREAD_PROCESS_SHARED. - * 3. Call pthread_mutexattr_getpshared() to check if the process-shared - * attribute is set as PTHREAD_PROCESS_SHARED. - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_mutexattr_t mta; - int ret; - int pshared; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set 'pshared' to PTHREAD_PROCESS_SHARED. */ - ret=pthread_mutexattr_setpshared(&mta, PTHREAD_PROCESS_SHARED); - if(ret != 0) - { - printf("Error in pthread_mutexattr_setpshared(), error: %d\n", ret); - return PTS_UNRESOLVED; - } - - /* Get 'pshared'. */ - if(pthread_mutexattr_getpshared(&mta, &pshared) != 0) - { - fprintf(stderr,"Error obtaining the attribute process-shared\n"); - return PTS_UNRESOLVED; - } - - if(pshared != PTHREAD_PROCESS_SHARED) - { - printf("Test FAILED: Incorrect pshared value: %d\n", pshared); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/1-3.c deleted file mode 100644 index ccb0cc161a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/1-3.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_getpshared() - * - * It shall obtain the value of the process-shared attribute from 'attr'. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Set 'pshared' of the object to PTHREAD_PROCESS_PRIVATE. - * 3. Call pthread_mutexattr_getpshared() to check if the process-shared - * attribute is set as PTHREAD_PROCESS_PRIVATE. - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_mutexattr_t mta; - int ret; - int pshared; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set 'pshared' to PTHREAD_PROCESS_PRIVATE. */ - ret=pthread_mutexattr_setpshared(&mta, PTHREAD_PROCESS_PRIVATE); - if(ret != 0) - { - printf("Error in pthread_mutexattr_setpshared(), error: %d\n", ret); - return PTS_UNRESOLVED; - } - - /* Get 'pshared'. It should be PTHREAD_PROCESS_PRIVATE. */ - if(pthread_mutexattr_getpshared(&mta, &pshared) != 0) - { - fprintf(stderr,"Error obtaining the attribute process-shared\n"); - return PTS_UNRESOLVED; - } - - if(pshared != PTHREAD_PROCESS_PRIVATE) - { - printf("Test FAILED: Incorrect pshared value: %d\n", pshared); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/2-1.sh deleted file mode 100755 index c8e7a768f7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/2-1.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_mutexattr_getpshared() fails and an error number is returned if: -# -# Upon success, it returns 0, and stores the value of the process-shared attribute of 'attr' -# into 'pshared'. -# - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/3-1.c deleted file mode 100644 index d53c14ef06..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/3-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_getpshared() - * - * It MAY fail if: - * - * [EINVAL] - 'attr' is invalid. - * - * Steps: - * 1. Pass to pthread_mutexattr_getpshared() an uninitialized and invalid 'attr' object. - * 2. The error code returned may be EINVAL. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_mutexattr_t mta; - int ret; - int pshared; - - /* Pass the uninitialized and invalid 'attr' object.*/ - memset(&mta, 0, sizeof(mta)); - - /* The default 'pshared' attribute should be PTHREAD_PROCESS_PRIVATE */ - ret=pthread_mutexattr_getpshared(&mta, &pshared); - if(ret != 0) - { - if(ret == EINVAL) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED: Incorrect return code. Expected 0 or EINVAL, got: %d\n", ret); - return PTS_FAIL; - - } - - printf("Test PASSED: NOTE*: Returned 0 on error, though standard states 'may' fail.\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/assertions.xml deleted file mode 100644 index 0fc5fe3ce6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/assertions.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - The function - - int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict attr, - int *restrict pshared); - - It shall obtain the value of the process-shared attribute from 'attr'. - - - Upon success, it returns 0, and stores the value of the process-shared attribute of 'attr' - into 'pshared'. - - - It MAY fail if: - - [EINVAL] - 'attr' is invalid. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/coverage.txt deleted file mode 100644 index 04ce8235a1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_getpshared/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_getpshared function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-1.c deleted file mode 100644 index 2c7f616e9b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_gettype() - * - * Gets the mutex 'type' attribute. This attribute is set in the 'type' parameter to - * these functions. The default value is PTHREAD_MUTEX_DEFAULT. - * - * Testing the default 'type' value. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Call pthread_mutexattr_gettype() to check if type - * attribute is set as the default value PTHREAD_MUTEX_DEFAULT. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - int type; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* The default 'type' attribute should be PTHREAD_MUTEX_DEFAULT */ - if(pthread_mutexattr_gettype(&mta, &type) != 0) - { - fprintf(stderr,"pthread_mutexattr_gettype(): Error obtaining the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - if(type != PTHREAD_MUTEX_DEFAULT) - { - printf("Test FAILED: Incorrect default mutexattr 'type' value: %d\n", type); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-2.c deleted file mode 100644 index 98f276a409..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-2.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_gettype() - * - * Gets the mutex 'type' attribute. This attribute is set in the 'type' parameter to - * these functions. The default value is PTHREAD_MUTEX_DEFAULT. - * - * Testing the PTHREAD_MUTEX_DEFAULT type. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Set tye mutexattr type to PTHREAD_MUTEX_DEFAULT - * 3. Call pthread_mutexattr_gettype() to check if type - * attribute is set as the default value PTHREAD_MUTEX_DEFAULT. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - int type; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the mutex attribute 'type' to PTHREAD_MUTEX_DEFAULT. */ - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_DEFAULT) != 0) - { - fprintf(stderr,"pthread_mutexattr_settype(): Error setting the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - /* The 'type' attribute should be PTHREAD_MUTEX_DEFAULT */ - if(pthread_mutexattr_gettype(&mta, &type) != 0) - { - fprintf(stderr,"pthread_mutexattr_gettype(): Error obtaining the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - if(type != PTHREAD_MUTEX_DEFAULT) - { - printf("Test FAILED: Incorrect mutexattr 'type' value: %d. Should be PTHREAD_MUTEX_DEFAULT\n", type); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-3.c deleted file mode 100644 index b792a29bf8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-3.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_gettype() - * - * Gets the mutex 'type' attribute. This attribute is set in the 'type' parameter to - * these functions. The default value is PTHREAD_MUTEX_DEFAULT. - * - * Testing the PTHREAD_MUTEX_NORMAL type. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Set tye mutexattr type to PTHREAD_MUTEX_NORMAL - * 3. Call pthread_mutexattr_gettype() to check if type - * attribute is set as the value PTHREAD_MUTEX_NORMAL. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - int type; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the mutex attribute 'type' to PTHREAD_MUTEX_NORMAL. */ - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_NORMAL) != 0) - { - fprintf(stderr,"pthread_mutexattr_settype(): Error setting the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - /* The 'type' attribute should be PTHREAD_MUTEX_NORMAL */ - if(pthread_mutexattr_gettype(&mta, &type) != 0) - { - fprintf(stderr,"pthread_mutexattr_gettype(): Error obtaining the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - if(type != PTHREAD_MUTEX_NORMAL) - { - printf("Test FAILED: Incorrect mutexattr 'type' value: %d. Should be PTHREAD_MUTEX_NORMAL\n", type); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-4.c deleted file mode 100644 index 29d9710eb9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-4.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_gettype() - * - * Gets the mutex 'type' attribute. This attribute is set in the 'type' parameter to - * these functions. The default value is PTHREAD_MUTEX_DEFAULT. - * - * Testing the PTHREAD_MUTEX_ERRORCHECK type. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Set tye mutexattr type to PTHREAD_MUTEX_ERRORCHECK - * 3. Call pthread_mutexattr_gettype() to check if type - * attribute is set as the value PTHREAD_MUTEX_ERRORCHECK. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - int type; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the mutex attribute 'type' to PTHREAD_MUTEX_ERRORCHECK. */ - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_ERRORCHECK) != 0) - { - fprintf(stderr,"pthread_mutexattr_settype(): Error setting the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - /* The 'type' attribute should be PTHREAD_MUTEX_ERRORCHECK */ - if(pthread_mutexattr_gettype(&mta, &type) != 0) - { - fprintf(stderr,"pthread_mutexattr_gettype(): Error obtaining the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - if(type != PTHREAD_MUTEX_ERRORCHECK) - { - printf("Test FAILED: Incorrect mutexattr 'type' value: %d. Should be PTHREAD_MUTEX_ERRORCHECK\n", type); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-5.c deleted file mode 100644 index a1a7a3b39e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/1-5.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_gettype() - * - * Gets the mutex 'type' attribute. This attribute is set in the 'type' parameter to - * these functions. The default value is PTHREAD_MUTEX_DEFAULT. - * - * Testing the PTHREAD_MUTEX_RECURSIVE type. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Set tye mutexattr type to PTHREAD_MUTEX_RECURSIVE - * 3. Call pthread_mutexattr_gettype() to check if type - * attribute is set as the value PTHREAD_MUTEX_RECURSIVE. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - int type; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the mutex attribute 'type' to PTHREAD_MUTEX_RECURSIVE. */ - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE) != 0) - { - fprintf(stderr,"pthread_mutexattr_settype(): Error setting the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - /* The 'type' attribute should be PTHREAD_MUTEX_RECURSIVE */ - if(pthread_mutexattr_gettype(&mta, &type) != 0) - { - fprintf(stderr,"pthread_mutexattr_gettype(): Error obtaining the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - if(type != PTHREAD_MUTEX_RECURSIVE) - { - printf("Test FAILED: Incorrect mutexattr 'type' value: %d. Should be PTHREAD_MUTEX_RECURSIVE\n", type); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/2.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/2.sh deleted file mode 100755 index e25c725201..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/2.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_mutexattr_gettype() - -# It returns 0 upon success and stores the value of the type of the attribute object 'attr' -# into the reference of the 'type' parameter. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/assertions.xml deleted file mode 100644 index 075e2f952e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/assertions.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - The function - - int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *restrict type); - - Gets the mutex 'type' attribute. This attribute is set in the 'type' parameter to - these functions. The default value is PTHREAD_MUTEX_DEFAULT. - - - - It returns 0 upon success and stores the value of the type of the attribute object 'attr' - into the reference of the 'type' parameter. - - - It shall fail if: - - [EINVAL] - The value specified by 'attr' is invalid. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/coverage.txt deleted file mode 100644 index 720497a775..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_gettype function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/speculative/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/speculative/3-1.c deleted file mode 100644 index 7a2af54a7c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_gettype/speculative/3-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_gettype() - * - * It shall fail if: - * - * [EINVAL] - The value specified by 'attr' is invalid. - * - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Call pthread_mutexattr_gettype() with an invalid 'attr'. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" -#include - -int main() -{ - pthread_mutexattr_t mta; - int type, ret; - - /* Make 'attr' invalid by not initializing it and using memset. */ - memset(&mta, 0, sizeof(mta)); - - /* Pass an invalid 'attr'. */ - ret=pthread_mutexattr_gettype(&mta, &type); - - if(ret != EINVAL) - { - printf("Test FAILED: Incorrect return code. Expected EINVAL, but got: %d\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/1-1.c deleted file mode 100644 index e84e7f4e6b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/1-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_init() - * shall initialize a mutex attributes object 'attr' with the default - * value for all of the attributes defined by the implementation. - - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Call pthread_mutexattr_getpshared() to check if the process-shared - * attribute is set as the default value PTHREAD_PROCESS_PRIVATE. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - int rc; - -#ifdef PTHREAD_PROCESS_SHARED - int pshared; -#endif - /* Initialize a mutex attributes object */ - if((rc=pthread_mutexattr_init(&mta)) != 0) - { - fprintf(stderr,"Error at pthread_mutexattr_init(), rc=%d\n",rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - -#ifdef PTHREAD_PROCESS_SHARED - /* If the symbol {PTHREAD_PROCESS_SHARED} is defined, the attribute - * process-shared should be provided and its default value should be - * PTHREAD_PROCESS_PRIVATE */ - if(pthread_mutexattr_getpshared(&mta, &pshared) != 0) - { - fprintf(stderr,"Error obtaining the attribute process-shared\n"); - return PTS_UNRESOLVED; - } - - if(pshared == PTHREAD_PROCESS_PRIVATE) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -#endif - - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/3-1.c deleted file mode 100644 index a451d70985..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/3-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_init() - * Upon successful completion, pthread_mutexattr_init() shall return a value of 0. - - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. ENOMEM is the only error it returns, so if it doesn't return that error, - * the return number should be 0. - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - int rc; - - /* Initialize a mutex attributes object */ - if((rc=pthread_mutexattr_init(&mta)) == 0) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - - /* Insufficient memory exists to initialize the mutex attributes object */ - else if(rc == ENOMEM) - { - fprintf(stderr,"pthread_mutexattr_init() returns ENOMEM\n"); - return PTS_UNRESOLVED; - } - - /* Any other returned value means the test failed */ - else - { - printf("Test FAILED\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/assertions.xml deleted file mode 100644 index fe97876f75..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/assertions.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - The function - - int pthread_mutexattr_init(pthread_mutexattr_t *attr) - - initializes a mutex attributes object 'attr' with the default - value for all of the attributes defined by the implementation. Results - are undefined if it is called specifying an already initialized 'attr' - attributes object. - - - After a mutex attributes object has been used to initialize one or more - mutexes, any function affecting the attributes object (including destruction) - shall not affect any previously initialized mutexes. - - - Upon success it returns 0. - - - If it fails, an error number shall be returned: - [ENOMEM] - Insufficient memory exists to initialize the mutex attributes - object. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/coverage.txt deleted file mode 100644 index c2f50631a6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_init/coverage.txt +++ /dev/null @@ -1,13 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_init function: - -Assertion Tested? -1 YES -2 NO *Looking for indicators to judge if initialized mutexes - are affected. The prioceiling or protocol attributes may - be relied on, but they belong to REALTIME_THREADS scope, - which is low priority in the schedule. -3 YES -4 NO *Looking for a way to use up the memory without screwing - up the machine. - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/1-1.c deleted file mode 100644 index 2402f3d887..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/1-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_setprioceiling() - * - * Sets the priority ceiling attribute of a mutexattr object (which was prev. created - * by the function pthread_mutexattr_init()). - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Get the min and max boundries for SCHED_FIFO of what prioceiling can be. - * 3. In a for loop, go through each valid SCHED_FIFO value, set the prioceiling. - * - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is prioceiling capability. */ - /* #ifndef _POSIX_PRIORITY_SCHEDULING - fprintf(stderr,"prioceiling attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif */ - - pthread_mutexattr_t mta; - int max_prio, min_prio, i; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Get the max and min prio according to SCHED_FIFO (posix scheduling policy) */ - max_prio = sched_get_priority_max(SCHED_FIFO); - min_prio = sched_get_priority_min(SCHED_FIFO); - - for(i=min_prio;(i -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is prioceiling capability. */ - /* #ifndef _POSIX_PRIORITY_SCHEDULING - fprintf(stderr,"prioceiling attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif */ - - pthread_mutexattr_t mta; - int prioceiling, ret; - - prioceiling = sched_get_priority_min(SCHED_FIFO); - - /* Set the prioceiling of an unintialized mutex attr. */ - if((ret=pthread_mutexattr_setprioceiling(&mta,prioceiling)) == 0) - { - printf("Test PASSED: *Note: Returned 0 instead of EINVAL when passed an uninitialized mutex attribute object to pthread_mutexattr_setprioceiling, but standard says 'may' fail.\n"); - return PTS_PASS; - } - - if(ret != EINVAL) - { - printf("Test FAILED: Invalid return code %d. Expected EINVAL or 0.\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/3-2.c deleted file mode 100644 index d4975b9c8f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/3-2.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_setprioceiling() - * - * It MAY fail if: - * - * [EINVAL] - 'attr' or 'prioceiling' is invalid. - * [EPERM] - The caller doesn't have the privilege to perform the operation. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Call pthread_mutexattr_setprioceiling() with an invalid prioceiling value. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is prioceiling capability. */ - /* #ifndef _POSIX_PRIORITY_SCHEDULING - fprintf(stderr,"prioceiling attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif */ - - pthread_mutexattr_t mta; - int prioceiling, ret; - - /* Set 'prioceiling' out of SCHED_FIFO boundry. */ - prioceiling = sched_get_priority_max(SCHED_FIFO); - prioceiling++; - - /* Set the prioceiling to an invalid prioceiling. */ - if((ret=pthread_mutexattr_setprioceiling(&mta,prioceiling)) == 0) - { - printf("Test PASSED: *Note: Returned 0 instead of EINVAL when passed an invalid 'proceiling' to pthread_mutexattr_setprioceiling, but standard says 'may' fail.\n"); - return PTS_PASS; - } - - if(ret != EINVAL) - { - printf("Test FAILED: Invalid return code %d. Expected EINVAL or 0.\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/assertions.xml deleted file mode 100644 index 6f60e9a3f6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/assertions.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - The function - - int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, - int prioceiling); - - sets the priority ceiling attribute of a mutexattr object (which was prev. created - by the function pthread_mutexattr_init()). - - 'Prioceiling' contains the priority ceiling of initialized mutexes. The values of - 'prioceiling' are within the maximum range of priorites defined by SCHED_FIFO. - - - Upon success, it returns 0. - - - It MAY fail if: - - [EINVAL] - 'attr' or 'prioceiling' is invalid. - [EPERM] - The caller doesn't have the privilege to perform the operation. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/coverage.txt deleted file mode 100644 index 4bba138e4d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprioceiling/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_setprioceiling function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/1-1.c deleted file mode 100644 index 8e5c27aa9e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/1-1.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_setprotocol() - * - * Sets the protocol attribute of a mutexattr object (which was prev. created - * by the function pthread_mutexattr_init()). - * - * Steps: - * 1. In a for loop, call pthread_mutexattr_setprotocol with all the valid 'protocol' values. - * 2. In the for loop, then call pthread_mutexattr_getprotocol and ensure that the same - * value that was set was the same value that was retrieved from this function. - */ - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - pthread_mutexattr_t mta; - int protocol, protcls[3],i; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - protcls[0]=PTHREAD_PRIO_NONE; - protcls[1]=PTHREAD_PRIO_INHERIT; - protcls[2]=PTHREAD_PRIO_PROTECT; - - for(i=0;i<3;i++) - { - /* Set the protocol to one of the 3 valid protocols. */ - if(pthread_mutexattr_setprotocol(&mta,protcls[i]) != 0) - { - printf("Error setting protocol to %d\n", protcls[i]); - return PTS_UNRESOLVED; - } - - /* Get the protocol mutex attr. */ - if(pthread_mutexattr_getprotocol(&mta, &protocol) != 0) - { - fprintf(stderr,"Error obtaining the protocol attribute.\n"); - return PTS_UNRESOLVED; - } - - /* Make sure that the protocol set is the protocl we get when calling - * pthread_mutexattr_getprocol() */ - if(protocol != protcls[i]) - { - printf("Test FAILED: Set protocol %d, but instead got protocol %d.\n", protcls[i], protocol); - return PTS_FAIL; - } - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/2-2.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/2-2.sh deleted file mode 100755 index 92973404f1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/2-2.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Upon success, it returns 0, and stores the value of the prioceiling in 'prioceiling'. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/3-1.c deleted file mode 100644 index 3317a6849e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/3-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_setprotocol() - * - * It Shall fail if: - * [ENOTSUP] The value specified by protocol is an unsupported value. - * It may fail if: - * [EINVAL] 'protocol' is invalid - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define INVALID_PROTOCOL -1 - -int main() -{ - - pthread_mutexattr_t mta; - int protocol = INVALID_PROTOCOL; - - int ret; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - while(protocol == PTHREAD_PRIO_NONE || protocol == PTHREAD_PRIO_INHERIT - || protocol == PTHREAD_PRIO_PROTECT){ - protocol--; - } - - /* Set the protocol to an invalid value. */ - ret = pthread_mutexattr_setprotocol(&mta,protocol); - if((ret == ENOTSUP) || (ret == EINVAL)) - { - printf("Test PASSED\n"); - return PTS_PASS; - } else{ - - printf("Test FAILED: Expected error code ENOTSUP, got %d.\n", ret); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/3-2.c deleted file mode 100644 index 24156d8d0d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/3-2.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_setprotocol() - * - * It may fail if: - * [EINVAL] The value specified by 'attr' is invalid. - * - * Steps: - * 1. Call pthread_mutexattr_setprotocol with an uninitialized pthread_mutexattr_t object. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - pthread_mutexattr_t mta; - int ret; - - /* Set the protocol to an invalid value. */ - ret = pthread_mutexattr_setprotocol(&mta,PTHREAD_PRIO_NONE); - if(ret == EINVAL) - { - printf("Test PASSED\n"); - return PTS_PASS; - } else if (ret == 0){ - printf("Test PASSED: NOTE*: Expected error code EINVAL, got %d, though standard states 'may' fail.\n", ret); - return PTS_PASS; - } else { - printf("Test FAILED: Incorrect return code %d. Expected EINVAL or 0.\n", ret); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/assertions.xml deleted file mode 100644 index 52936049aa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/assertions.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - The function - - int pthread_mutexattr_setprotocol(const pthread_mutexattr_t *restrict attr, - int protocol); - - Sets the protocol attribute of a mutex attribute object which was prev. created - by the function pthread_mutexattr_init(). - - - - Upon success, it returns 0. - - - It Shall fail if: - [ENOTSUP] The value specified by protocol is an unsupported value. - - If may fail if: - [EINVAL] - 'attr' or 'protocol' is invalid. - [EPERM] - The caller doesn't have the privilege to perform the operation. - - Shall not return error code of [EINTR]. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/coverage.txt deleted file mode 100644 index 97cd8597e9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setprotocol/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_getprotocol function: - -Assertion Tested? -1 YES -2 YES -3 YES -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c deleted file mode 100644 index 9399faf41f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_setpshared() - * - * It shall set the process-shared attribute in an initialized attributes object 'attr'. - - * The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a mutex to be - * operated upon by any thread that has access to the memory where the mutex is allocated, - * even if the mutex is allocated in memory that is shared by multiple processes. - * - * If the process-shared attribute is PTHREAD_PROCESS_PRIVATE, the mutex shall only be - * operated upon by threads created within the same process as the thread that initialized - * the mutex; if threads of differing processes attempt to operate on such a mutex, - * the behavior is undefined. - * - * Steps: - * - * Explanation: To share a mutex between 2 processes, you need to map shared memory for - * the mutex. So whether the 'type' of the mutexattr is shared or private, it really will - * not make a difference since both processes will always have access to the shared memory - * as long as they the pointer to it. So all we check here is that you can actually call - * the pthread_mutexattr_setpshared() function, passing to it PTHREAD_PROCESS_SHARED and - * PTHREAD_PROCESS_PRIVATE. - * - * 1. Initialize a pthread_mutexattr_t object. - * 2. Call pthread_mutexattr_getpshared(), passing to it both PTHREAD_PROCESS_SHARE and - * PTHREAD_PROCESS_PRIVATE. - * - */ - -#include -#include -#include "posixtest.h" - -pthread_mutex_t new_mutex; /* The mutex. */ - - -int main() -{ - pthread_mutexattr_t mta; - int ret; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the 'pshared' attribute to PTHREAD_PROCESS_PRIVATE */ - if((ret=pthread_mutexattr_setpshared(&mta, PTHREAD_PROCESS_PRIVATE)) != 0) - { - printf("Test FAILED: Cannot set pshared attribute to PTHREAD_PROCESS_PRIVATE. Error: %d\n", ret); - return PTS_FAIL; - } - - /* Set the 'pshared' attribute to PTHREAD_PROCESS_SHARED */ - if((ret=pthread_mutexattr_setpshared(&mta, PTHREAD_PROCESS_SHARED)) != 0) - { - printf("Test FAILED: Cannot set pshared attribute to PTHREAD_PROCESS_SHARED. Error code: %d\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-2.c deleted file mode 100644 index f5eacf49d1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-2.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_setpshared() - * - * The default value of the 'pshared' attribute is PTHREAD_PROCESS_PRIVATE. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2. Call pthread_mutexattr_getpshared() to check if the process-shared - * attribute is set as the default value PTHREAD_PROCESS_PRIVATE. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_mutexattr_t mta; - int pshared; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* The default 'pshared' attribute should be PTHREAD_PROCESS_PRIVATE */ - if(pthread_mutexattr_getpshared(&mta, &pshared) != 0) - { - fprintf(stderr,"Error obtaining the attribute process-shared\n"); - return PTS_UNRESOLVED; - } - - /* Make sure that the default is PTHREAD_PROCESS_PRIVATE. */ - if(pshared != PTHREAD_PROCESS_PRIVATE) - { - printf("Test FAILED: Incorrect default pshared value: %d\n", pshared); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-1.c deleted file mode 100644 index 5aef15cc80..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_setpshared() - * - * Upon success, it returns 0. - * - * Steps: - * - * 1. Initialized a mutexattr object. - * 2. Set the attributes object to PTHREAD_PROCESS_PRIVATE. The error return code should be 0. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_mutexattr_t mta; - int ret; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute to PTHREAD_PROCESS_PRIVATE. */ - ret=pthread_mutexattr_setpshared(&mta, PTHREAD_PROCESS_PRIVATE); - if(ret != 0) - { - printf("Test FAILED: Expected return code 0, got: %d", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-2.c deleted file mode 100644 index 7e0c9f90b8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-2.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_setpshared() - * - * Upon success, it returns 0. - * - * Steps: - * - * 1. Initialized a mutexattr object. - * 2. Set the attributes object to PTHREAD_PROCESS_SHARED. The error return code should be 0. - * - */ - -#include -#include -#include "posixtest.h" - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_mutexattr_t mta; - int ret; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the attribute to PTHREAD_PROCESS_PRIVATE. */ - ret=pthread_mutexattr_setpshared(&mta, PTHREAD_PROCESS_SHARED); - if(ret != 0) - { - printf("Test FAILED: Expected return code 0, got: %d\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-2.c deleted file mode 100644 index 7bcef7cf9b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-2.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_mutexattr_setpshared() - * - * It MAY fail if: - * - * [EINVAL] - the new value pshared value is outside the range of legal values for that - * attribute. - * - * Steps: - * - * 1. Pass to pthread_mutexattr_setpshared() a negative value in the 'pshared' parameter.. - * 2. It may return the value of EINVAL. - * - */ - -#include -#include -#include -#include "posixtest.h" - -#define INVALID_PSHARED_VALUE -1 - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNRESOLVED; - #endif - - pthread_mutexattr_t mta; - int ret; - - /* Set the attribute to INVALID_PSHARED_VALUE. */ - ret=pthread_mutexattr_setpshared(&mta, INVALID_PSHARED_VALUE); - if(ret != 0) - { - if(ret == EINVAL) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED: Expected return code 0 or EINVAL, got: %d", ret); - return PTS_FAIL; - } - - printf("Test PASSED: NOTE*: Returned 0 on error, though standard states 'may' fail.\n"); - return PTS_PASS; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/assertions.xml deleted file mode 100644 index 792fd2215c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/assertions.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - The function - - int pthread_mutexattr_setpshared(const pthread_mutexattr_t *attr, int pshared); - - It shall set the process-shared attribute in an initialized attributes object 'attr'. - - The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a mutex to be - operated upon by any thread that has access to the memory where the mutex is allocated, - even if the mutex is allocated in memory that is shared by multiple processes. - - If the process-shared attribute is PTHREAD_PROCESS_PRIVATE, the mutex shall only be - operated upon by threads created within the same process as the thread that initialized - the mutex; if threads of differing processes attempt to operate on such a mutex, - the behavior is undefined. - - The default value of the attribute is PTHREAD_PROCESS_PRIVATE. - - - Upon success, it returns 0. - - - It MAY fail if: - - [EINVAL] - 'attr' is invalid. - - [EINVAL] - the new value pshared value is outside the range of legal values for that - attribute. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/coverage.txt deleted file mode 100644 index 3bed459b2a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_setpshared/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_setpshared function: - -Assertion Tested? - YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/1-1.c deleted file mode 100644 index fa3ad0fe42..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/1-1.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutexattr_settype() - * int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); - * Sets the mutex 'type' attribute. This attribute is set in the 'type' parameter to - * these functions. The default value is PTHREAD_MUTEX_DEFAULT. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - int type; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_mutexattr_gettype(&mta, &type) != 0) - { - printf("Error getting the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - if(type != PTHREAD_MUTEX_DEFAULT) - { - printf("Test FAILED: Default value of the 'type' attribute is not PTHREAD_MUTEX_DEFAULT \n"); - return PTS_FAIL; - } - - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_NORMAL) != 0) - { - printf("Test FAILED: Error setting the attribute 'type'\n"); - return PTS_FAIL; - } - - if(pthread_mutexattr_gettype(&mta, &type) != 0) - { - printf("Error getting the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - if(type != PTHREAD_MUTEX_NORMAL) - { - printf("Test FAILED: Type not correct get/set \n"); - return PTS_FAIL; - } - - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_ERRORCHECK) != 0) - { - printf("Test FAILED: Error setting the attribute 'type'\n"); - return PTS_FAIL; - } - if(pthread_mutexattr_gettype(&mta, &type) != 0) - { - printf("Error getting the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - if(type != PTHREAD_MUTEX_ERRORCHECK) - { - printf("Test FAILED: Type not correct get/set \n"); - return PTS_FAIL; - } - - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE) != 0) - { - printf("Test FAILED: Error setting the attribute 'type'\n"); - return PTS_FAIL; - } - - if(pthread_mutexattr_gettype(&mta, &type) != 0) - { - printf("Error getting the attribute 'type'\n"); - return PTS_UNRESOLVED; - } - - if(type != PTHREAD_MUTEX_RECURSIVE) - { - printf("Test FAILED: Type not correct get/set \n"); - return PTS_FAIL; - } - - if(pthread_mutexattr_destroy(&mta) != 0) - { - printf("Error at pthread_mutexattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/2-1.c deleted file mode 100644 index 06bea1779f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/2-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutexattr_settype() - * - * PTHREAD_MUTEX_NORMAL - - * This type of mutex doesn't detect deadlock. So a thread attempting to relock this mutex - * without unlocking it first will not return an error. Attempting to unlock a mutex locked - * by a different thread results in undefined behavior. Attemping to unlock an unlocked mutex - * results in undefined behavior. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2 Set the 'type' of the mutexattr object to PTHREAD_MUTEX_NORMAL. - * 3. Create a mutex with that mutexattr object. - * 4. Lock the mutex, then relock it. Expect dead lock. Timer will be use - * to interrupt the deadlock. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void alarm_handler(int signo) -{ - printf("Got SIGALRM after 1 second\n"); - printf("Test PASSED\n"); - exit(PTS_PASS); -} - -int main() -{ - pthread_mutex_t mutex; - pthread_mutexattr_t mta; - int ret; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the 'type' attribute to be PTHREAD_MUTEX_NORMAL */ - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_NORMAL) != 0) - { - printf("Test FAILED: Error setting the attribute 'type'\n"); - return PTS_FAIL; - } - - /* Initialize the mutex with that attribute obj. */ - if(pthread_mutex_init(&mutex, &mta) != 0) - { - perror("Error intializing the mutex.\n"); - return PTS_UNRESOLVED; - } - - ret=pthread_mutex_lock(&mutex); - if(ret != 0) - { - printf("Test Unresolved: Error at pthread_mutex_lock, " - "error code %d\n", ret); - return PTS_UNRESOLVED; - } - - signal(SIGALRM, alarm_handler); - alarm(1); - /* This lock will cause deadlock */ - ret=pthread_mutex_lock(&mutex); - /* We should not get here */ - printf("Relock the mutex did not get deadlock\n"); - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-1.c deleted file mode 100644 index 7f7fda7a6e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-1.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutexattr_settype() - * - * PTHREAD_MUTEX_ERRORCHECK - - * Provides errorchecking. A thread attempting to relock this mutex without unlocking it - * first will return with an error. A thread attempting to unlock a mutex which another - * thread has locked will return with an error. A thread attempting to unlock an unlocked - * mutex will return with an error. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2 Set the 'type' of the mutexattr object to PTHREAD_MUTEX_ERRORCHECK. - * 3. Create a mutex with that mutexattr object. - * 4. Attempt to relock a mutex without unlocking it first. It should return an error. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutex_t mutex; - pthread_mutexattr_t mta; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the 'type' attribute to be PTHREAD_MUTEX_ERRORCHECK */ - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_ERRORCHECK) != 0) - { - printf("Test FAILED: Error setting the attribute 'type'\n"); - return PTS_FAIL; - } - - /* Initialize the mutex with that attribute obj. */ - if(pthread_mutex_init(&mutex, &mta) != 0) - { - perror("Error intializing the mutex.\n"); - return PTS_UNRESOLVED; - } - - /* Lock the mutex. */ - if(pthread_mutex_lock(&mutex) != 0 ) - { - perror("Error locking the mutex first time around.\n"); - return PTS_UNRESOLVED; - } - - /* Lock the mutex again. Here, an error should be returned. */ - if(pthread_mutex_lock(&mutex) == 0 ) - { - perror("Test FAILED: Did not return error when locking an already locked mutex.\n"); - return PTS_FAIL; - } - - /* cleanup */ - pthread_mutex_unlock(&mutex); - pthread_mutex_destroy(&mutex); - - if(pthread_mutexattr_destroy(&mta) != 0) - { - perror("Error at pthread_mutex_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-2.c deleted file mode 100644 index a2c421b502..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-2.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutexattr_settype() - * - * PTHREAD_MUTEX_ERRORCHECK - - * Provides errorchecking. A thread attempting to relock this mutex without unlocking it - * first will return with an error. A thread attempting to unlock a mutex which another - * thread has locked will return with an error. A thread attempting to unlock an unlocked - * mutex will return with an error. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2 Set the 'type' of the mutexattr object to PTHREAD_MUTEX_ERRORCHECK. - * 3. Create a mutex with that mutexattr object. - * 4. Lock the mutex. - * 5. Create a thread, and in that thread, attempt to unlock the mutex. It should return an - * error. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -pthread_t thread1; -pthread_mutex_t mutex; -pthread_mutexattr_t mta; - -int ret; /* Return value of the thread unlocking the mutex. */ - -void *a_thread_func() -{ - /* Try to unlock the mutex that main already locked. */ - ret=pthread_mutex_unlock(&mutex); - pthread_exit((void*)0); - return NULL; -} - - -int main() -{ - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the 'type' attribute to be PTHREAD_MUTEX_ERRORCHECK */ - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_ERRORCHECK) != 0) - { - printf("Test FAILED: Error setting the attribute 'type'\n"); - return PTS_FAIL; - } - - /* Initialize the mutex with that attribute obj. */ - if(pthread_mutex_init(&mutex, &mta) != 0) - { - perror("Error intializing the mutex.\n"); - return PTS_UNRESOLVED; - } - - /* Lock the mutex. */ - if(pthread_mutex_lock(&mutex) != 0 ) - { - perror("Error locking the mutex first time around.\n"); - return PTS_UNRESOLVED; - } - - /* Create the thread that will try to unlock the mutex we just locked. */ - if(pthread_create(&thread1, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating a thread.\n"); - return PTS_UNRESOLVED; - } - - /* Wait for that thread to end execution */ - pthread_join(thread1, NULL); - - if(ret == 0) - { - printf("Test FAILED: Expected an error when trying to unlock a mutex that was locked by another thread. Returned 0 instead.\n"); - return PTS_FAIL; - } - - /* cleanup */ - pthread_mutex_unlock(&mutex); - pthread_mutex_destroy(&mutex); - - if(pthread_mutexattr_destroy(&mta)) - { - perror("Error at pthread_mutexattr_destory().\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-3.c deleted file mode 100644 index af3ec5e257..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-3.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutexattr_settype() - * - PTHREAD_MUTEX_ERRORCHECK - - Provides errorchecking. A thread attempting to relock this mutex without unlocking it - first will return with an error. A thread attempting to unlock a mutex which another - thread has locked will return with an error. A thread attempting to unlock an unlocked - mutex will return with an error. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2 Set the 'type' of the mutexattr object to PTHREAD_MUTEX_ERRORCHECK. - * 3. Create a mutex with that mutexattr object. - * 4. Attempt to unlock it without locking it first. It should return an error. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutex_t mutex; - pthread_mutexattr_t mta; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the 'type' attribute to be PTHREAD_MUTEX_ERRORCHECK */ - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_ERRORCHECK) != 0) - { - printf("Test FAILED: Error setting the attribute 'type'\n"); - return PTS_FAIL; - } - - /* Initialize the mutex with that attribute obj. */ - if(pthread_mutex_init(&mutex, &mta) != 0) - { - perror("Error intializing the mutex.\n"); - return PTS_UNRESOLVED; - } - - /* Unlock an already unlocked mutex. Here, an error should be returned. */ - if(pthread_mutex_unlock(&mutex) == 0 ) - { - perror("Test FAILED: Did not return error when unlocking an already unlocked mutex.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-4.c deleted file mode 100644 index 1b66950b9d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/3-4.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutexattr_settype() - * - PTHREAD_MUTEX_ERRORCHECK - - Provides errorchecking. A thread attempting to relock this mutex without unlocking it - first will return with an error. A thread attempting to unlock a mutex which another - thread has locked will return with an error. A thread attempting to unlock an unlocked - mutex will return with an error. - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() - * 2 Set the 'type' of the mutexattr object to PTHREAD_MUTEX_ERRORCHECK. - * 3. Create a mutex with that mutexattr object. - * 4. Attempt to unlock an unlocked mutex. It should return an error. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutex_t mutex; - pthread_mutexattr_t mta; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* Set the 'type' attribute to be PTHREAD_MUTEX_ERRORCHECK */ - if(pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_ERRORCHECK) != 0) - { - printf("Test FAILED: Error setting the attribute 'type'\n"); - return PTS_FAIL; - } - - /* Initialize the mutex with that attribute obj. */ - if(pthread_mutex_init(&mutex, &mta) != 0) - { - perror("Error intializing the mutex.\n"); - return PTS_UNRESOLVED; - } - - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error at pthread_mutex_lock().\n"); - return PTS_UNRESOLVED; - } - - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error at pthread_mutex_unlock().\n"); - return PTS_UNRESOLVED; - } - - /* Unlock an already unlocked mutex. Here, an error should be returned. */ - if(pthread_mutex_unlock(&mutex) == 0 ) - { - perror("Test FAILED: Did not return error when unlocking an already unlocked mutex.\n"); - return PTS_FAIL; - } - - if(pthread_mutex_destroy(&mutex)) - { - perror("Error at pthread_mutex_destory().\n"); - return PTS_UNRESOLVED; - } - - if(pthread_mutexattr_destroy(&mta)) - { - perror("Error at pthread_mutexattr_destory().\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/6-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/6-1.sh deleted file mode 100755 index eece606a21..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/6-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_mutexattr_settype() - -# It returns 0 upon success. - -# This is tested implicitly via assertion 2,3 and 4 of pthread_mutexattr_settype. - -echo "Tested implicitly via assertions 2,3 and 4 of pthread_mutexattr_settype(). See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/7-1.c deleted file mode 100644 index 511cc464fc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/7-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_mutexattr_settype() - * - * It shall fail if: - * [EINVAL] - The value 'type' is invalid. - - * It may fail if: - * [EINVAL] - The value specified by 'attr' is invalid. - - * - * Steps: - * 1. Initialize a pthread_mutexattr_t object. - * 2. Pass to pthread_mutexattr_settype an invalid type. It shall fail. - * - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_mutexattr_t mta; - int ret; - int invalid_type = -1; - - /* Initialize a mutex attributes object */ - if(pthread_mutexattr_init(&mta) != 0) - { - perror("Error at pthread_mutexattr_init()\n"); - return PTS_UNRESOLVED; - } - - - while(invalid_type == PTHREAD_MUTEX_NORMAL || - invalid_type == PTHREAD_MUTEX_ERRORCHECK || - invalid_type == PTHREAD_MUTEX_RECURSIVE || - invalid_type == PTHREAD_MUTEX_DEFAULT) - { - invalid_type --; - } - /* Set the 'type' attribute to be a negative number. */ - ret=pthread_mutexattr_settype(&mta, invalid_type); - - if (ret != EINVAL) - { - printf("Test FAILED: Expected return code of EINVAL, got: %d\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/assertions.xml deleted file mode 100644 index d51b796be7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/assertions.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - The function - - int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); - - Sets the mutex 'type' attribute. This attribute is set in the 'type' parameter to - these functions. The default value is PTHREAD_MUTEX_DEFAULT. - - - - PTHREAD_MUTEX_NORMAL - - This type of mutex doesn't detect deadlock. So a thread attempting to relock this mutex - without unlocking it first will deadllock. Attempting to unlock a mutex locked by a - different thread results in undefined behavior. Attemping to unlock an unlocked mutex - results in undefined behavior. - - - PTHREAD_MUTEX_ERRORCHECK - - Provides errorchecking. A thread attempting to relock this mutex without unlocking it - first will return with an error. A thread attempting to unlock a mutex which another - thread has locked will return with an error. A thread attempting to unlock an unlocked - mutex will return with an error. - - - PTHREAD_MUTEX_DEFAULT - - Attempting to recursively lock a mutex of this type will result in undefined behavior. - Attempting to unlock a mutex of this type which was not locked by the calling thread - results in undefined behavior. Attempting to unlock a mutex of this type which is - locked results in undefined behavior. An implementation may map this mutex to one of - the other mutex types. - - - It returns 0 upon success. - - - It shall fail if: - - [EINVAL] - The value 'type' is invalid. - - It may fail if: - - [EINVAL] - The value specified by 'attr' is invalid. - - It shall not return an error code of [EINTR]. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/coverage.txt deleted file mode 100644 index 61473064cd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_mutexattr_settype/coverage.txt +++ /dev/null @@ -1,13 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_settype function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO **Removed, since duplicate with assertion - **in pthread_mutex_lock:4 and pthread_mutex_unlock:5 -5 NO **Will not test because all behavior is undefined. -6 YES -7 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-1.c deleted file mode 100644 index 6771c7be2f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_once() - * - * Dynamic package installation. Tihe first call to pthread_once() by any - * thread in a process, with a given 'once_control', shall call the - * 'init_routine' with no arguments. Subsequent calls of pthread_once() - * with the same once_control shall not call the 'init_routine'. The - * 'once_control' paramter shall determine whether the associated - * initialization routine has been called. - * - * STEPS: - * 1.Initialize a pthread_once object - * 2.Call pthread_once passing it this object - * 3.Call pthread_once again, this time, it shouldn't execute the function - * passed to it. If it does, the test fails. - */ - -#include -#include -#include "posixtest.h" - -/* Keeps track of how many times the init function has been called. */ -int init_flag; - -/* The init function that pthread_once calls */ -void *an_init_func() -{ - init_flag++; - return NULL; -} - -int main() -{ - pthread_once_t once_control = PTHREAD_ONCE_INIT; - - init_flag=0; - - /* Call pthread_once, passing it the once_control */ - pthread_once(&once_control, (void*)an_init_func); - - /* Call pthread_once again. The init function should not be - * called. */ - pthread_once(&once_control, (void*)an_init_func); - - if(init_flag != 1) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-2.c deleted file mode 100644 index c29175b047..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-2.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* In a process, the first call to pthread_once with a given once_control -* calls the init routine. - -* The steps are: -* -> call pthread_once -* -> check the init_routine executed - -* The test fails if the init_routine has not been called after pthread_once -* has returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include -#include -#include -#include -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -int control; - -void my_init( void ) -{ - - control = 1; - - return ; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - - pthread_once_t myctl = PTHREAD_ONCE_INIT; - - /* Initialize output */ - output_init(); - - control = 0; - - /* Call the initializer */ - ret = pthread_once( &myctl, my_init ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_once failed" ); - } - - if ( control != 1 ) - { - FAILED( "The initializer function did not execute" ); - } - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-3.c deleted file mode 100644 index fbe2b0f173..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-3.c +++ /dev/null @@ -1,183 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* Subsequent calls with the same once_control do not call init routine. - -* The steps are: -* -> Create several threads -* -> each call pthread_once -* -> check the init_routine executed once - -* The test fails if the init_routine has not been called or has -* been called several times. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include -#include -#include -#include -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define NTHREADS 30 - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -int control; -pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; - -void my_init( void ) -{ - int ret = 0; - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex in initializer" ); - } - - control++; - - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex in initializer" ); - } - - return ; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret; - - ret = pthread_once( arg, my_init ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_once failed" ); - } - - return NULL; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, i; - - pthread_once_t myctl = PTHREAD_ONCE_INIT; - - pthread_t th[ NTHREADS ]; - - /* Initialize output */ - output_init(); - - control = 0; - - /* Create the children */ - - for ( i = 0; i < NTHREADS; i++ ) - { - ret = pthread_create( &th[ i ], NULL, threaded, &myctl ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a thread" ); - } - } - - /* Then join */ - for ( i = 0; i < NTHREADS; i++ ) - { - ret = pthread_join( th[ i ], NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join a thread" ); - } - } - - /* Fetch the memory */ - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex in initializer" ); - } - - if ( control != 1 ) - { - output( "Control: %d\n", control ); - FAILED( "The initializer function did not execute once" ); - } - - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex in initializer" ); - } - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/2-1.c deleted file mode 100644 index b50cc1c82d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/2-1.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* pthread_once returns only when init routine has completed. - -* The steps are: -* -> call pthread_once (the init routine lasts for 1 second) -* -> check the init_routine executed - -* The test fails if the init_routine has not been completed when pthread_once -* returns. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include -#include -#include -#include -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -int control; - -void my_init( void ) -{ - sleep( 1 ); - - control = 1; - - return ; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - - pthread_once_t myctl = PTHREAD_ONCE_INIT; - - /* Initialize output */ - output_init(); - - control = 0; - - /* Call the initializer */ - ret = pthread_once( &myctl, my_init ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_once failed" ); - } - - if ( control != 1 ) - { - FAILED( "The initializer function did not execute" ); - } - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/3-1.c deleted file mode 100644 index 634132460b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/3-1.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_once() - * - * The pthread_once() function is not a cancelation point. However if - * 'init_routine'is a cancelation point and is canceled, the effect on - * 'once_control' shall be as if pthread_once() was never called. - * - * STEPS: - * 1. Create a cancelable thread. - * 2. In the thread routine, call pthread_once using a global pthread_once_t - * object. - * 3. Cancel the thread during the pthread_once init function - * 4. Call pthread_once again with the same pthread once_t object - * 5. This should call the pthread_once init function. If not, the test fails. - */ - -#include -#include -#include -#include "posixtest.h" - -/* Global pthread_once_t object */ -pthread_once_t once_control = PTHREAD_ONCE_INIT; - -/* Keeps track of how many times the init function has been called. */ -int init_flag; - -/* The init function that pthread_once calls */ -void *an_init_func() -{ - /* Indicate to main() that the init function has been reached */ - init_flag=1; - - /* Stay in a continuous loop until the thread that called - * this function gets canceled */ - sleep(10); - - /* The thread could not be canceled, timeout after 10 secs */ - perror("Init function timed out (10 secs), thread could not be canceled\n"); - init_flag=-1; - return NULL; -} - -/* Thread function */ -void *a_thread_func() -{ - /* Make the thread cancelable immediately */ - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - pthread_once(&once_control, (void*)an_init_func); - return NULL; -} - -/* 2nd init function used by the 2nd call of pthread_once */ -void *an_init_func2() -{ - /* Indicate to main() that this init function has been reached */ - init_flag=1; - return NULL; -} - -int main() -{ - pthread_t new_th; - init_flag=0; - - /* Create a thread that will execute the first call to pthread_once() */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait until the init function is reached to cancel the thread */ - while(init_flag==0) - sleep(1); - - /* Send cancel request to the thread*/ - if(pthread_cancel(new_th) != 0) - { - perror("Could send cancel request to thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait until the thread is canceled */ - pthread_join(new_th, NULL); - - /* If the thread could not be canceled and timed out, send - * an error */ - if (init_flag == -1) - { - perror("Error: could not cancel thread\n"); - return PTS_UNRESOLVED; - } - - init_flag=0; - - /* Should be able to call pthread_once() again with the same - * pthread_once_t object. */ - pthread_once(&once_control, (void*)an_init_func2); - - /* If the init function from the 2nd call to pthread_once() was not - * reached, the test fails. */ - if(init_flag != 1) - { - printf("Test FAILED\n: %d", init_flag); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/4-1.c deleted file mode 100644 index 45b72f2087..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/4-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test pthread_once() - - *The constant PTHREAD_ONCE_INIT is defined in the pthread.h header. - */ - -#include - -pthread_once_t dummy = PTHREAD_ONCE_INIT; - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/6-1.c deleted file mode 100644 index e88c73e361..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/6-1.c +++ /dev/null @@ -1,365 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function does not return EINTR - -* The steps are: -* -> kill a thread which calls pthread_once -* -> check that EINTR is never returned - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -char do_it = 1; -unsigned long count_ope = 0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig = 0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} - -thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig ( void * arg ) -{ - thestruct * thearg = ( thestruct * ) arg; - int ret; - pid_t process; - - process = getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread" ); - } - - while ( do_it ) - { -#ifdef WITH_SYNCHRO - - if ( ( ret = sem_wait( thearg->sem ) ) ) - { - UNRESOLVED( errno, "Sem_wait in sendsig" ); - } - - count_sig++; -#endif - - ret = kill( process, thearg->sig ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Kill in sendsig" ); - } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig1 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 1" ); - } - -#endif -} - -/* This one is registered for signal SIGUSR2 */ -void sighdl2( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig2 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 2" ); - } - -#endif -} - -int init_ctl; -/* Init function */ -void initializer( void ) -{ - init_ctl++; - return ; -} - - -/* Test function -- calls pthread_equal() and checks that EINTR is never returned. */ -void * test( void * arg ) -{ - int ret = 0; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_UNBLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread" ); - } - - - while ( do_it ) - { - pthread_once_t once_ctl = PTHREAD_ONCE_INIT; - - count_ope++; - - init_ctl = 0; - - ret = pthread_once( &once_ctl, initializer ); - - if ( ret == EINTR ) - { - FAILED( "pthread_once returned EINTR" ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_once failed" ); - } - - ret = pthread_once( &once_ctl, initializer ); - - if ( ret == EINTR ) - { - FAILED( "pthread_once returned EINTR" ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_once failed" ); - } - - if ( init_ctl != 1 ) - { - output( "init_ctl:%d\n", init_ctl ); - FAILED( "The initializer did not execute as expected" ); - } - - } - - return NULL; -} - -/* Main function */ -int main ( int argc, char * argv[] ) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset ( &sa.sa_mask ); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - - if ( ( ret = sigaction ( SIGUSR1, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler1" ); - } - - sa.sa_handler = sighdl2; - - if ( ( ret = sigaction ( SIGUSR2, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler2" ); - } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset( &usersigs ); - - ret = sigaddset( &usersigs, SIGUSR1 ); - - ret |= sigaddset( &usersigs, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to add SIGUSR1 or 2 to a signal set" ); - } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread" ); - } - -#ifdef WITH_SYNCHRO - if ( sem_init( &semsig1, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig1 init" ); - } - - if ( sem_init( &semsig2, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig2 init" ); - } - -#endif - - if ( ( ret = pthread_create( &th_work, NULL, test, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread creation failed" ); - } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ( ( ret = pthread_create( &th_sig1, NULL, sendsig, ( void * ) & arg1 ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread creation failed" ); - } - - if ( ( ret = pthread_create( &th_sig2, NULL, sendsig, ( void * ) & arg2 ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread creation failed" ); - } - - - - /* Let's wait for a while now */ - sleep( 1 ); - - - /* Now stop the threads and join them */ - do - { - do_it = 0; - } - while ( do_it ); - - - if ( ( ret = pthread_join( th_sig1, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread join failed" ); - } - - if ( ( ret = pthread_join( th_sig2, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread join failed" ); - } - - - if ( ( ret = pthread_join( th_work, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread join failed" ); - } - - -#if VERBOSE > 0 - output( "Test executed successfully.\n" ); - - output( " %d initializations.\n", count_ope ); - -#ifdef WITH_SYNCHRO - output( " %d signals were sent meanwhile.\n", count_sig ); - -#endif - #endif - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/assertions.xml deleted file mode 100644 index f5cf4ab799..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/assertions.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - The function - - int pthread_once(pthread_once_t *once_control, void (*init_routine) (void)); - - The first call to pthread_once() by any - thread in a process, with a given 'once_control', shall call the - 'init_routine' with no arguments. Subsequent calls of pthread_once() - with the same once_control shall not call the 'init_routine'. The - 'once_control' paramter shall determine whether the associated initialization - routine has been called. - - - On return from pthread_once(), 'init_routine' shall have completed. - - - The pthread_once() function is not a cancelation point. But if - 'init_routine' is a cancelation point and is canceled, the effect on - 'once_control' shall be as if pthread_once() was never called. - - - The constant PTHREAD_ONCE_INIT is defined in the pthread.h header. The - behavior of pthread_once() is undefined if 'once_control' has automatic - storage duration or is not initialized by PTHREAD_ONCE_INIT. - - - Upon success, it returns a 0; - - - Upon failure, it may return an error number: - -[EINVAL] If either 'once_control' or 'init_routine' is invalid - - It shall not return [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/coverage.txt deleted file mode 100644 index 51c4a58bab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/coverage.txt +++ /dev/null @@ -1,13 +0,0 @@ -This document defines the coverage for the pthread_once function: - -Assertion Tested? -1 YES -2 NO -3 YES -4 YES -5 NO -6 NO ** Keeping in mind it 'may' fail and not 'shall' fail, - so it will always return PASS, but will return a - PASS and print out a warning if it fails. - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.c deleted file mode 100644 index c515f2bfc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.h deleted file mode 100644 index 2d17f1dbba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/1-1.c deleted file mode 100644 index ad179fcc09..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/1-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The function shall destroy the read-write lock object referenced by rwlock - * and release any resources used by the lock. - * - * Note: This case does not test the resources used by the lock has been released. - *Steps: - * Loop for COUNT times: - * 1. Initialize a read-write lock - * 2. Destroy it. Should get not error. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include "posixtest.h" - -#define COUNT 1000 - -int main() -{ - pthread_rwlock_t rwlock; - int cnt = 0; - int rc = 0; - - while(cnt++ < COUNT) - { - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - rc = pthread_rwlock_destroy(&rwlock); - if(rc != 0) - { - printf("Test FAILED: at %d-th pthread_rwlock_destroy(), with Error code=%d\n", cnt, rc); - return PTS_FAIL; - } - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/2-1.sh deleted file mode 100644 index 35c34ec06a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - - -# Test pthread_rwlock_destroy returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/3-1.c deleted file mode 100644 index c1dd0d2edc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/3-1.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * - * pthread_rwlock_destroy( ) function may fail if: - * [EBUSY] The implementation has detected an attempt to destroy the object referenced - * by rwlock while it is locked. - * - *Steps: - * 1. Initialize a read-write lock. - * 2. Lock it. - * 3. Attempt to destroy it while it is still locked. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_rwlock_t rwlock; - int rc; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_rdlock()\n"); - return PTS_UNRESOLVED; - } - - /* Attempt to destroy an already locked rwlock */ - rc = pthread_rwlock_destroy(&rwlock); - if(rc == EBUSY) - { - printf("Test PASSED\n"); - return PTS_PASS; - } else if (rc == 0) - { - printf("Test PASSED: Note*: pthread_rwlock_destroy() returned 0 instead of EBUSY, but standard specifies _may_ fail\n"); - return PTS_PASS; - } else - { - printf("Test FAILED: Error at pthread_rwlock_destroy(), should return 0 or EBUSY, but returns %d\n", rc); - return PTS_FAIL; - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/assertions.xml deleted file mode 100644 index ba0984ded7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/assertions.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - pthread_rwlock_destroy( ) function shall destroy the read-write lock object - referenced by rwlock and release any resources used by the lock. - - - - If successful, the pthread_rwlock_destroy( ) return zero; - otherwise, an error number shall be returned to indicate the error. - - - - If not successful, pthread_rwlock_destroy( ) function may fail if: - [EBUSY] The implementation has detected an attempt to destroy the object referenced - by rwlock while it is locked. - [EINVAL] The value specified by rwlock is invalid. - - Shall not return an error code of [EINTR] - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/coverage.txt deleted file mode 100644 index 7bd1061744..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_destroy/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_rwlock_destroy function: - -Assertion Tested? -1 YES -2 YES -3 YES ** Tested EBUSY, but not EINVAL, - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/1-1.c deleted file mode 100644 index 143a48fdb1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/1-1.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_rwlock_init(). - * - * pthread_rwlock_init( ) function shall allocate any resources - * required to use the read-write lock referenced by rwlock and - * initializes the lock to an unlocked state with attributes referenced - * by attr. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Create a child thread, the thread lock 'rwlock' for reading, shall not block. - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_rwlock_t rwlock; -static int thread_state; - -static void* fn_rd(void *arg) -{ - - thread_state = 2; - int rc; - - printf("child: lock for reading\n"); - rc = pthread_rwlock_rdlock(&rwlock); - if(rc == 0) - { - printf("child: get read lock\n"); - printf("child: unlock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("child: release read lock\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("Error in pthread_rwlock_rdlock().\n"); - exit(PTS_FAIL); - } - - thread_state = 3; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - int rc = 0; - thread_state=0; - - pthread_t thread; - pthread_rwlockattr_t rwlockattr; - - if(pthread_rwlockattr_init(&rwlockattr) != 0) - { - printf("main: Error at pthread_rwlockattr_init()\n"); - return PTS_UNRESOLVED; - } - - rc = pthread_rwlock_init(&rwlock, &rwlockattr); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_rwlock_init(), returns %d\n", rc); - return PTS_FAIL; - } - - thread_state = 1; - printf("main: create thread\n"); - if(pthread_create(&thread, NULL, fn_rd, NULL) != 0) - { - printf("main: failed to create thread\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - /* We expect the thread not to block*/ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=3 && cnt++ < 3); - - if(thread_state == 2) - { - printf("Test FAILED: thread blocked on read lock\n"); - exit(PTS_FAIL); - } - else if(thread_state != 3) - { - printf("main: Unexpected thread state\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - /* Cleanup */ - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlock_destroy()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlockattr_destroy(&rwlockattr) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/2-1.c deleted file mode 100644 index ad7f4fc0f0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/2-1.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_rwlock_init(). - * - * If attr is NULL, the default read-write lock attributes shall be used; - * the effect is the same as passing the address of a default read-write - * lock attributes object. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init(), - * set 'attr' as NULL. - * 2. Create a child thread, the thread lock 'rwlock' for reading, shall not block. - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_rwlock_t rwlock; -static int thread_state; - -static void* fn_rd(void *arg) -{ - - thread_state = 2; - int rc; - - printf("child: lock for reading\n"); - rc = pthread_rwlock_rdlock(&rwlock); - if(rc == 0) - { - printf("child: get read lock\n"); - printf("child: unlock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("child: release read lock\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("Error in pthread_rwlock_rdlock().\n"); - exit(PTS_FAIL); - } - - thread_state = 3; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - int rc = 0; - - pthread_t thread; - - rc = pthread_rwlock_init(&rwlock, NULL); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_rwlock_init(), returns %d\n", rc); - return PTS_FAIL; - } - - thread_state = 1; - printf("main: create thread\n"); - if(pthread_create(&thread, NULL, fn_rd, NULL) != 0) - { - printf("main: failed to create thread\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - /* We expect the thread not to block*/ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=3 && cnt++ < 3); - - if(thread_state == 2) - { - printf("Test FAILED: thread blocked on read lock\n"); - exit(PTS_FAIL); - } - else if(thread_state != 3) - { - printf("main: Unexpected thread state\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlock_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/3-1.c deleted file mode 100644 index 693d35afa5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/3-1.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_rwlock_init(). - * - * Once initialized, the lock can be used any number of times without being - * reinitialized. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Loop for COUNT time: lock for reading, unlock, lock for writing, unlock; - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define COUNT 1000 - -static pthread_rwlock_t rwlock; - - -int main() -{ - int cnt = 0; - pthread_rwlockattr_t rwlockattr; - - if(pthread_rwlockattr_init(&rwlockattr) != 0) - { - printf("Error at pthread_rwlockattr_init()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlock_init(&rwlock, &rwlockattr) != 0) - { - printf("Test FAILED: Error in pthread_rwlock_init()\n"); - return PTS_FAIL; - } - - while(cnt++ < COUNT) - { - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("Test FAILED: cannot get read lock on %dth loop\n", cnt); - return PTS_FAIL; - } - - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Test FAILED: cannot release read lock on %dth loop\n", cnt); - return PTS_FAIL; - } - - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("Test FAILED: cannot get write lock on %dth loop\n", cnt); - return PTS_FAIL; - } - - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Test FAILED: cannot release write lock on %dth loop\n", cnt); - return PTS_FAIL; - } - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlockattr_destroy(&rwlockattr) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/4-1.sh deleted file mode 100755 index 92ce1121f6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/4-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_rwlock_destroy returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/6-1.c deleted file mode 100644 index cf1a49fec0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/6-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_rwlock_init(). - * - * May fail if: - * [EBUSY] The implementation has detected an attempt to reinitialize the object - * referenced by rwlock, a previously initialized but not yet destroyed read-write - * lock. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init(). - * 2. Re-initialize it again without destroying it first. - * - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - - static pthread_rwlock_t rwlock; - int rc; - - /* Initialize the rwlock */ - rc = pthread_rwlock_init(&rwlock, NULL); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_rwlock_init(), returns %d\n", rc); - return PTS_FAIL; - } - - /* Re-intialize without destroying it first */ - rc = pthread_rwlock_init(&rwlock, NULL); - - /* Cleanup */ - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlock_destroy()\n"); - return PTS_UNRESOLVED; - } - - - if(rc == EBUSY) - { - printf("Test PASSED\n"); - return PTS_PASS; - } else if (rc == 0) - { - printf("Test PASSED: Note*: pthread_rwlock_init() returned 0 instead of EBUSY, but standard specifies _may_ fail\n"); - return PTS_PASS; - } else - { - printf("Test FAILED: Error at pthread_rwlock_init(), should return 0 or EBUSY, but returns %d\n", rc); - return PTS_FAIL; - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/assertions.xml deleted file mode 100644 index 610aa66ae3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/assertions.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - pthread_rwlock_init(pthread_rwlock_t *restrict rwlock, - const pthread_rwlockattr_t *restrict attr); - - pthread_rwlock_init( ) function shall allocate any resources - required to use the read-write lock referenced by rwlock and - initializes the lock to an unlocked state with attributes referenced - by attr. - - - If attr is NULL, the default read-write lock attributes shall be used; - the effect is the same as passing the address of a default read-write - lock attributes object. - - - Once initialized, the lock can be used any number of times without being - reinitialized. - - - - If successful, the pthread_rwlock_init( ) function shall return zero; - otherwise, an error number shall be returned to indicate the error. - - - - ptread_rwlock_init( ) function shall fail if: - [EAGAIN] The system lacked the necessary resources (other than memory) to initialize - another read-write lock. - [ENOMEM] Insufficient memory exists to initialize the read-write lock. - [EPERM] The caller does not have the privilege to perform the operation. - - - pthread_rwlock_init( ) may fail if: - [EBUSY] The implementation has detected an attempt to reinitialize the object - referenced by rwlock, a previously initialized but not yet destroyed read-write - lock. - [EINVAL] The value specified by attr is invalid. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/coverage.txt deleted file mode 100644 index 2adc2816b4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_init/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_rwlock_init() function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 NO **Need to find out how to test EGAIN, ENOMEM and EPERM -6 YES *Tested EBUSY, but not EINVAL - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/1-1.c deleted file mode 100644 index 570ed72854..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/1-1.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) - * - * pthread_rwlock_rdlock( ) function shall apply a read lock to the - * read-write lock referenced by rwlock. The calling thread acquires - * the read lock if a writer does not hold the lock and there are - * no writers blocked on the lock. - * - * NOTE: This case will not test whether a thread can get the read lock if - * there are writers blocked on the lock -- it is implementation dependant. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main thread read lock 'rwlock' - * 3. Create a child thread. The thread read lock 'rwlock', should not block. Then unlock it. - * 4. Main thread unlock 'rwlock' - * 5. Main thread write lock 'rwlock' - * 6. Create child thread to read lock 'rwlock', should block - * 7. Main thread unlock 'rwlock' - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_rwlock_t rwlock; -static int thread_state; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_rd(void *arg) -{ - int rc = 0; - thread_state = ENTERED_THREAD; - printf("rd_thread: attempt read lock\n"); - rc = pthread_rwlock_rdlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: rd_thread failed to get read lock, Error code:%d\n" - , rc); - exit(PTS_FAIL); - } else - printf("rd_thread: acquired read lock\n"); - - sleep(1); - - printf("rd_thread: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("rd_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - pthread_t rd_thread1, rd_thread2; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - - /* We have no lock, this read lock should succeed */ - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("Test FAILED: main cannot get read lock when no one owns the lock\n"); - return PTS_FAIL; - } else - printf("main: acquired read lock\n"); - - thread_state = NOT_CREATED_THREAD; - - printf("main: create rd_thread1\n"); - if(pthread_create(&rd_thread1, NULL, fn_rd, NULL) != 0) - { - printf("main: Error at 1st pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - /* the child thread started but blocked */ - printf("Test FAILED: thread blocked on read lock, when a reader owns the lock\n"); - exit(PTS_FAIL); - } - else if(thread_state != EXITING_THREAD) - { - printf("Unexpected thread state\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: failed to release read lock\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(rd_thread1, NULL) != 0) - { - printf("main: Error at 1st pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - - /* Passed first part of the test, now for the second part. */ - - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("main: failed to get write lock\n"); - return PTS_UNRESOLVED; - } else - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - printf("main: create rd_thread2\n"); - if(pthread_create(&rd_thread2, NULL, fn_rd, NULL) != 0) - { - printf("main: failed at 2nd pthread_create()\n"); - return PTS_UNRESOLVED; - } - - cnt = 0; - /* Expect the child thread block on read lock */ - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - printf("Test FAILED: thread did not block on read lock when a writer holds the lock\n"); - return PTS_FAIL; - } - else if(thread_state != ENTERED_THREAD) - { - printf("main: Unexpected thread state\n"); - return PTS_UNRESOLVED; - } - - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: failed to release write lock\n"); - return PTS_UNRESOLVED; - } - - /* We expected the child get the read lock and exit */ - cnt = 1; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread blocked on read lock after the writer released the lock\n"); - return PTS_FAIL; - } - else if(thread_state != EXITING_THREAD) - { - printf("main: Unexpected thread state\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/2-1.c deleted file mode 100644 index 2950efa9fe..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/2-1.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) - * - * If the Thread Execution Scheduling option is supported, - * and the threads involved in the lock are executing with the - * scheduling policies SCHED_FIFO or SCHED_RR, the calling thread shall not - * acquire the lock if a writer holds the lock or if writers of - * higher or equal priority are blocked on the lock; - * otherwise, the calling thread shall acquire the lock. - * - * In this case, we test "higher priority writer block" - * - Steps: - * We have three threads, main(also a reader), writer, reader - * - * 1. Main thread set its shcedule policy as "SCHED_FIFO", with highest priority - * the three: sched_get_priority_min()+2. - * 2. Main thread read lock 'rwlock' - * 3. Create a writer thread, with schedule policy as "SCHED_FIFO", and priority - * using sched_get_priority_min()+1. - * 4. The thread write lock 'rwlock', should block. - * 5. Main thread create a reader thread, with schedule policy as "SCHED_FIFO", and - * priority sched_get_priority_min() - * 6. Reader thread read lock 'rwlock', should block, since there is a higher priority - * writer blocked on 'rwlock' - * 7. Main thread release the 'rwlock', the writer should get the lock first - */ - -/* NOTE: The test result is UNSUPPORTED if Thread Execution Scheduling option - * is not supported. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TRD_POLICY SCHED_FIFO - -static pthread_rwlock_t rwlock; -static int rd_thread_state; -static int wr_thread_state; - -/* thread states: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static int set_priority(pthread_t pid, unsigned policy, unsigned prio) -{ - struct sched_param sched_param; - memset(&sched_param, 0, sizeof(sched_param)); - sched_param.sched_priority = prio; - if (pthread_setschedparam(pid, policy, &sched_param) == -1) - { - printf("Can't set policy to %d and prio to %d\n", - policy, prio); - exit(PTS_UNRESOLVED); - } - return 0; -} - -static void* fn_rd(void *arg) -{ - int rc = 0; - int priority; - rd_thread_state = ENTERED_THREAD; - - priority = (long)arg; - set_priority(pthread_self(), TRD_POLICY, priority); - - printf("rd_thread: attempt read lock\n"); - rc = pthread_rwlock_rdlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: rd_thread failed to get read lock, Error code:%d\n" - , rc); - exit(PTS_FAIL); - } else - printf("rd_thread: acquired read lock\n"); - - - sleep(1); - - printf("rd_thread: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("rd_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - rd_thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -static void* fn_wr(void *arg) -{ - int rc = 0; - int priority; - wr_thread_state = ENTERED_THREAD; - - priority = (long)arg; - set_priority(pthread_self(), TRD_POLICY, priority); - - printf("wr_thread: attempt write lock\n"); - rc = pthread_rwlock_wrlock(&rwlock); - if(rc != 0) - { - printf("Error: wr_thread failed to get write lock, Error code:%d\n" - , rc); - exit(PTS_UNRESOLVED); - } else - printf("wr_thread: acquired write lock\n"); - - sleep(1); - - printf("wr_thread: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("wr_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - wr_thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - #ifndef _POSIX_THREAD_PRIORITY_SCHEDULING - printf("Posix Thread Execution Scheduling not supported\n"); - return PTS_UNSUPPORTED; - #endif - - int cnt = 0; - pthread_t rd_thread, wr_thread; - int priority; - - /* main thread needs to have the highest priority*/ - priority = sched_get_priority_min(TRD_POLICY) + 2; - set_priority(pthread_self(), TRD_POLICY, priority); - printf("main: has priority: %d\n", priority); - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - /* This read lock should succeed */ - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("Test FAILED: main cannot get read lock when no one owns the lock\n"); - return PTS_FAIL; - } else - printf("main: acquired read lock\n"); - - wr_thread_state = NOT_CREATED_THREAD; - priority = sched_get_priority_min(TRD_POLICY) + 1; - printf("main: create wr_thread, with priority: %d\n", priority); - if(pthread_create(&wr_thread, NULL, fn_wr, (void*)(long)priority) != 0) - { - printf("main: Error at 1st pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - - /* We expect the wr_thread to block */ - cnt = 0; - do{ - sleep(1); - }while (wr_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(wr_thread_state == EXITING_THREAD) - { - printf("wr_thread did not block on write lock, when a reader owns the lock\n"); - exit(PTS_UNRESOLVED); - } - else if(wr_thread_state != ENTERED_THREAD) - { - printf("Unexpected wr_thread state: %d\n", wr_thread_state); - exit(PTS_UNRESOLVED); - } - - rd_thread_state = 1; - priority = sched_get_priority_min(TRD_POLICY); - printf("main: create rd_thread, with priority: %d\n", priority); - if(pthread_create(&rd_thread, NULL, fn_rd, (void*)(long)priority) != 0) - { - printf("main: failed at creating rd_thread\n"); - return PTS_UNRESOLVED; - } - - /* We expect the rd_thread to block*/ - cnt = 0; - do{ - sleep(1); - }while (rd_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(rd_thread_state == EXITING_THREAD) - { - printf("Test FAILED: rd_thread did not block on read lock, when a reader owns the lock, and a higher priority writer is waiting for the lock\n"); - exit(PTS_FAIL); - } - else if(rd_thread_state != ENTERED_THREAD) - { - printf("Unexpected rd_thread state: %d\n", rd_thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: failed to unlock read lock\n"); - exit(PTS_UNRESOLVED); - } - - /* we expect the writer get the lock */ - cnt = 0; - do{ - sleep(1); - }while (wr_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(wr_thread_state == ENTERED_THREAD) - { - printf("Test FAILED: higher priority wr_thread still blocked on write lock, when a reader release the lock\n"); - exit(PTS_FAIL); - } - else if(wr_thread_state != EXITING_THREAD) - { - printf("Unexpected wr_thread state: %d\n", wr_thread_state); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(wr_thread, NULL) != 0) - { - printf("main: Error at 1st pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - /* we expect the reader get the lock when writer has unlocked the lock*/ - cnt = 0; - do{ - sleep(1); - }while (rd_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(rd_thread_state == ENTERED_THREAD ) - { - printf("Test FAILED: rd_thread still block on read lock when the lock has no owner\n"); - exit(PTS_FAIL); - } - else if(rd_thread_state != EXITING_THREAD) - { - printf("Unexpected rd_thread state\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(rd_thread, NULL) != 0) - { - printf("main: Error at 2nd pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c deleted file mode 100644 index 1c7e5d4799..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) - * - * If the Thread Execution Scheduling option is supported, - * and the threads involved in the lock are executing with the - * scheduling policies SCHED_FIFO or SCHED_RR, the calling thread shall not - * acquire the lock if a writer holds the lock or if writers of - * higher or equal priority are blocked on the lock; - * otherwise, the calling thread shall acquire the lock. - * - * In this case, we test "equal priority writer block" - * - Steps: - * We have three threads, main(also a reader), writer, reader - * - * 1. Main thread set its shcedule policy as "SCHED_FIFO", with highest priority - * the three: sched_get_priority_min()+2. - * 2. Main thread read lock 'rwlock' - * 3. Create a writer thread, with schedule policy as "SCHED_FIFO", and priority - * using sched_get_priority_min()+1. - * 4. The thread write lock 'rwlock', should block. - * 5. Main thread create a reader thread, with schedule policy as "SCHED_FIFO", and - * priority sched_get_priority_min()+1 - * 6. Reader thread read lock 'rwlock', should block, since there is an equal priority - * writer blocked on 'rwlock' - * 7. Main thread release the 'rwlock', the writer should get the lock first - */ - -/* NOTE: The test result is UNSUPPORTED if Thread Execution Scheduling option - * is not supported. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TRD_POLICY SCHED_FIFO - -static pthread_rwlock_t rwlock; -static int rd_thread_state; -static int wr_thread_state; - -/* thread states: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static int set_priority(pthread_t pid, unsigned policy, unsigned prio) -{ - struct sched_param sched_param; - memset(&sched_param, 0, sizeof(sched_param)); - sched_param.sched_priority = prio; - if (pthread_setschedparam(pid, policy, &sched_param) == -1) - { - printf("Can't set policy to %d and prio to %d\n", - policy, prio); - exit(PTS_UNRESOLVED); - } - return 0; -} - -static void* fn_rd(void *arg) -{ - int rc = 0; - int priority; - rd_thread_state = ENTERED_THREAD; - - priority = (long)arg; - set_priority(pthread_self(), TRD_POLICY, priority); - - printf("rd_thread: attempt read lock\n"); - rc = pthread_rwlock_rdlock(&rwlock); - if(rc != 0) - { - printf("Test fail: rd_thread failed to get read lock, Error code:%d\n" - , rc); - exit(PTS_FAIL); - } else - printf("rd_thread: acquired read lock\n"); - - sleep(1); - - printf("rd_thread: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("rd_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - rd_thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -static void* fn_wr(void *arg) -{ - int rc = 0; - int priority; - wr_thread_state = ENTERED_THREAD; - - priority = (long)arg; - set_priority(pthread_self(), TRD_POLICY, priority); - - printf("wr_thread: attempt write lock\n"); - rc = pthread_rwlock_wrlock(&rwlock); - if(rc != 0) - { - printf("Test fail: wr_thread failed to get write lock, Error code:%d\n" - , rc); - exit(PTS_UNRESOLVED); - } else - printf("wr_thread: acquired write lock\n"); - - sleep(1); - - printf("wr_thread: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("wr_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - wr_thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - #ifndef _POSIX_THREAD_PRIORITY_SCHEDULING - printf("Posix Thread Execution Scheduling not supported\n"); - return PTS_UNSUPPORTED; - #endif - - int cnt = 0; - pthread_t rd_thread, wr_thread; - int priority; - - /* main thread needs to have the highest priority*/ - priority = sched_get_priority_min(TRD_POLICY) + 2; - set_priority(pthread_self(), TRD_POLICY, priority); - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - /* We have no lock, this read lock should succeed */ - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("Test FAILED: main cannot get read lock when no one owns the lock\n"); - return PTS_FAIL; - } else - printf("main: acquired read lock\n"); - - wr_thread_state = NOT_CREATED_THREAD; - priority = sched_get_priority_min(TRD_POLICY) + 1; - printf("main: create wr_thread, with priority: %d\n", priority); - if(pthread_create(&wr_thread, NULL, fn_wr, (void*)(long)priority) != 0) - { - printf("main: Error at 1st pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - - /* We expect the wr_thread to block */ - cnt = 0; - do{ - sleep(1); - }while (wr_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(wr_thread_state == EXITING_THREAD ) - { - printf("wr_thread did not block on write lock, when a reader owns the lock\n"); - exit(PTS_UNRESOLVED); - } - else if(wr_thread_state != ENTERED_THREAD) - { - printf("Unexpected wr_thread state: %d\n", wr_thread_state); - exit(PTS_UNRESOLVED); - } - - rd_thread_state = NOT_CREATED_THREAD; - priority = sched_get_priority_min(TRD_POLICY) + 1; - printf("main: create rd_thread, with priority: %d\n", priority); - if(pthread_create(&rd_thread, NULL, fn_rd, (void*)(long)priority) != 0) - { - printf("main: failed at creating rd_thread\n"); - return PTS_UNRESOLVED; - } - - /* We expect the rd_thread to block*/ - cnt = 0; - do{ - sleep(1); - }while (rd_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(rd_thread_state == EXITING_THREAD ) - { - printf("Test FAILED: rd_thread did not block on read lock, when a reader owns the lock, and an equal priority writer is waiting for the lock\n"); - exit(PTS_FAIL); - } - else if(rd_thread_state != ENTERED_THREAD) - { - printf("Unexpected rd_thread state: %d\n", rd_thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: failed to release read lock\n"); - exit(PTS_UNRESOLVED); - } - - /* we expect the writer get the lock */ - cnt = 0; - do{ - sleep(1); - }while (wr_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(wr_thread_state == ENTERED_THREAD ) - { - printf("Test FAILED: higher priority wr_thread still blocked on write lock, when a reader released the lock\n"); - exit(PTS_FAIL); - } - else if(wr_thread_state != EXITING_THREAD) - { - printf("Unexpected wr_thread state: %d\n", wr_thread_state); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(wr_thread, NULL) != 0) - { - printf("main: Error at 1st pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - /* we expect the reader get the lock when writer has release the lock*/ - cnt = 0; - do{ - sleep(1); - }while (rd_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(rd_thread_state == ENTERED_THREAD ) - { - printf("Test FAILED: rd_thread still blocked on read lock when the lock has no owner\n"); - exit(PTS_FAIL); - } - else if(rd_thread_state != EXITING_THREAD) - { - printf("Unexpected rd_thread state: %d\n", rd_thread_state); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(rd_thread, NULL) != 0) - { - printf("main: Error at 2nd pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/2-3.c deleted file mode 100644 index 8782ba4547..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/2-3.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) - * - * If the Thread Execution Scheduling option is supported, - * and the threads involved in the lock are executing with the - * scheduling policies SCHED_FIFO or SCHED_RR, the calling thread shall not - * acquire the lock if a writer holds the lock or if writers of - * higher or equal priority are blocked on the lock; - * otherwise, the calling thread shall acquire the lock. - * - * In this case, reader has higher priority than the writer - * - Steps: - * We have three threads, main(also a reader), writer, reader - * - * 1. Main thread set its shcedule policy as "SCHED_FIFO", with highest priority - * the three: sched_get_priority_min()+2. - * 2. Main thread read lock 'rwlock' - * 3. Create a writer thread, with schedule policy as "SCHED_FIFO", and priority - * using sched_get_priority_min(). - * 4. The thread write lock 'rwlock', should block. - * 5. Main thread create a reader thread, with schedule policy as "SCHED_FIFO", and - * priority sched_get_priority_min()+1 - * 6. Reader thread read lock 'rwlock', shouldn't block, since it has a higher priority - * than the writer blocked on 'rwlock' - * 7. Main thread release the 'rwlock', the writer should get the lock first. - */ - -/* NOTE: The test result is UNSUPPORTED if Thread Execution Scheduling option - * is not supported. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TRD_POLICY SCHED_FIFO - -static pthread_rwlock_t rwlock; -static int rd_thread_state; -static int wr_thread_state; - -/* thread states: - 1: not in thread yet; - 2: just entered thread ; - 3: just before thread exits; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static int set_priority(pthread_t pid, unsigned policy, unsigned prio) -{ - struct sched_param sched_param; - memset(&sched_param, 0, sizeof(sched_param)); - sched_param.sched_priority = prio; - if (pthread_setschedparam(pid, policy, &sched_param) == -1) - { - printf("Can't set policy to %d and prio to %d\n", - policy, prio); - exit(PTS_UNRESOLVED); - } - return 0; -} - -static void* fn_rd(void *arg) -{ - int rc = 0; - int priority; - rd_thread_state = ENTERED_THREAD; - - priority = (int)(long)arg; - set_priority(pthread_self(), TRD_POLICY, priority); - - printf("rd_thread: attempt read lock\n"); - rc = pthread_rwlock_rdlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: rd_thread failed to get read lock, Error code:%d\n" - , rc); - exit(PTS_FAIL); - } else - printf("rd_thread: acquired read lock\n"); - - - sleep(1); - - printf("rd_thread: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("rd_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - rd_thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -static void* fn_wr(void *arg) -{ - int rc = 0; - int priority; - wr_thread_state = ENTERED_THREAD; - - priority = (long)arg; - set_priority(pthread_self(), TRD_POLICY, priority); - - printf("wr_thread: attempt write lock\n"); - rc = pthread_rwlock_wrlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: wr_thread failed to get write lock, Error code:%d\n" - , rc); - exit(PTS_UNRESOLVED); - } else - printf("wr_thread: acquired write lock\n"); - - sleep(1); - - printf("wr_thread: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("wr_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - wr_thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - - #ifndef _POSIX_THREAD_PRIORITY_SCHEDULING - printf("Posix Thread Execution Scheduling not supported\n"); - return PTS_UNSUPPORTED; - #endif - - int cnt = 0; - pthread_t rd_thread, wr_thread; - int priority; - - /* main thread needs to have the highest priority*/ - priority = sched_get_priority_min(TRD_POLICY) + 2; - set_priority(pthread_self(), TRD_POLICY, priority); - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - /* We have no lock, this read lock should succeed */ - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("Test FAILED: main cannot get read lock when no one owns the lock\n"); - return PTS_FAIL; - } else - printf("main: acquired read lock\n"); - - wr_thread_state = NOT_CREATED_THREAD; - priority = sched_get_priority_min(TRD_POLICY); - printf("main: create wr_thread, with priority: %d\n", priority); - if(pthread_create(&wr_thread, NULL, fn_wr, (void*)(long)priority) != 0) - { - printf("main: Error at 1st pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - - /* We expect the wr_thread to block */ - cnt = 0; - do{ - sleep(1); - }while (wr_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(wr_thread_state == EXITING_THREAD ) - { - printf("wr_thread did not block on write lock, when a reader owns the lock\n"); - exit(PTS_UNRESOLVED); - } - else if(wr_thread_state != ENTERED_THREAD) - { - printf("Unexpected wr_thread state\n"); - exit(PTS_UNRESOLVED); - } - - rd_thread_state = NOT_CREATED_THREAD; - priority = sched_get_priority_min(TRD_POLICY) + 1; - printf("main: create rd_thread, with priority: %d\n", priority); - if(pthread_create(&rd_thread, NULL, fn_rd, (void*)(long)priority) != 0) - { - printf("main: failed at creating rd_thread\n"); - return PTS_UNRESOLVED; - } - - /* We expect the rd_thread get the read lock*/ - cnt = 0; - do{ - sleep(1); - }while (rd_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(rd_thread_state == ENTERED_THREAD ) - { - printf("Test FAILED: rd_thread blocked on read lock\n"); - exit(PTS_FAIL); - } - else if(rd_thread_state != EXITING_THREAD) - { - printf("Unexpected rd_thread state\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: failed to release read lock\n"); - exit(PTS_UNRESOLVED); - } - - /* we expect the writer get the lock */ - cnt = 0; - do{ - sleep(1); - }while (wr_thread_state !=EXITING_THREAD && cnt++ < 3); - - if(wr_thread_state == ENTERED_THREAD ) - { - printf("Test FAILED: higher priority wr_thread still blocked on write lock, when a reader release the lock\n"); - exit(PTS_FAIL); - } - else if(wr_thread_state != EXITING_THREAD) - { - printf("Unexpected wr_thread state\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(wr_thread, NULL) != 0) - { - printf("main: Error at 1st pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(rd_thread, NULL) != 0) - { - printf("main: Error at 2nd pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/4-1.c deleted file mode 100644 index d92d05ca47..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/4-1.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * Test pthread_rwlock_rdlock(pthread_rwlock_t * rwlock) - * - * If a signal is delivered to a thread waiting for a read-write lock for reading, upon - * return from the signal handler the thread resumes waiting for the read-write lock for - * reading as if it was not interrupted. - * - * Steps: - * 1. main thread create read-write lock 'rwlock', and lock it for writing - * 2. main thread create a thread sig_thread, the thread is set to handle SIGUSR1 - * 3. sig_thread try to lock 'rwlock' for reading but will block - * 4. main thread sends SIGUSR1 to sig_thread via pthread_kill - * 5. test that thread handler is called - * 6. check that when thread handler returns, sig_thread resumes blocking for rwlock - * 7. main thread unlock 'rwlock', sig_thread should get the lock - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_t sig_thread; -static pthread_rwlock_t rwlock; - -static int thread_state; -static int handler_called; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - - -static void sig_handler() { - if(pthread_equal(pthread_self(), sig_thread)) - { - printf("sig_handler: handled signal SIGUSR1\n"); - handler_called = 1; - } - else - { - printf("signal is not handled by sig_thread\n"); - exit(PTS_UNRESOLVED); - } -} - -static void * th_fn(void *arg) -{ - struct sigaction act; - int rc = 0; - - act.sa_flags = 0; - act.sa_handler = sig_handler; - /* Try to block all signals when handling SIGUSR1 */ - sigfillset(&act.sa_mask); - sigaction(SIGUSR1, &act, 0); - - thread_state = ENTERED_THREAD; - printf("sig_thread: attemp read lock\n"); - rc = pthread_rwlock_rdlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: sig_thread: Error at pthread_rwlock_rdlock(), Error code=%d\n", rc); - exit(PTS_FAIL); - } else - printf("sig_thread: acquired read lock\n"); - - printf("sig_thread: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("sig_thread: Error release readlock\n"); - exit(PTS_UNRESOLVED); - } - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt; - handler_called = 0; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } else - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&sig_thread, NULL, th_fn, NULL) != 0) - { - printf("main: Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* wait at most 3 seconds for sig_thread to block*/ - cnt = 0; - do{ - sleep(1); - }while(thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - printf("Test FAILED: thread did not block on read lock when a writer holds the lock\n"); - exit(PTS_FAIL); - } - else if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - /* sig_thread is blocking */ - printf("main: fire SIGUSR1 to sig_thread\n"); - if(pthread_kill(sig_thread, SIGUSR1) != 0) - { - printf("main: failed to send SIGUSER to sig_thread\n"); - exit(PTS_UNRESOLVED); - } - - /* wait at most 3 seconds for the signal to be handled */ - cnt = 0; - do{ - sleep(1); - }while(handler_called == 0 && cnt++ < 3); - - if(handler_called != 1) - { - printf("SIGUSR1 was not caught by sig_thread\n"); - exit(PTS_UNRESOLVED); - } - - /* sig_thread resume to block? */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - printf("Test FAILED: upon return from signal handler, sig_thread does not resume to block\n"); - exit(PTS_FAIL); - }else if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("sig_thread: correctly still blocking after signal handler returns\n"); - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Failed to release write lock\n"); - exit(PTS_UNRESOLVED); - } - - /* sig_thread got the read lock? */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: sig_thread blocked on read lock when writer release the lock\n"); - exit(PTS_FAIL); - }else if(thread_state != EXITING_THREAD) - { - printf("Unexpected thread state: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(sig_thread, NULL) != 0) - { - printf("main: failed at pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("main: failed at pthread_rwlock_destroy()\n"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/5-1.c deleted file mode 100644 index 643d01dd3e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/5-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) - * - * A thread may hold multiple concurrent read locks on 'rwlock' and the application shall - * ensure that the thread will perform matching unlocks for each read lock. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main read locks 'rwlock' 10 times - * 3. Main unlocks 'rwlock' 10 times. - * - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include "posixtest.h" - -#define COUNT 10 - -int main() -{ - - static pthread_rwlock_t rwlock; - int i; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - for(i=0;i < COUNT;i++) - { - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("Test FAILED: main cannot get read-lock rwlock number: %d\n", i); - return PTS_FAIL; - } - } - - for(i = 0;i < COUNT;i++) - { - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Test FAILED: main cannot unlock rwlock number %d", i); - return PTS_FAIL; - } - } - - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/6-2.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/6-2.sh deleted file mode 100755 index 10aa89a131..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/6-2.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -#If successful, the pthread_rwlock_rdlock( ) function shall return zero; otherwise, an error number -#shall be returned to indicate the error. - - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/assertions.xml deleted file mode 100644 index fa5c85ef79..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/assertions.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - pthread_rwlock_rdlock( ) function shall apply a read lock to the - read-write lock referenced by rwlock. The calling thread acquires - the read lock if a writer does not hold the lock and there are - no writers blocked on the lock. - - - - If the Thread Execution Scheduling option is supported, - and the threads involved in the lock are executing with the - scheduling policies SCHED_FIFO or SCHED_RR, the calling thread shall not - acquire the lock if a writer holds the lock or if writers of - higher or equal priority are blocked on the lock; - otherwise, the calling thread shall acquire the lock. - - - - If the Threads Execution Scheduling option is supported, and the threads - involved in the lock are executing with the SCHED_SPORADIC scheduling policy, - the calling thread shall not acquire the lock if a writer holds the lock or - if writers of higher or equal priority are blocked on - the lock; otherwise, the calling thread shall acquire the lock. - - - - If a signal is delivered to a thread waiting for a read-write lock for reading, - upon return from the signal handler the thread resumes waiting for the read-write - lock for reading as if it was not interrupted. - - - - A thread may hold multiple concurrent read locks on 'rwlock' and the application shall - ensure that the thread will perform matching unlocks for each read lock. - - - - If successful, the pthread_rwlock_rdlock( ) function shall return zero; - otherwise, an error number shall be returned to indicate the error. - These functions shall not return an error code of [EINTR]. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/coverage.txt deleted file mode 100644 index 04e75cac8d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_rdlock/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_rwlock_rdlock() function: - -Assertion Tested? -1 YES -2 YES ** Need support of Threads Execution Scheduling -3 NO: ** Need support of SCHED_SPORADIC -4 YES -5 YES -6 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/1-1.c deleted file mode 100644 index 7bfbb6c3cd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/1-1.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock) - * - * The function shall apply a read lock to the read-write lock referenced by - * rwlock as in the pthread_rwlock_rdlock(). However, if the lock cannot be - * acquired with out waiting for other threads to unlock the lock, this wait - * shall be terminated when the specified timeout expires. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main thread lock 'rwlock' for reading with pthread_rwlock_rdlock() - * 3. Create a child thread, the thread lock 'rwlock' for reading, - * using pthread_rwlock_timedrdlock(), should get read lock. Thread unlocks 'rwlock'. - * 4. Main thread unlock 'rwlock' - * 5. Main thread lock 'rwlock' for writing - * 6. Create child thread to lock 'rwlock' for reading, - * using pthread_rwlock_timedrdlock, should block - * but when the timer expires, the wait will be terminated - * 7. Main thread unlock 'rwlock' - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -#define TIMEOUT 3 - -static pthread_rwlock_t rwlock; -static int thread_state; -static struct timeval currsec1, currsec2; - -static void* fn_rd(void *arg) -{ - - thread_state = ENTERED_THREAD; - struct timespec timeout; - int rc; - - gettimeofday(&currsec1, NULL); - - /* Absolute time, not relative. */ - timeout.tv_sec = currsec1.tv_sec + TIMEOUT; - timeout.tv_nsec = currsec1.tv_usec * 1000; - - printf("thread: attempt timed read lock, %d secs\n", TIMEOUT); - rc = pthread_rwlock_timedrdlock(&rwlock, &timeout); - if(rc == ETIMEDOUT) - printf("thread: timer expired\n"); - else if(rc == 0) - { - printf("thread: acquired read lock\n"); - printf("thread: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - exit(PTS_UNRESOLVED); - } - } - else - { - printf("Error: thread: in pthread_rwlock_timedrdlock(), return code:%d\n", rc); - exit(PTS_UNRESOLVED); - } - - /* Get time after the pthread_rwlock_timedrdlock() call. */ - gettimeofday(&currsec2, NULL); - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - pthread_t rd_thread1, rd_thread2; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_rdlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired read lock\n"); - - thread_state = NOT_CREATED_THREAD; - - printf("main: create rd_thread1\n"); - if(pthread_create(&rd_thread1, NULL, fn_rd, NULL) != 0) - { - printf("main: Error when creating rd_thread1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 5 seconds, - we regard it as blocked */ - - /* we expect the thread not to block */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 5); - - if(thread_state == ENTERED_THREAD) - { - /* the child thread started but blocked */ - printf("Test FAILED: rd_thread1 blocked on pthread_rwlock_timedrdlock()\n"); - exit(PTS_FAIL); - } - else if(thread_state != EXITING_THREAD) - { - printf("Unexpected thread state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(rd_thread1, NULL) != 0) - { - printf("main: Error when join rd_thread1\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error when release read lock\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("main: Failed to get write lock\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - printf("main: create rd_thread2\n"); - if(pthread_create(&rd_thread2, NULL, fn_rd, NULL) != 0) - { - printf("main: Failed to create rd_thread2\n"); - return PTS_UNRESOLVED; - } - - /* we expect rd_thread2 to block and timeout. */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 5); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time interval */ - struct timeval time_diff; - time_diff.tv_sec = currsec2.tv_sec - currsec1.tv_sec; - time_diff.tv_usec = currsec2.tv_usec - currsec1.tv_usec; - if (time_diff.tv_usec < 0) - { - --time_diff.tv_sec; - time_diff.tv_usec += 1000000; - } - if(time_diff.tv_sec < TIMEOUT) - { - printf("Test FAILED: the timer expired and thread terminated, but the timeout is not correct: start time %ld.%06ld, end time %ld.%06ld\n", (long) currsec1.tv_sec, (long) currsec1.tv_usec, (long) currsec2.tv_sec, (long) currsec2.tv_usec); - exit(PTS_FAIL); - } else - printf("thread: read lock correctly timed out\n"); - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: read block was not terminated even when the timer expired\n"); - exit(PTS_FAIL); - } - else - { - printf("Unexpected thread state %d\n", thread_state); - return PTS_UNRESOLVED; - } - - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Failed to release write lock\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/2-1.c deleted file mode 100644 index 980c4473f3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/2-1.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock) - * - * The timeout shall expire when the absolute time specified by abs_timeout passes, - * as measured by the clock on which timeouts are based (that is, when the - * value of that clock equals or exceeds abs_timeout), or if the absolute time - * specified by abs_timeout has already been passed at the time of the call. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main thread lock 'rwlock' for writing with pthread_rwlock_rdlock() - * 3. Create a child thread, specify a 'abs_timeout' as being the current time _minus_ - * a timeout value of 1. (this ensures that the abs_timeout has already passed) - * 4. The thread lock 'rwlock' for reading, using pthread_rwlock_timedrdlock(). Should - * get an ETIMEOUT error. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -#define TIMEOUT 1 - -static pthread_rwlock_t rwlock; -static int thread_state; -static int currsec1, currsec2; -static int expired; - -static void* fn_rd(void *arg) -{ - struct timespec abs_timeout; - int rc; - thread_state = ENTERED_THREAD; - - currsec1 = time(NULL); - - /* Absolute time, not relative. */ - abs_timeout.tv_sec = currsec1 - TIMEOUT; - abs_timeout.tv_nsec = 0; - - printf("thread: attempt timed read-lock\n"); - rc = pthread_rwlock_timedrdlock(&rwlock, &abs_timeout); - if(rc == ETIMEDOUT) - { - printf("thread: timed read-lock correctly expired\n"); - expired = 1; - } - else if(rc == 0) - { - printf("thread: acquired read-lock\n"); - expired = 0; - printf("thread: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("thread: failed to release lock\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("Error in pthread_rwlock_timedrdlock(), error code:%d.\n", rc); - exit(PTS_UNRESOLVED); - } - - /* Get time after the mutex timed out in locking. */ - currsec2 = time(NULL); - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - pthread_t thread1; - - expired = 0; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - printf("main: create thread\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&thread1, NULL, fn_rd, NULL) != 0) - { - printf("Error creating thread1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 5 seconds, - we regard it as blocked */ - - /* We expect the thread _NOT_ to block, and instead time out */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 5); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time expired or not */ - if(expired != 1) - { - printf("Test FAILED: abs_timeout should expire\n"); - exit(PTS_FAIL); - } - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread blocked even when the timer expired\n"); - exit(PTS_FAIL); - } - else - { - printf("Unexpected thread state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_unlock()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_join(thread1, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/3-1.c deleted file mode 100644 index 4398e38af9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/3-1.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock) - * - * The function shall apply a read lock to the read-write lock referenced by - * rwlock as in the pthread_rwlock_rdlock(). However, if the lock cannot be - * acquired with out waiting for other threads to unlock the lock, this wait - * shall be terminated when the specified timeout expires. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main thread lock 'rwlock' for reading with pthread_rwlock_rdlock() - * 3. Create a child thread, the thread lock 'rwlock' for reading, - * using pthread_rwlock_timedrdlock(), should get read lock. Thread unlocks 'rwlock'. - * 4. Main thread unlock 'rwlock' - * 5. Main thread lock 'rwlock' for writing - * 6. Create child thread to lock 'rwlock' for reading, - * using pthread_rwlock_timedrdlock, should block - * but when the timer expires, the wait will be terminated - * 7. Main thread unlock 'rwlock' - */ - -/* Test for CLOCK_REALTIME */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -#define TIMEOUT 3 - -static pthread_rwlock_t rwlock; -static int thread_state; -static struct timeval currsec1, currsec2; - -static void* fn_rd(void *arg) -{ - - thread_state = ENTERED_THREAD; - struct timespec timeout, ts; - int rc; -#ifdef CLOCK_REALTIME - printf("Test CLOCK_REALTIME\n"); - clock_gettime(CLOCK_REALTIME, &ts); - currsec1.tv_sec = ts.tv_sec; - currsec1.tv_usec = ts.tv_nsec / 1000; -#else - (void)ts; - gettimeofday(&currsec1, NULL); -#endif - /* Absolute time, not relative. */ - timeout.tv_sec = currsec1.tv_sec + TIMEOUT; - timeout.tv_nsec = currsec1.tv_usec * 1000; - - printf("thread: attempt timed read lock, %d secs\n", TIMEOUT); - rc = pthread_rwlock_timedrdlock(&rwlock, &timeout); - if(rc == ETIMEDOUT) - printf("thread: timer expired\n"); - else if(rc == 0) - { - printf("thread: acquired read lock\n"); - printf("thread: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - exit(PTS_UNRESOLVED); - } - } - else - { - printf("Error: thread: in pthread_rwlock_timedrdlock(), return code:%d\n", rc); - exit(PTS_UNRESOLVED); - } - - /* Get time after the pthread_rwlock_timedrdlock() call. */ -#ifdef CLOCK_REALTIME - clock_gettime(CLOCK_REALTIME, &ts); - currsec2.tv_sec = ts.tv_sec; - currsec2.tv_usec = ts.tv_nsec / 1000; -#else - gettimeofday(&currsec2, NULL); -#endif - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - pthread_t rd_thread1, rd_thread2; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_rdlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired read lock\n"); - - thread_state = NOT_CREATED_THREAD; - - printf("main: create rd_thread1\n"); - if(pthread_create(&rd_thread1, NULL, fn_rd, NULL) != 0) - { - printf("main: Error when creating rd_thread1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 5 seconds, - we regard it as blocked */ - - /* we expect the thread not to block */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 5); - - if(thread_state == ENTERED_THREAD) - { - /* the child thread started but blocked */ - printf("Test FAILED: rd_thread1 blocked on pthread_rwlock_timedrdlock()\n"); - exit(PTS_FAIL); - } - else if(thread_state != EXITING_THREAD) - { - printf("Unexpected thread state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(rd_thread1, NULL) != 0) - { - printf("main: Error when join rd_thread1\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error when release read lock\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("main: Failed to get write lock\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - printf("main: create rd_thread2\n"); - if(pthread_create(&rd_thread2, NULL, fn_rd, NULL) != 0) - { - printf("main: Failed to create rd_thread2\n"); - return PTS_UNRESOLVED; - } - - /* we expect rd_thread2 to block and timeout. */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 5); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time interval */ - struct timeval time_diff; - time_diff.tv_sec = currsec2.tv_sec - currsec1.tv_sec; - time_diff.tv_usec = currsec2.tv_usec - currsec1.tv_usec; - if (time_diff.tv_usec < 0) - { - --time_diff.tv_sec; - time_diff.tv_usec += 1000000; - } - if(time_diff.tv_sec < TIMEOUT) - { - printf("Test FAILED: the timer expired and thread terminated, " - "but the timeout is not correct: " - "start time %ld.%06ld, end time %ld.%06ld\n", - (long) currsec1.tv_sec, (long) currsec1.tv_usec, - (long) currsec2.tv_sec, (long) currsec2.tv_usec); - exit(PTS_FAIL); - } else - printf("thread: read lock correctly timed out\n"); - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: read block was not terminated even when the timer expired\n"); - exit(PTS_FAIL); - } - else - { - printf("Unexpected thread state %d\n", thread_state); - return PTS_UNRESOLVED; - } - - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Failed to release write lock\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/4-1.sh deleted file mode 100755 index f66d617262..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/4-1.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_rwlock_timedwrlock() - -# If the Timers option is not supported, the timeout shall be based on the -# system clock as returned by the time( ) function. The resolution of the timeout -# shall be the resolution of the clock on which it is based. The timespec data type -# is defined in the header. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/5-1.c deleted file mode 100644 index d2c047495e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/5-1.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock) - * - * Under no circumstances shall the function fail with a timeout if the lock can be - * acquired immediately. The abs_timeout parameter need not be checked if the lock - * can be immediately acquired. - * - * Steps:n - * 1. Main thread create a thread. - * 2. Child thread lock 'rwlock' for reading with pthread_rwlock_timedrdlock(), - * should not fail with timeout - * 3. The child thread unlocks the 'rwlock' and exits. - * 4. Main thread create another thread. - * 4. The child thread lock 'rwlock' for reading, with pthread_rwlock_timedrdlock(), - * specifying a 'abs_timeout'. The thread sleeps until 'abs_timeout' expires. - * 5. The thread call pthread_rwlock_timedrdlock(). Should _NOT_ get ETIMEDOUT. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -#define TIMEOUT 1 -static int thread_state; -static int currsec1; -static int expired; - -static void* fn_rd_1(void *arg) -{ - thread_state = ENTERED_THREAD; - struct timespec abs_timeout; - int rc; - pthread_rwlock_t rwlock; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("thread1: Error at pthread_rwlock_init\n"); - exit(PTS_UNRESOLVED); - } - - currsec1 = time(NULL); - - /* Absolute time, not relative. */ - abs_timeout.tv_sec = currsec1 + TIMEOUT; - abs_timeout.tv_nsec = 0; - - printf("thread1: attempt timed read-lock\n"); - rc = pthread_rwlock_timedrdlock(&rwlock, &abs_timeout); - if(rc == ETIMEDOUT) - { - printf("thread1: timed read-lock expired\n"); - expired = 1; - } - else if(rc == 0) - { - printf("thread1: acquired read lock\n"); - expired = 0; - printf("thread1: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("thread1: failed to release read lock\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("thread1: Error in pthread_rwlock_timedrdlock().\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("thread1: Error at pthread_rwlockattr_destroy()"); - exit(PTS_UNRESOLVED); - } - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -static void* fn_rd_2(void *arg) -{ - thread_state = ENTERED_THREAD; - struct timespec abs_timeout; - int rc; - pthread_rwlock_t rwlock; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("thread2: Error at pthread_rwlock_init\n"); - exit(PTS_UNRESOLVED); - } - currsec1 = time(NULL); - - /* Ensure that the abs_timeout has passed by _subtracting_ the timeout value of 1 - * from the current time. */ - abs_timeout.tv_sec = currsec1 - TIMEOUT; - abs_timeout.tv_nsec = 0; - - printf("thread2: attempt timed read-lock\n"); - rc = pthread_rwlock_timedrdlock(&rwlock, &abs_timeout); - if(rc == ETIMEDOUT) - { - printf("thread2: timed read-lock expired\n"); - expired = 1; - } - else if(rc == 0) - { - printf("thread2: acquired read lock\n"); - expired = 0; - printf("thread2: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("thread2: failed to release read lock\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("thread2: Error in pthread_rwlock_timedrdlock().\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("thread2: Error at pthread_rwlockattr_destroy()\n"); - exit(PTS_UNRESOLVED); - } - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - - pthread_t thread1, thread2; - - thread_state = NOT_CREATED_THREAD; - printf("main: create thread1\n"); - if(pthread_create(&thread1, NULL, fn_rd_1, NULL) != 0) - { - printf("Error when creating thread1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 5 seconds, - we regard it as blocked */ - - /* we expect thread1 NOT to block, but rather for the timed read-lock to expire */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 5); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time expired or not */ - if(expired == 1) - { - printf("Test FAILED: thread1 incorrectly received ETIMEDOUT\n"); - return PTS_FAIL; - } - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread1 incorrectly blocked for reading rwlock\n"); - return PTS_FAIL; - } - else - { - printf("Unexpected state for thread1 %d\n", thread_state); - return PTS_UNRESOLVED; - } - - if(pthread_join(thread1, NULL) != 0) - { - printf("Error when joining thread1\n"); - return PTS_UNRESOLVED; - } - - printf("main: create thread2\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&thread2, NULL, fn_rd_2, NULL) != 0) - { - printf("Error when creating thread2\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 5 seconds, - we regard it as blocked */ - - /* we expect thread2 NOT to block */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 5); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time expired or not */ - if(expired == 1) - { - printf("Test FAILED: thread2 incorrectly received ETIMEDOUT\n"); - return PTS_FAIL; - } - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread2 incorrectly blocked for reading rwlock\n"); - return PTS_FAIL; - } - else - { - printf("Unexpected state for thread2 %d\n", thread_state); - return PTS_UNRESOLVED; - } - - if(pthread_join(thread2, NULL) != 0) - { - printf("Error when join thread2\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-1.c deleted file mode 100644 index 8eeeac6580..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-1.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * Test pthread_rwlock_timedrdlock(pthread_rwlock_t * rwlock) - * - * If a signal that causes a signal handler to be executed is delivered to - * a thread blocked on a read-write lock via a call to pthread_rwlock_timedrdlock( ), - * upon return from the signal handler the thread shall resume waiting for the lock - * as if it was not interrupted. - * - * Test that after returning from a signal handler, the reader will continue - * to wait with timedrdlock as long as the specified 'timeout' does not expire (the - * time spent in signal handler is longer than the specifed 'timeout'). - * - * Steps: - * 1. main thread create and write lock 'rwlock' - * 2. main thread create a thread sig_thread, the thread is set to handle SIGUSR1 - * 3. sig_thread timed read-lock 'rwlock' for reading, it should block - * 4. While the sig_thread is waiting (not expired yet), main thread sends SIGUSR1 - * to sig_thread via pthread_kill - * 5. Check that when thread handler returns, sig_thread resume block - * 7. When the wait is terminated, check that the thread wait for a proper period before - * expiring. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_t sig_thread; -static pthread_rwlock_t rwlock; - -static int thread_state; -static int handler_called; -static struct timeval before_wait, after_wait; - - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -#define TIMEOUT 5 - -/* Signal handler called by the thread when SIGUSR1 is received */ -static void sig_handler() { - - if(pthread_equal(pthread_self(), sig_thread)) - { - printf("sig_handler: signal is handled by sig_thread\n"); - handler_called = 1; - - } - else - { - printf("sig_handler: signal is not handled by sig_thread\n"); - exit(PTS_UNRESOLVED); - } -} - -static void * th_fn(void *arg) -{ - struct sigaction act; - struct timespec abs_timeout; - int rc = 0; - - handler_called = 0; - - /* Set up signal handler for SIGUSR1 */ - - act.sa_flags = 0; - act.sa_handler = sig_handler; - /* block all the signal when hanlding SIGUSR1 */ - sigfillset(&act.sa_mask); - sigaction(SIGUSR1, &act, 0); - - gettimeofday(&before_wait, NULL); - abs_timeout.tv_sec = before_wait.tv_sec; - abs_timeout.tv_nsec = before_wait.tv_usec * 1000; - abs_timeout.tv_sec += TIMEOUT; - - printf("thread: attempt timed read lock, %d seconds\n", TIMEOUT); - thread_state = ENTERED_THREAD; - rc = pthread_rwlock_timedrdlock(&rwlock, &abs_timeout); - if(rc != ETIMEDOUT) - { - printf("sig_thread: pthread_rwlock_timedlock returns %d\n", rc); - exit(PTS_FAIL); - } - printf("thread: timer correctly expired\n"); - gettimeofday(&after_wait, NULL); - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt; - struct timeval wait_time; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&sig_thread, NULL, th_fn, NULL) != 0) - { - printf("Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* Wait for the thread to get ready for handling signal (the thread should - * be block on rwlock since main() has the write lock at this point) */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != ENTERED_THREAD && cnt++ < TIMEOUT); - - if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: fire SIGUSR1 to thread\n"); - if(pthread_kill(sig_thread, SIGUSR1) != 0) - { - printf("main: Error at pthread_kill()\n"); - exit(PTS_UNRESOLVED); - } - - /* wait at most 2*TIMEOUT seconds */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != EXITING_THREAD && cnt++ < 2*TIMEOUT); - - if(cnt >= 2*TIMEOUT) - { - /* thread blocked*/ - printf("Test FAILED: thread blocked even afer the abs_timeout expired\n"); - exit(PTS_FAIL); - } - - if(handler_called != 1) - { - printf("The handler for SIGUSR1 did not get called\n"); - exit(PTS_UNRESOLVED); - } - - /* Test that the thread block for the correct TIMOUT time */ - wait_time.tv_sec = after_wait.tv_sec - before_wait.tv_sec; - wait_time.tv_usec = after_wait.tv_usec - before_wait.tv_usec; - if (wait_time.tv_usec < 0) - { - --wait_time.tv_sec; - wait_time.tv_usec += 1000000; - } - if(wait_time.tv_sec < TIMEOUT) - { - printf("Test FAILED: Timeout was for %d seconds, but waited for %ld.%06ld seconds instead\n", - TIMEOUT, (long int)wait_time.tv_sec, (long int)wait_time.tv_usec); - exit(PTS_FAIL); - } - - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_unlock()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_join(sig_thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-2.c deleted file mode 100644 index c94f3bf306..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-2.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * Test pthread_rwlock_timedrdlock(pthread_rwlock_t * rwlock) - * - * If a signal that causes a signal handler to be executed is delivered to - * a thread blocked on a read-write lock via a call to pthread_rwlock_timedrdlock( ), - * upon return from the signal handler the thread shall resume waiting for the lock - * as if it was not interrupted. - * - * Steps: - * 1. main thread create read-write lock 'rwlock', and lock it for writing - * 2. main thread create a thread sig_thread, the thread is set to handle SIGUSR1 - * 3. sig_thread timed lock 'rwlock' for reading, but blocked - * 4. While the sig_thread is waiting(not expried yet), main thread send SIGUSR1 - * to sig_thread via pthread_kill - * 5. test that thread handler is called, inside the handler, make the thread sleep - * for a period that the specified 'timeout' for pthread_rwlock_timedrdlock() - * should have expired (timeout * 2) - * 6. While sig_thread sleeping in signal handler, main thread unlock 'rwlock' - * 7. check that when thread handler returns, sig_thread get the read lock without - * getting ETIMEDOUT. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -#define TIMEOUT 2 - -static pthread_t sig_thread; -static pthread_rwlock_t rwlock; - -static int thread_state; -static int handler_state; -static int expired; -static struct timeval before_wait, after_wait; - -static void sig_handler() { - - struct timespec sleep_time_req; - - sleep_time_req.tv_sec = TIMEOUT*2; - sleep_time_req.tv_nsec = 0; - - if(pthread_equal(pthread_self(), sig_thread)) - { - printf("sig_handler: signal is handled by thread\n"); - /* sig_handler will not sleep 2 times more than the timeout for the - * pthread_rwlock_timerdlock is waiting for */ - printf("sig_handler: sleeping for %d seconds\n", (int)sleep_time_req.tv_sec); - handler_state = 2; - sleep((int)sleep_time_req.tv_sec); - } - else - { - printf("sig_handler: signal is not handled by thread\n"); - exit(PTS_UNRESOLVED); - } - - handler_state = 3; -} - -static void * th_fn(void *arg) -{ - struct sigaction act; - struct timespec abs_timeout; - int rc; - handler_state = 2; - expired = 0; - - /* Set up handler for SIGUSR1 */ - - act.sa_flags = 0; - act.sa_handler = sig_handler; - /* block all the signal when hanlding SIGUSR1 */ - sigfillset(&act.sa_mask); - sigaction(SIGUSR1, &act, 0); - - gettimeofday(&before_wait, NULL); - abs_timeout.tv_sec = before_wait.tv_sec + TIMEOUT; - abs_timeout.tv_nsec = before_wait.tv_usec * 1000; - - thread_state = ENTERED_THREAD; - - printf("thread: attempt timed read lock, %d seconds\n", TIMEOUT); - rc = pthread_rwlock_timedrdlock(&rwlock, &abs_timeout); - if(rc == 0) - { - printf("thread: correctly acquired read lock\n"); - expired = 0; - } - else if(rc == ETIMEDOUT) - { - printf("thread: timer expired, did not acquire read lock"); - expired = 1; - } - else - { - printf("Error at pthread_rwlock_timedrdlock()"); - exit(PTS_UNRESOLVED); - } - - gettimeofday(&after_wait, NULL); - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&sig_thread, NULL, th_fn, NULL) != 0) - { - printf("Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* wait for the thread to get ready for handling signal */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != ENTERED_THREAD && cnt++ < TIMEOUT); - - if(thread_state != ENTERED_THREAD) - { - printf("Error: thread did not block when getting read lock\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: fire SIGUSR1 to thread\n"); - if(pthread_kill(sig_thread, SIGUSR1) != 0) - { - printf("Error in pthread_kill()"); - exit(PTS_UNRESOLVED); - } - - /* Wait for signal handler to sleep so that main can unlock the rwlock while - * it is sleeping. (this way, the rwlock will be unlocked when the signal handler - * returns, and control is given back to the thread) */ - - cnt = 0; - do{ - sleep(TIMEOUT); - }while(handler_state !=2 && cnt++ < 2); - - if(handler_state == 1) - { - printf("Error: signal handler did not get called\n"); - exit(PTS_UNRESOLVED); - } - else if(handler_state == 3) - { - printf("Error: signal handler incorrectly exited\n"); - exit(PTS_UNRESOLVED); - } - - if(expired == 1) - { - printf("Error: thread timeout in sig_handler\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - - /* wait at most 4*TIMEOUT seconds for thread to exit */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != EXITING_THREAD && cnt++ < 4*TIMEOUT); - - - if(cnt >= 4*TIMEOUT) - { - /* thread blocked*/ - printf("Test FAILED: thread blocked even afer the abs_timeout expires\n"); - exit(PTS_FAIL); - } - - if(expired == 1) - { - printf("Test FAILED: thread should get the read lock\n"); - exit(PTS_FAIL); - } - - if(pthread_join(sig_thread, NULL) != 0) - { - printf("Error at pthread_join()"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_destroy()"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/7-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/7-1.sh deleted file mode 100755 index bfc70e8fab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/7-1.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_rwlock_timedrdlock() - -# Shall return zero if the lock for writing on the read-write lock object -# referenced by rwlock is acquired. Otherwise, an error number shall be returned -# to indicate the error - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/assertions.xml deleted file mode 100644 index 323f20558e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/assertions.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - The function shall apply a read lock to the read-write lock referenced by - rwlock as in the pthread_rwlock_rdlock(). However, if the lock cannot be - acquired wither out waiting for other threads to unlock the lock, this wait - shall be terminated when the specified timeout expires. - - - - The timeout shall expire when the absolute time specified by abs_timeout passes, - as measured by the clock on which timeouts are based (that is, when the - value of that clock equals or exceeds abs_timeout), or if the absolute time - specified by abs_timeout has already been passed at the time of the call. - - - - If the Timers option is supported, the timeout shall be based on the - CLOCK_REALTIME clock. - - - - If the Timers option is not supported, the timeout shall be based on the - system clock as returned by the time( ) function. The resolution of the timeout - shall be the resolution of the clock on which it is based. The timespec data type - is defined in the 'time.h' header. - - - - Under no circumstances shall the function fail with a timeout if the lock can be - acquired immediately. The abs_timeout parameter need not be checked if the lock - can be immediately acquired. - - - - If a signal that causes a signal handler to be executed is delivered to - a thread blocked on a read-write lock via a call to pthread_rwlock_timedwrlock( ), - upon return from the signal handler the thread shall resume waiting for the lock - as if it was not interrupted. - - - - Shall return zero if the lock for writing on the read-write lock object - referenced by rwlock is acquired. Otherwise, an error number shall be returned - to indicate the error - pthread_rwlock_timedwrlock( ) function shall fail if: - [ETIMEDOUT] The lock could not be acquired before the specified timeout expired. - The function shall not return an error code of [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/coverage.txt deleted file mode 100644 index e176011c36..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedrdlock/coverage.txt +++ /dev/null @@ -1,12 +0,0 @@ -This document defines the coverage for the pthread_rwlock_timerdlock() function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/1-1.c deleted file mode 100644 index dd5ca05bc0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/1-1.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock) - * - * pthread_rwlock_timedwrlock( ) function shall apply a write lock to the - * read-write lock referenced by rwlock as in the pthread_rwlock_wrlock( ) function. - * However, if the lock cannot be acquired without waiting for other threads to - * unlock the lock, this wait shall be terminate when the specified timeout expires. - * - * Steps: - * 1. Initialize rwlock - * 2. Main creats thread0. - * 3. Thread0 does pthread_rwlock_timedwrlock(), should get the lock successfully then unlock. - * 4. Main thread locks 'rwlock' for reading with pthread_rwlock_rdlock() - * 5. Create a child thread, the thread time-locks 'rwlock' for writing, - * using pthread_rwlock_timedwrlock(), should block, but when the timer expires, - * that wait will be terminated. - * 6. Main thread unlocks 'rwlock' - * 7. Main thread locks 'rwlock' for writing. - * 8. Create child thread to lock 'rwlock' for writing, using pthread_rwlock_timedwrlock, - * it should block but when the timer expires, the wait will be terminated - * 8. Main thread unlocks 'rwlock' - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 3 - -static pthread_rwlock_t rwlock; -static int thread_state; -static struct timeval currsec1, currsec2; -static int expired; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_wr(void *arg) -{ - struct timespec timeout; - int rc; - thread_state = ENTERED_THREAD; - - gettimeofday(&currsec1, NULL); - - /* Absolute time, not relative. */ - timeout.tv_sec = currsec1.tv_sec + TIMEOUT; - timeout.tv_nsec = currsec1.tv_usec * 1000; - - printf("thread: attempt timed write lock, %d secs\n", TIMEOUT); - rc = pthread_rwlock_timedwrlock(&rwlock, &timeout); - if(rc == ETIMEDOUT) - { - printf("thread: timer expired\n"); - expired = 1; - } - else if(rc == 0) - { - printf("thread: acquired write lock\n"); - expired = 0; - printf("thread: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("thread: error release write lock\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("thread: Error in pthread_rwlock_timedrdlock().\n"); - exit(PTS_UNRESOLVED); - } - - /* Get time after the mutex timed out in locking. */ - gettimeofday(&currsec2, NULL); - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - pthread_t thread0, thread1, thread2; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: create thread0\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&thread0, NULL, fn_wr, NULL) != 0) - { - printf("Error creating thread0\n"); - return PTS_UNRESOLVED; - } - - /* thread0 should not block at all since no one else has locked rwlock */ - - cnt = 0; - expired = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2*TIMEOUT); - - if(thread_state == EXITING_THREAD) - { - if(expired == 1) - { - printf("Test FAILED: the timer expired\n"); - exit(PTS_FAIL); - } - else - printf("thread0 correctly acquired the write lock.\n"); - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread0 incorrectly blocked on timedwrlock\n"); - exit(PTS_FAIL); - } - else - { - printf("Unexpected state for thread0 %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(thread0, NULL) != 0) - { - printf("Error when joining thread0\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - /* We have no lock, this read lock should succeed */ - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_rdlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired read lock\n"); - - thread_state = NOT_CREATED_THREAD; - - printf("main: create thread1\n"); - if(pthread_create(&thread1, NULL, fn_wr, NULL) != 0) - { - printf("Error when creating thread1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after TIMEOUT*2 seconds, - we regard it as blocked */ - - /* we expect the thread to expire blocking after timeout*/ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2*TIMEOUT); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time interval */ - struct timeval time_diff; - time_diff.tv_sec = currsec2.tv_sec - currsec1.tv_sec; - time_diff.tv_usec = currsec2.tv_usec - currsec1.tv_usec; - if (time_diff.tv_usec < 0) - { - --time_diff.tv_sec; - time_diff.tv_usec += 1000000; - } - if(time_diff.tv_sec < TIMEOUT) - { - printf("Test FAILED: the timer expired and blocking was terminated, but the timeout is not correct: expected to wait for %d, but waited for %ld.%06ld\n", TIMEOUT, (long)time_diff.tv_sec, (long)time_diff.tv_usec); - exit(PTS_FAIL); - } - else - printf("thread1 correctly expired at timeout.\n"); - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: wait is not terminated even when the timer expired\n"); - exit(PTS_FAIL); - } - else - { - printf("Unexpected state for thread1 %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Error when release read lock\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(thread1, NULL) != 0) - { - printf("Error when joining thread1\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - cnt = 0; - printf("main: create thread2\n"); - if(pthread_create(&thread2, NULL, fn_wr, NULL) != 0) - { - printf("Error when creating thread2\n"); - return PTS_UNRESOLVED; - } - - /* we expect thread2 to expire blocking after timeout */ - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2*TIMEOUT); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time interval */ - struct timeval time_diff; - time_diff.tv_sec = currsec2.tv_sec - currsec1.tv_sec; - time_diff.tv_usec = currsec2.tv_usec - currsec1.tv_usec; - if (time_diff.tv_usec < 0) - { - --time_diff.tv_sec; - time_diff.tv_usec += 1000000; - } - if(time_diff.tv_sec < TIMEOUT) - { - printf("Test FAILED: for thread 2, the timer expired and waiter terminated, but the timeout is not correct\n"); - exit(PTS_FAIL); - } - else - printf("thread2 correctly expired at timeout.\n"); - - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: for thread2, wait is not terminated even when the timer expired\n"); - exit(PTS_FAIL); - } - else - { - printf("Unexpected state for thread2 %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock write lock\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Error releasing write lock\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/2-1.c deleted file mode 100644 index 2e9b7adf3b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/2-1.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock) - * - * The timeout shall expire when the absolute time specified by abs_timeout passes, - * as measured by the clock on which timeouts are based (that is, when the - * value of that clock equals or exceeds abs_timeout), or if the absolute time - * specified by abs_timeout has already been passed at the time of the call. - * - * Steps: - * 1. Initialize 'rwlock' - * 2. Main thread locks 'rwlock' for writing with pthread_rwlock_wrlock() - * 3. Create a child thread, specify a 'abs_timeout' as being the current time _minus_ a - * timeout period, meaning this will ensure that the abs_timeout would have already - * passed. - * 4. The thread locks 'rwlock' for writing, using pthread_rwlock_timedwrlock(). Should - * get an ETIMEOUT error. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 1 - -static pthread_rwlock_t rwlock; -static int thread_state; -static int currsec1, currsec2; -static int expired; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn(void *arg) -{ - struct timespec abs_timeout; - int rc; - thread_state = ENTERED_THREAD; - - /* Absolute time, not relative. */ - abs_timeout.tv_sec = currsec1 - TIMEOUT; - abs_timeout.tv_nsec = 0; - - printf("thread: attempt timed write-lock\n"); - rc = pthread_rwlock_timedwrlock(&rwlock, &abs_timeout); - if(rc == ETIMEDOUT) - { - printf("thread: timer expired\n"); - expired = 1; - } - else if(rc == 0) - { - printf("thread: acquired write lock\n"); - expired = 0; - printf("thread: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("thread: failed to release lock\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("Error in pthread_rwlock_timedwrlock(), error code:%d.\n", rc); - exit(PTS_UNRESOLVED); - } - - /* Get time after the mutex timed out in locking. */ - currsec2 = time(NULL); - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - pthread_t thread1; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - /* We have no lock, this write lock should succeed */ - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - printf("main: create thread\n"); - if(pthread_create(&thread1, NULL, fn, NULL) != 0) - { - printf("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - /* We expect the thread _NOT_ to block */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time expired or not */ - if(expired != 1) - { - printf("Test FAILED: abs_timeout should expire\n"); - exit(PTS_FAIL); - } - else - printf("thread correctly expired and did not wait\n"); - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread blocked even when the timer expired\n"); - exit(PTS_FAIL); - } - else - { - printf("Unexpected thread state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_unlock()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_join(thread1, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("main: Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/3-1.c deleted file mode 100644 index 28f9818487..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/3-1.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock) - * - * pthread_rwlock_timedwrlock( ) function shall apply a write lock to the - * read-write lock referenced by rwlock as in the pthread_rwlock_wrlock( ) function. - * However, if the lock cannot be acquired without waiting for other threads to - * unlock the lock, this wait shall be terminate when the specified timeout expires. - * - * Steps: - * 1. Initialize rwlock - * 2. Main creats thread0. - * 3. Thread0 does pthread_rwlock_timedwrlock(), should get the lock successfully then unlock. - * 4. Main thread locks 'rwlock' for reading with pthread_rwlock_rdlock() - * 5. Create a child thread, the thread time-locks 'rwlock' for writing, - * using pthread_rwlock_timedwrlock(), should block, but when the timer expires, - * that wait will be terminated. - * 6. Main thread unlocks 'rwlock' - * 7. Main thread locks 'rwlock' for writing. - * 8. Create child thread to lock 'rwlock' for writing, using pthread_rwlock_timedwrlock, - * it should block but when the timer expires, the wait will be terminated - * 8. Main thread unlocks 'rwlock' - */ - -/* Test with CLOCK_REALTIME */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 3 - -static pthread_rwlock_t rwlock; -static int thread_state; -static struct timeval currsec1, currsec2; -static int expired; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_wr(void *arg) -{ - struct timespec timeout, ts; - int rc; - thread_state = ENTERED_THREAD; -#ifdef CLOCK_REALTIME - rc = clock_gettime(CLOCK_REALTIME, &ts); - if (rc != 0) - { - perror("clock_gettime()"); - exit(PTS_UNRESOLVED); - } - currsec1.tv_sec = ts.tv_sec; - currsec1.tv_usec = ts.tv_nsec / 1000; -#else - (void)ts; - gettimeofday(&currsec1, NULL); -#endif - /* Absolute time, not relative. */ - timeout.tv_sec = currsec1.tv_sec + TIMEOUT; - timeout.tv_nsec = currsec1.tv_usec * 1000; - - printf("thread: attempt timed write lock, %d secs\n", TIMEOUT); - rc = pthread_rwlock_timedwrlock(&rwlock, &timeout); - if(rc == ETIMEDOUT) - { - printf("thread: timer expired\n"); - expired = 1; - } - else if(rc == 0) - { - printf("thread: acquired write lock\n"); - expired = 0; - printf("thread: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("thread: error release write lock\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("thread: Error in pthread_rwlock_timedrdlock().\n"); - exit(PTS_UNRESOLVED); - } - - /* Get time after the mutex timed out in locking. */ -#ifdef CLOCK_REALTIME - rc = clock_gettime(CLOCK_REALTIME, &ts); - if (rc != 0) - { - perror("clock_gettime()"); - exit(PTS_UNRESOLVED); - } - currsec2.tv_sec = ts.tv_sec; - currsec2.tv_usec = ts.tv_nsec / 1000; -#else - gettimeofday(&currsec2, NULL); -#endif - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - pthread_t thread0, thread1, thread2; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: create thread0\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&thread0, NULL, fn_wr, NULL) != 0) - { - printf("Error creating thread0\n"); - return PTS_UNRESOLVED; - } - - /* thread0 should not block at all since no one else has locked rwlock */ - - cnt = 0; - expired = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2*TIMEOUT); - - if(thread_state == EXITING_THREAD) - { - if(expired == 1) - { - printf("Test FAILED: the timer expired\n"); - exit(PTS_FAIL); - } - else - printf("thread0 correctly acquired the write lock.\n"); - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread0 incorrectly blocked on timedwrlock\n"); - exit(PTS_FAIL); - } - else - { - printf("Unexpected state for thread0 %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(thread0, NULL) != 0) - { - printf("Error when joining thread0\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - /* We have no lock, this read lock should succeed */ - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_rdlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired read lock\n"); - - thread_state = NOT_CREATED_THREAD; - - printf("main: create thread1\n"); - if(pthread_create(&thread1, NULL, fn_wr, NULL) != 0) - { - printf("Error when creating thread1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after TIMEOUT*2 seconds, - we regard it as blocked */ - - /* we expect the thread to expire blocking after timeout*/ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2*TIMEOUT); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time interval */ - struct timeval time_diff; - time_diff.tv_sec = currsec2.tv_sec - currsec1.tv_sec; - time_diff.tv_usec = currsec2.tv_usec - currsec1.tv_usec; - if (time_diff.tv_usec < 0) - { - --time_diff.tv_sec; - time_diff.tv_usec += 1000000; - } - if(time_diff.tv_sec < TIMEOUT) - { - printf("Test FAILED: the timer expired and blocking " - "was terminated, but the timeout is not correct: " - "expected to wait for %d, but waited for %ld.%06ld\n", - TIMEOUT, (long)time_diff.tv_sec, - (long)time_diff.tv_usec); - exit(PTS_FAIL); - } - else - printf("thread1 correctly expired at timeout.\n"); - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: wait is not terminated even " - "when the timer expired\n"); - exit(PTS_FAIL); - } - else - { - printf("Unexpected state for thread1 %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Error when release read lock\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(thread1, NULL) != 0) - { - printf("Error when joining thread1\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - cnt = 0; - printf("main: create thread2\n"); - if(pthread_create(&thread2, NULL, fn_wr, NULL) != 0) - { - printf("Error when creating thread2\n"); - return PTS_UNRESOLVED; - } - - /* we expect thread2 to expire blocking after timeout */ - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 2*TIMEOUT); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time interval */ - struct timeval time_diff; - time_diff.tv_sec = currsec2.tv_sec - currsec1.tv_sec; - time_diff.tv_usec = currsec2.tv_usec - currsec1.tv_usec; - if (time_diff.tv_usec < 0) - { - --time_diff.tv_sec; - time_diff.tv_usec += 1000000; - } - if(time_diff.tv_sec < TIMEOUT) - { - printf("Test FAILED: for thread 2, the timer expired " - "and waiter terminated, but the timeout is not correct\n"); - exit(PTS_FAIL); - } - else - printf("thread2 correctly expired at timeout.\n"); - - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: for thread2, wait is not terminated " - "even when the timer expired\n"); - exit(PTS_FAIL); - } - else - { - printf("Unexpected state for thread2 %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock write lock\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Error releasing write lock\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/4-1.sh deleted file mode 100755 index f66d617262..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/4-1.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_rwlock_timedwrlock() - -# If the Timers option is not supported, the timeout shall be based on the -# system clock as returned by the time( ) function. The resolution of the timeout -# shall be the resolution of the clock on which it is based. The timespec data type -# is defined in the header. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/5-1.c deleted file mode 100644 index 27f271fae5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/5-1.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock) - * - * Under no circumstances shall the function fail with a timeout if the lock can be - * acquired immediately. The abs_timeout parameter need not be checked if the lock - * can be immediately acquired. - * - * Steps: - * 1. Main thread create a thread. - * 2. Child thread lock 'rwlock' for writing with pthread_rwlock_timedwrlock(), - * should not fail with timeout - * 3. The child thread unlocks the 'rwlock' and exit. - * 4. Main thread create another thread. - * 5. The child thread lock 'rwlock' for write, with pthread_rwlock_timedwrlock(), - * specifying a 'abs_timeout'. The thread sleeps untile 'abs_timeout' expires. - * 6. The thread call pthread_rwlock_timedwrlock(). Should not get ETIMEDOUT. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 1 - -static int thread_state; -static int currsec1; -static int expired; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_wr_1(void *arg) -{ - thread_state = ENTERED_THREAD; - struct timespec abs_timeout; - int rc; - pthread_rwlock_t rwlock; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("thread1: Error at pthread_rwlock_init\n"); - exit(PTS_UNRESOLVED); - } - - currsec1 = time(NULL); - - /* Absolute time, not relative. */ - abs_timeout.tv_sec = currsec1 + TIMEOUT; - abs_timeout.tv_nsec = 0; - - printf("thread1: attempt timed lock for writing\n"); - rc = pthread_rwlock_timedwrlock(&rwlock, &abs_timeout); - if(rc == ETIMEDOUT) - { - printf("thread1: timer expired\n"); - expired = 1; - } - else if(rc == 0) - { - printf("thread1: acquired write lock\n"); - expired = 0; - printf("thread1: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("thread1: failed to release write lock\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("thread1: Error in pthread_rwlock_timedwrlock().\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("thread1: Error at pthread_rwlockattr_destroy()"); - exit(PTS_UNRESOLVED); - } - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -static void* fn_wr_2(void *arg) -{ - thread_state = ENTERED_THREAD; - struct timespec abs_timeout; - int rc; - pthread_rwlock_t rwlock; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("thread2: Error at pthread_rwlock_init\n"); - exit(PTS_UNRESOLVED); - } - currsec1 = time(NULL); - - /* Absolute time, not relative. */ - abs_timeout.tv_sec = currsec1 - TIMEOUT; - abs_timeout.tv_nsec = 0; - - printf("thread2: attempt timed lock for writing\n"); - rc = pthread_rwlock_timedwrlock(&rwlock, &abs_timeout); - if(rc == ETIMEDOUT) - { - printf("thread2: timer expired\n"); - expired = 1; - } - else if(rc == 0) - { - printf("thread2: acquired write lock\n"); - expired = 0; - printf("thread2: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("thread2: failed to release write lock\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("thread2: Error in pthread_rwlock_timedwrlock().\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("thread2: Error at pthread_rwlock_destroy()\n"); - exit(PTS_UNRESOLVED); - } - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - - pthread_t thread1, thread2; - - thread_state = NOT_CREATED_THREAD; - printf("main: create thread1\n"); - if(pthread_create(&thread1, NULL, fn_wr_1, NULL) != 0) - { - printf("Error when creating thread1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 5 seconds, - we regard it as blocked */ - /* we expect thread1 NOT to block */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=3 && cnt++ < 5); - - if(thread_state == 3) - { - /* the child thread does not block, check the time expired or not */ - if(expired == 1) - { - printf("Test FAILED: thread1 got ETIMEOUT when get the lock\n"); - return PTS_FAIL; - } - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread1 blocked\n"); - return PTS_FAIL; - } - else - { - printf("Unexpected state for thread1 %d\n", thread_state); - return PTS_UNRESOLVED; - } - - if(pthread_join(thread1, NULL) != 0) - { - printf("Error when joining thread1\n"); - return PTS_UNRESOLVED; - } - - thread_state = ENTERED_THREAD; - printf("main: create thread2\n"); - if(pthread_create(&thread2, NULL, fn_wr_2, NULL) != 0) - { - printf("Error when creating thread2\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 5 seconds, - we regard it as blocked */ - - /* we expect thread2 NOT to block */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - /* the child thread does not block, check the time expired or not */ - if(expired == 1) - { - printf("Test FAILED: thread2 got ETIMEOUT\n"); - return PTS_FAIL; - } - } - else if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread2 blocked\n"); - return PTS_FAIL; - } - else - { - printf("Unexpected state for thread2 %d\n", thread_state); - return PTS_UNRESOLVED; - } - - if(pthread_join(thread2, NULL) != 0) - { - printf("Error when join thread2\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-1.c deleted file mode 100644 index 42efa66d80..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-1.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * Test pthread_rwlock_timedwrlock(pthread_rwlock_t * rwlock) - * - * If a signal that causes a signal handler to be executed is delivered to - * a thread blocked on a read-write lock via a call to pthread_rwlock_timedwrlock( ), - * upon return from the signal handler the thread shall resume waiting for the lock - * as if it was not interrupted. - * - * Test that after returning from a signal handler, the reader will continue - * to wait with timedrdlock as long as the specified 'timeout' does not expire (the - * time spent in signal handler is longer than the specifed 'timeout'). - * - * Steps: - * 1. main thread create and write lock 'rwlock' - * 2. main thread create a thread sig_thread, the thread is set to handle SIGUSR1 - * 3. sig_thread timed write-lock 'rwlock' for writing, it should block - * 4. While the sig_thread is waiting (not expired yet), main thread sends SIGUSR1 - * to sig_thread via pthread_kill - * 5. Check that when thread handler returns, sig_thread resume block - * 7. When the wait is terminated, check that the thread wait for a proper period before - * expiring. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_t sig_thread; -static pthread_rwlock_t rwlock; - -static int thread_state; -static int handler_called; -static struct timeval before_wait, after_wait; - - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -#define TIMEOUT 5 - -/* Signal handler called by the thread when SIGUSR1 is received */ -static void sig_handler() { - - if(pthread_equal(pthread_self(), sig_thread)) - { - printf("sig_handler: signal is handled by sig_thread\n"); - handler_called = 1; - - } - else - { - printf("sig_handler: signal is not handled by sig_thread\n"); - exit(PTS_UNRESOLVED); - } -} - -static void * th_fn(void *arg) -{ - struct sigaction act; - struct timespec abs_timeout; - int rc = 0; - - handler_called = 0; - - /* Set up signal handler for SIGUSR1 */ - - act.sa_flags = 0; - act.sa_handler = sig_handler; - /* block all the signal when hanlding SIGUSR1 */ - sigfillset(&act.sa_mask); - sigaction(SIGUSR1, &act, 0); - - gettimeofday(&before_wait, NULL); - abs_timeout.tv_sec = before_wait.tv_sec + TIMEOUT; - abs_timeout.tv_nsec = before_wait.tv_usec * 1000; - - printf("thread: attempt timed write lock, %d seconds\n", TIMEOUT); - thread_state = ENTERED_THREAD; - rc = pthread_rwlock_timedwrlock(&rwlock, &abs_timeout); - if(rc != ETIMEDOUT) - { - printf("sig_thread: pthread_rwlock_timedwrlock returns %d\n", rc); - exit(PTS_FAIL); - } - printf("thread: timer correctly expired\n"); - gettimeofday(&after_wait, NULL); - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt; - struct timeval time_diff; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&sig_thread, NULL, th_fn, NULL) != 0) - { - printf("Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* Wait for the thread to get ready for handling signal (the thread should - * be block on rwlock since main() has the write lock at this point) */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != ENTERED_THREAD && cnt++ < TIMEOUT); - - if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: fire SIGUSR1 to thread\n"); - if(pthread_kill(sig_thread, SIGUSR1) != 0) - { - printf("main: Error at pthread_kill()\n"); - exit(PTS_UNRESOLVED); - } - - /* wait at most 2*TIMEOUT seconds */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != EXITING_THREAD && cnt++ < 2*TIMEOUT); - - if(cnt >= 2*TIMEOUT) - { - /* thread blocked*/ - printf("Test FAILED: thread blocked even afer the abs_timeout expired\n"); - exit(PTS_FAIL); - } - - if(handler_called != 1) - { - printf("The handler for SIGUSR1 did not get called\n"); - exit(PTS_UNRESOLVED); - } - - /* Test that the thread block for the correct TIMOUT time */ - time_diff.tv_sec = after_wait.tv_sec - before_wait.tv_sec; - time_diff.tv_usec = after_wait.tv_usec - before_wait.tv_usec; - if (time_diff.tv_usec < 0) - { - --time_diff.tv_sec; - time_diff.tv_usec += 1000000; - } - if(time_diff.tv_sec < TIMEOUT) - { - printf("Test FAILED: Timeout was for %d seconds, but waited for %ld.%06ld seconds instead\n", - TIMEOUT, (long)time_diff.tv_sec, (long)time_diff.tv_usec); - exit(PTS_FAIL); - } - - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_unlock()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_join(sig_thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-2.c deleted file mode 100644 index 1676beb637..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-2.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * Test pthread_rwlock_timedwrlock(pthread_rwlock_t * rwlock) - * - * If a signal that causes a signal handler to be executed is delivered to - * a thread blocked on a read-write lock via a call to pthread_rwlock_timedwrlock( ), - * upon return from the signal handler the thread shall resume waiting for the lock - * as if it was not interrupted. - * - * Steps: - * 1. main thread create read-write lock 'rwlock', and lock it for writing - * 2. main thread create a thread sig_thread, the thread is set to handle SIGUSR1 - * 3. sig_thread timed lock 'rwlock' for writing, but blocked - * 4. While the sig_thread is waiting(not expried yet), main thread send SIGUSR1 - * to sig_thread via pthread_kill - * 5. test that thread handler is called, inside the handler, make the thread sleep - * for a period that the specified 'timeout' for pthread_rwlock_timedwrlock() - * should have expired (timeout * 2) - * 6. While sig_thread sleeping in signal handler, main thread unlock 'rwlock' - * 7. check that when thread handler returns, sig_thread get the read lock without - * getting ETIMEDOUT. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -#define TIMEOUT 2 - -static pthread_t sig_thread; -static pthread_rwlock_t rwlock; - -static int thread_state; -static int handler_state; -static int expired; -static struct timeval before_wait, after_wait; - -static void sig_handler() { - - struct timespec sleep_time_req; - - sleep_time_req.tv_sec = TIMEOUT*2; - sleep_time_req.tv_nsec = 0; - - if(pthread_equal(pthread_self(), sig_thread)) - { - printf("sig_handler: signal is handled by thread\n"); - /* sig_handler will not sleep 2 times more than the timeout for the - * pthread_rwlock_timerdlock is waiting for */ - printf("sig_handler: sleeping for %d seconds\n", (int)sleep_time_req.tv_sec); - handler_state = 2; - sleep((int)sleep_time_req.tv_sec); - } - else - { - printf("sig_handler: signal is not handled by thread\n"); - exit(PTS_UNRESOLVED); - } - - handler_state = 3; -} - -static void * th_fn(void *arg) -{ - struct sigaction act; - struct timespec abs_timeout; - int rc; - handler_state = 2; - expired = 0; - - /* Set up handler for SIGUSR1 */ - - act.sa_flags = 0; - act.sa_handler = sig_handler; - /* block all the signal when hanlding SIGUSR1 */ - sigfillset(&act.sa_mask); - sigaction(SIGUSR1, &act, 0); - - gettimeofday(&before_wait, NULL); - abs_timeout.tv_sec = before_wait.tv_sec + TIMEOUT; - abs_timeout.tv_nsec = before_wait.tv_usec * 1000; - - thread_state = ENTERED_THREAD; - - printf("thread: attempt timed write lock, %d seconds\n", TIMEOUT); - rc = pthread_rwlock_timedwrlock(&rwlock, &abs_timeout); - if(rc == 0) - { - printf("thread: correctly acquired write lock\n"); - expired = 0; - } - else if(rc == ETIMEDOUT) - { - printf("thread: timer expired, did not acquire write lock"); - expired = 1; - } - else - { - printf("Error %d at pthread_rwlock_timedwrlock()\n", rc); - exit(PTS_UNRESOLVED); - } - - gettimeofday(&after_wait, NULL); - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&sig_thread, NULL, th_fn, NULL) != 0) - { - printf("Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* wait for the thread to get ready for handling signal */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != ENTERED_THREAD && cnt++ < TIMEOUT); - - if(thread_state != ENTERED_THREAD) - { - printf("Error: thread did not block when getting write lock\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: fire SIGUSR1 to thread\n"); - if(pthread_kill(sig_thread, SIGUSR1) != 0) - { - printf("Error in pthread_kill()"); - exit(PTS_UNRESOLVED); - } - - /* Wait for signal handler to sleep so that main can unlock the rwlock while - * it is sleeping. (this way, the rwlock will be unlocked when the signal handler - * returns, and control is given back to the thread) */ - - cnt = 0; - do{ - sleep(TIMEOUT); - }while(handler_state !=2 && cnt++ < 2); - - if(handler_state == 1) - { - printf("Error: signal handler did not get called\n"); - exit(PTS_UNRESOLVED); - } - else if(handler_state == 3) - { - printf("Error: signal handler incorrectly exited\n"); - exit(PTS_UNRESOLVED); - } - - if(expired == 1) - { - printf("Error: thread timeout in sig_handler\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - - /* wait at most 4*TIMEOUT seconds for thread to exit */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != EXITING_THREAD && cnt++ < 4*TIMEOUT); - - - if(cnt >= 4*TIMEOUT) - { - /* thread blocked*/ - printf("Test FAILED: thread blocked even afer the abs_timeout expires\n"); - exit(PTS_FAIL); - } - - if(expired == 1) - { - printf("Test FAILED: thread should get the write lock\n"); - exit(PTS_FAIL); - } - - if(pthread_join(sig_thread, NULL) != 0) - { - printf("Error at pthread_join()"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_destroy()"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/7-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/7-1.sh deleted file mode 100755 index 1c1a1dc598..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/7-1.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_rwlock_timedwrlock() - -# Shall return zero if the lock for writing on the read-write lock object -# referenced by rwlock is acquired. Otherwise, an error number shall be returned -# to indicate the error - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/assertions.xml deleted file mode 100644 index ba66e77c2b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/assertions.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - pthread_rwlock_timedwrlock( ) function shall apply a write lock to the - read-write lock referenced by rwlock as in the pthread_rwlock_wrlock( ) function. - However, if the lock cannot be acquired without waiting for other threads to - unlock the lock, this wait shall be terminate when the specified timeout expires. - - - - The timeout shall expire when the absolute time specified by abs_timeout passes, - as measured by the clock on which timeouts are based (that is, when the - value of that clock equals or exceeds abs_timeout), or if the absolute time - specified by abs_timeout has already been passed at the time of the call. - - - - If the Timers option is supported, the timeout shall be based on the - CLOCK_REALTIME clock. - - - - If the Timers option is not supported, the timeout shall be based on the - system clock as returned by the time( ) function. The resolution of the timeout - shall be the resolution of the clock on which it is based. The timespec data type - is defined in the time.h header. - - - - Under no circumstances shall the function fail with a timeout if the lock can be - acquired immediately. The abs_timeout parameter need not be checked if the lock - can be immediately acquired. - - - - If a signal that causes a signal handler to be executed is delivered to - a thread blocked on a read-write lock via a call to pthread_rwlock_timedwrlock( ), - upon return from the signal handler the thread shall resume waiting for the lock - as if it was not interrupted. - - - - Shall return zero if the lock for writing on the read-write lock object - referenced by rwlock is acquired. Otherwise, an error number shall be returned - to indicate the error - pthread_rwlock_timedwrlock( ) function shall fail if: - [ETIMEDOUT] The lock could not be acquired before the specified timeout expired. - The function shall not return an error code of [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/coverage.txt deleted file mode 100644 index 2bcdd0952b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_timedwrlock/coverage.txt +++ /dev/null @@ -1,12 +0,0 @@ -This document defines the coverage for the pthread_rwlock_timedwrlock() function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/1-1.c deleted file mode 100644 index 348eb73aea..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/1-1.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) - * - * The pthread_rwlock_tryrdlock( ) function shall apply a read lock as in the - * pthread_rwlock_rdlock( ) - * function, with the exception that the function shall fail if the - * equivalent pthread_rwlock_rdlock( ) - * call would have blocked the calling thread. In no case shall the - * pthread_rwlock_tryrdlock( ) - * function ever block; it always either acquires the lock or fails and - * returns immediately. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main thread read lock 'rwlock' - * 3. Create a child thread, the thread read lock 'rwlock' using pthread_rwlock_tryrdlock(), should success - * 4. Main thread unlock 'rwlock' - * 5. Main thread write lock 'rwlock' - * 6. Create child thread to read lock 'rwlock' with pthread_rwlock_tryrdlock(), should not block and get EBUSY - * 7. Main thread unlock 'rwlock' - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_rwlock_t rwlock; -static int thread_state; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_rd_1(void *arg) -{ - int rc = 0; - - thread_state = ENTERED_THREAD; - printf("rd_thread1: attempt pthread_rwlock_tryrdlock\n"); - rc = pthread_rwlock_tryrdlock(&rwlock); - if(rc != 0) - { - printf("Test fail at pthread_rwlock_tryrdlock(): error code: %d\n", rc); - exit(PTS_FAIL); - } - printf("rd_thread1: acquired read lock\n"); - printf("rd_thread1: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - thread_state = EXITING_THREAD; - return NULL; -} - -static void* fn_rd_2(void *arg) -{ - int ret; - thread_state = ENTERED_THREAD; - printf("rd_thread2: attempt pthread_rwlock_tryrdlock\n"); - ret = pthread_rwlock_tryrdlock(&rwlock); - if(ret != EBUSY) - { - printf("Test FAILED: expected EBUSY, got %d\n", ret); - exit(PTS_FAIL); - } - - printf("rd_thread2: Correctly got EBUSY\n"); - thread_state = EXITING_THREAD; - return NULL; -} - -int main() -{ - int cnt = 0; - int rc = 0; - - pthread_t rd_thread1, rd_thread2; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthrad_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt pthread_rwlock_tryrdlock\n"); - /* We have no lock, this read lock should succeed */ - rc = pthread_rwlock_tryrdlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: in main() at pthread_rwlock_tryrdlock, error code:%d\n", rc); - return PTS_FAIL; - } - - printf("main: acquired read lock\n"); - - thread_state = NOT_CREATED_THREAD; - printf("main: create rd_thread1\n"); - if(pthread_create(&rd_thread1, NULL, fn_rd_1, NULL) != 0) - { - printf("main: Error at creating rd_thread1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 5 seconds, - we regard it as blocked */ - /* We did not expect the thread to block */ - - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - /* the child thread started but blocked */ - printf("Test FAILED: rd_thread1 block at pthread_rwlock_tryrdlock()\n"); - return PTS_FAIL; - } - else if(thread_state != EXITING_THREAD) - { - printf("Unexpected thread state for rd_thread1: %d\n", thread_state); - return PTS_UNRESOLVED; - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_unlock\n"); - return PTS_UNRESOLVED; - } - - if(pthread_join(rd_thread1, NULL) != 0) - { - printf("main: Error joining rd_thread1\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("main: Error getting write lock\n"); - return PTS_UNRESOLVED; - } - - printf("main: acquired write lock\n"); - - thread_state = NOT_CREATED_THREAD; - cnt = 0; - printf("main: create rd_thread2\n"); - if(pthread_create(&rd_thread2, NULL, fn_rd_2, NULL) != 0) - { - printf("main: Error at creating rd_thread2\n"); - return PTS_UNRESOLVED; - } - - /* we do not expect rd_thread2 to block */ - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: pthread_rwlock_trylock() should not block rd_thread2\n"); - return PTS_FAIL; - } - else if(thread_state != EXITING_THREAD) - { - printf("Unexpected thread state for rd_thread2\n"); - return PTS_UNRESOLVED; - } - - printf("main: unlock write lock\n"); - thread_state = NOT_CREATED_THREAD; - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error at releasing write lock\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/2-1.sh deleted file mode 100755 index 3011d18480..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/2-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_rwlock_tryrdlock() returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/3-1.sh deleted file mode 100755 index 16aea0d20e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/3-1.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - - -#The pthread_rwlock_tryrdlock( ) function shall fail if: -#[EBUSY] The read-write lock could not be acquired for reading because a writer holds -#the lock or a writer with the appropriate priority was blocked on it. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/assertions.xml deleted file mode 100644 index d9a8a9d497..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/assertions.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - The pthread_rwlock_tryrdlock( ) function shall apply a read lock as in the - pthread_rwlock_rdlock( ) function, with the exception that the function shall fail - if the equivalent pthread_rwlock_rdlock( ) call would have blocked the calling thread. - In no case shall the pthread_rwlock_tryrdlock( ) function ever block; it always either - acquires the lock or fails and returns immediately. - - - - The pthread_rwlock_tryrdlock( ) function shall return zero if the lock for reading on - the read-write lock object referenced by rwlock is acquired. Otherwise, an error number - shall be returned to indicate the error. - - - - The pthread_rwlock_tryrdlock( ) function shall fail if: - [EBUSY] The read-write lock could not be acquired for reading because a writer holds - the lock or a writer with the appropriate priority was blocked on it. - The function shall not return an error code of [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/coverage.txt deleted file mode 100644 index c04592ef0e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_tryrdlock/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_rwlock_tryrdlock() function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/1-1.c deleted file mode 100644 index faa5c7b14a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/1-1.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) - * - * The function shall apply a write lock like the pthread_rwlock_wrlock(), with the exception - * that the funciton shall fail if any thread currently holds rwlock(for reading and writing). - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main thread lock 'rwlock' for reading with pthread_rwlock_rdlock() - * 3. Create a child thread, the thread locks 'rwlock' for writing, using - * pthread_rwlock_trywrlock(), should get EBUSY - * 4. Main thread unlocks 'rwlock' - * 5. Main thread locks 'rwlock' for writing, using pthread_rwlock_trywrlock(), - * should get the lock successfully - * 6. Create child thread to lock 'rwlock' for writing, with pthread_rwlock_trywrlock(), - * should get EBUSY - * 7. Main thread unlock 'rwlock' - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_rwlock_t rwlock; -static int thread_state; -static int get_ebusy; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_wr(void *arg) -{ - thread_state = ENTERED_THREAD; - int rc; - - printf("thread: attempt pthread_rwlock_trywrlock()\n"); - rc = pthread_rwlock_trywrlock(&rwlock); - if(rc != EBUSY) - { - printf("Test FAILED: thread: Expected EBUSY, got %d\n", rc); - exit(PTS_FAIL); - } - get_ebusy = 1; - printf("thread: correctly got EBUSY\n"); - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - int rc = 0; - pthread_t thread1, thread2; - - get_ebusy = 0; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - /* We have no lock, this read lock should succeed */ - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_rdlock()\n"); - return PTS_UNRESOLVED; - } - - printf("main: acquired read lock\n"); - thread_state = NOT_CREATED_THREAD; - printf("main: create thread1\n"); - if(pthread_create(&thread1, NULL, fn_wr, NULL) != 0) - { - printf("Error creating thread1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - /* We do no expect thread1 to block */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - /* the child thread blocked */ - printf("Test FAILED: thread1 should not block on pthread_rwlock_trywrlock()\n"); - exit(PTS_FAIL); - } - else if(thread_state != EXITING_THREAD) - { - printf("Unexpected thread state for thread1: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - if(get_ebusy != 1) - { - printf("Test FAILED: thread1 should get EBUSY\n"); - exit(PTS_FAIL); - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error releasing read lock\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(thread1, NULL) != 0) - { - printf("main: Error joining thread1\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: attempt pthread_rwlock_trywrlock()\n"); - /* Should get the write lock*/ - rc = pthread_rwlock_trywrlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: main failed at pthread_rwlock_trywrlock(), error code: %d\n", rc); - return PTS_FAIL; - } - - printf("main: acquired write lock\n"); - - get_ebusy = 0; - thread_state = NOT_CREATED_THREAD; - cnt = 0; - printf("main: create thread2\n"); - if(pthread_create(&thread2, NULL, fn_wr, NULL) != 0) - { - printf("main: Error creating thread2\n"); - return PTS_UNRESOLVED; - } - - /* We do not expect thread2 to block */ - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread2 should not block on pthread_rwlock_trywrlock()\n"); - exit(PTS_FAIL); - } - else if(thread_state != EXITING_THREAD) - { - printf("Unexpected thread state: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - if(get_ebusy != 1) - { - printf("Test FAILED: thread2 should get EBUSY\n"); - exit(PTS_FAIL); - } - - printf("main: unlock write lock\n"); - thread_state = 1; - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error at 2nd pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(thread2, NULL) != 0) - { - printf("main: Error at 2cn pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/2-1.sh deleted file mode 100755 index 2097dd7bac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/2-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_rwlock_trywrlock() returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/assertions.xml deleted file mode 100644 index 7ce5530fb4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/assertions.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - pthread_rwlock_trywrlock( ) function shall apply a write lock like the - pthread_rwlock_wrlock( ) function, with the exception that the function - shall fail if any thread currently holds rwlock (for reading or writing) - - - - The pthread_rwlock_trywrlock( ) function shall return zero if the lock for writing on - the read-write lock object referenced by rwlock is acquired. Otherwise, an error number - shall be returned to indicate the error. - - - - The pthread_rwlock_trywrlock( ) function shall fail if: - - [EBUSY] The read-write lock could not be acquired for writing because a writer holds - the lock or a writer with the appropriate priority was blocked on it. - - It may fail if: - [EINVAL] rwlock does not refer to an intialized read-write lock object - - It shall not return EINTR. - - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/coverage.txt deleted file mode 100644 index c04592ef0e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_rwlock_tryrdlock() function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/speculative/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/speculative/3-1.c deleted file mode 100644 index 1762d4a872..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_trywrlock/speculative/3-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) - * - * It may fail if: - * [EINVAL] rwlock does not refer to an intialized read-write lock object - * - * Steps: - * 1. Call pthread_rwlock_trywrlock with an uninitialized rwlock object - * 2. Test for the return code. It may be EINVAL or 0. - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - - static pthread_rwlock_t rwlock; - int rc; - - /* Call without initializing rwlock */ - rc = pthread_rwlock_trywrlock(&rwlock); - - /* Clean up before checking return value */ - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlock_destroy()\n"); - return PTS_UNRESOLVED; - } - - if(rc != 0) - { - if(rc == EINVAL) - { - printf("Test PASSED\n"); - return PTS_PASS; - } else - { - printf("Test FAILED: Incorrect return code %d\n", rc); - return PTS_FAIL; - } - } - - printf("Test PASSED: Note*: Returned 0 instead of EINVAL, but standard specified _may_ fail. \n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/1-1.c deleted file mode 100644 index 53297e3cfd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/1-1.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_unlock(pthread_rwlock_t *rwlock) - * - * pthread_rwlock_unlock( ) function shall release a lock held on the - * read-write lock object referenced by rwlock - * If this function is called to release a read lock from the read-write lock object - * and there are other read locks currently held on this read-write lock object, - * the read-write lock object remains in the read locked state. - * If this function releases the last read lock for this read-write lock object, - * the read-write lock object shall be put in the unlocked state with no owners. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main thread read lock 'rwlock' - * 3. Create a child thread, the thread read lock 'rwlock', should not block - * 4. Child thread unlock 'rwlock', while the main thread still hold the read lock. - * 5. Child thread read lock 'rwlock' again, should succeed, then unlock again - * 6. Child thread write lock 'rwlock', should block - * 7. Main thread unlock the read lock, the 'rwlock' is in unlocked state - * 8. Child thread should get the lock for writing. - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_rwlock_t rwlock; -static int thread_state; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: after 1st read lock - 4: after 2nd read lock and before write lock; - 5: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define PASSED_RLOCK1 3 -#define PASSED_RLOCK2 4 -#define EXITING_THREAD 5 - -static void* fn_rd(void *arg) -{ - int rc = 0; - - thread_state = ENTERED_THREAD; - printf("thread: attempt 1st read lock\n"); - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("thread: cannot get read lock\n"); - exit(PTS_UNRESOLVED); - } - printf("thread: acquired read lock\n"); - printf("thread: unlock read lock\n"); - rc = pthread_rwlock_unlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: thread: Error at pthread_rwlock_unlock(), Error Code=%d\n", rc); - exit(PTS_FAIL); - } - - thread_state = PASSED_RLOCK1; - printf("thread: attempt 2nd read lock\n"); - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("thread: cannot get read lock\n"); - exit(PTS_UNRESOLVED); - } - printf("thread: acquired read lock\n"); - printf("thread: unlock read lock\n"); - rc = pthread_rwlock_unlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: thread: Error at 2nd pthread_rwlock_unlock(), Error Code=%d\n", rc); - exit(PTS_FAIL); - } - - thread_state = PASSED_RLOCK2; - /* The thread should block here */ - printf("thread: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("thread: cannot get write lock\n"); - exit(PTS_UNRESOLVED); - } - printf("thread: acquired write lock\n"); - printf("thread: unlock write lock\n"); - rc = pthread_rwlock_unlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: thread failed to release write lock, Error Code=%d\n", rc); - exit(PTS_FAIL); - } - thread_state = EXITING_THREAD; - return NULL; -} - -int main() -{ - int cnt = 0; - int rc = 0; - - pthread_t rd_thread; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - - /* This read lock should succeed */ - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_rdlock()\n"); - return PTS_UNRESOLVED; - } - - thread_state = NOT_CREATED_THREAD; - printf("main: create thread\n"); - if(pthread_create(&rd_thread, NULL, fn_rd, NULL) != 0) - { - printf("main: Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=PASSED_RLOCK2 && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - printf("Thread should not block on first read lock\n"); - exit(PTS_UNRESOLVED); - } - else if(thread_state == PASSED_RLOCK1) - { - /* child thread blocked on second read lock*/ - printf("thread should not block on second read lock\n"); - exit(PTS_UNRESOLVED); - } - else if(thread_state != PASSED_RLOCK2) - { - printf("Unexpected thread state: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - /* thread_state == 4, i.e. child thread blocks on write lock */ - printf("main: unlock read lock\n"); - rc = pthread_rwlock_unlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: Main cannot release read lock\n"); - exit(PTS_FAIL); - } - - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state != EXITING_THREAD) - { - printf("Test FAILED: thread did not get write lock even when the lock has no owner\n"); - exit(PTS_FAIL); - } - - if(pthread_join(rd_thread, NULL) != 0) - { - printf("Error at pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlock_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/2-1.c deleted file mode 100644 index 073690403a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/2-1.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_unlock(pthread_rwlock_t *rwlock) - * - * pthread_rwlock_unlock( ) function shall release a lock held on the - * read-write lock object referenced by rwlock - * If this function is called to release a write lock for this read-write - * lock object, the read-write lock object shall be put in the unlocked state. - * - * In the case: if a lock in an unlocked state, it can be acquired by a thread for write lock - * successfully - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main thread write lock 'rwlock' - * 3. Create a child thread, the thread write lock 'rwlock', should block - * 4. Main thread unlock the write lock, the 'rwlock' is in unlocked state - * 5. Child thread should get the lock for writing. - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_rwlock_t rwlock; -static int thread_state; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_wr(void *arg) -{ - int rc = 0; - - thread_state = ENTERED_THREAD; - printf("thread: attempt write block\n"); - /* This should block */ - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("thread: cannot get write lock\n"); - exit(PTS_UNRESOLVED); - } - printf("thread: acquired write lock\n"); - printf("thread: unlock write lock\n"); - rc = pthread_rwlock_unlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: thread failed to release write lock, Error Code=%d\n", rc); - exit(PTS_FAIL); - } - thread_state = EXITING_THREAD; - return NULL; -} - -int main() -{ - int cnt = 0; - int rc = 0; - - pthread_t wr_thread; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - /* This write lock should succeed */ - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } - - thread_state = NOT_CREATED_THREAD; - printf("main: create thread\n"); - if(pthread_create(&wr_thread, NULL, fn_wr, NULL) != 0) - { - printf("main: Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - cnt = 0; - do{ - sleep(1); - }while (thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - printf("Thread should block on write lock\n"); - exit(PTS_UNRESOLVED); - } - else if(thread_state != ENTERED_THREAD) - { - printf("Unexpected thread state: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - /* thread_state == ENTERED_THREAD, i.e. thread correctly blocks on write lock */ - printf("main: unlock write lock\n"); - rc = pthread_rwlock_unlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: Main cannot release write lock\n"); - exit(PTS_FAIL); - } - - cnt = 0; - do{ - sleep(1); - }while (thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state != EXITING_THREAD) - { - printf("Test FAILED: thread did not get write lock even when the lock has no owner\n"); - exit(PTS_FAIL); - } - - if(pthread_join(wr_thread, NULL) != 0) - { - printf("Error at pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlock_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/3-1.c deleted file mode 100644 index b9c4829eac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/3-1.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * If there are threads blocked on the lock when it becomes available, - * the scheduling policy shall determine which thread(s) shall acquire the lock. - * If the Thread Execution Scheduling option is supported, when threads executing - * with the scheduling policies SCHED_FIFO, SCHED_RR, or SCHED_SPORADIC are waiting - * on the lock, they shall acquire the lock in priority order when the lock - * becomes available. For equal priority threads, write locks shall take precedence - * over read locks. - * - Steps: - * We have four threads, main(also a reader), writer1, reader, writer2 - * main has the highest priority, writer1 and reader has same priority, writer2 has lowest - * priority. - * - * 1. Main thread set its shcedule policy as "SCHED_FIFO", with highest priority - * the three: sched_get_priority_min()+3. - * 2. Main thread write lock 'rwlock' - * 3. Create a writer1 thread, with schedule policy as "SCHED_FIFO", and priority - * using sched_get_priority_min()+2. The writer should block. - * 4. Create reader thread, with same priority as writer1. The reader should also block. - * 5. Create a writer2 thread, with priority sched_get_priority_min(). It should block - * on write lock too. - * 7. Main thread release the 'rwlock', make sure the threads got the lock in the order - * writer1, reader, writer2. - * - */ - -/* NOTE: The test result is UNSUPPORTED if Thread Execution Scheduling option - * is not supported. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TRD_POLICY SCHED_FIFO - -static pthread_rwlock_t rwlock; -static int rd_thread_state; -static int wr_thread_state_1, wr_thread_state_2; - -/* thread_state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: after locking - 4: thread is exiting -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define PASSED_LOCK 3 -#define EXITING_THREAD 4 - -static int set_priority(pthread_t pid, unsigned policy, unsigned prio) -{ - struct sched_param sched_param; - memset(&sched_param, 0, sizeof(sched_param)); - sched_param.sched_priority = prio; - if (pthread_setschedparam(pid, policy, &sched_param) == -1) - { - printf("Can't set policy to %d and prio to %d\n", - policy, prio); - exit(PTS_UNRESOLVED); - } - return 0; -} - -static void* fn_rd(void *arg) -{ - int rc = 0; - int priority; - rd_thread_state = ENTERED_THREAD; - - priority = (long)arg; - set_priority(pthread_self(), TRD_POLICY, priority); - - printf("reader: attempt read lock\n"); - rc = pthread_rwlock_rdlock(&rwlock); - if(rc != 0) - { - printf("Error: rd_thread failed to get read lock, Error code:%d\n" - , rc); - exit(PTS_UNRESOLVED); - } - - rd_thread_state = PASSED_LOCK; - printf("reader: acquired read lock\n"); - - /* Wait for main to wake us up */ - do{ - sleep(1); - }while(rd_thread_state != EXITING_THREAD); - - printf("reader: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("rd_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - pthread_exit(0); - return NULL; -} - -static void* fn_wr_1(void *arg) -{ - int rc = 0; - int priority; - wr_thread_state_1 = ENTERED_THREAD; - - priority = (int)(long)arg; - set_priority(pthread_self(), TRD_POLICY, priority); - - printf("writer1: attempt write lock\n"); - rc = pthread_rwlock_wrlock(&rwlock); - if(rc != 0) - { - printf("Error: wr_thread failed to get write lock, Error code:%d\n" - , rc); - exit(PTS_UNRESOLVED); - } - - wr_thread_state_1 = PASSED_LOCK; - printf("writer1: acquired write lock\n"); - - /* Wait for main to wake us up */ - - do{ - sleep(1); - }while(wr_thread_state_1 != EXITING_THREAD); - - printf("writer1: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("wr_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - - pthread_exit(0); - return NULL; -} - -static void* fn_wr_2(void *arg) -{ - int rc = 0; - int priority; - wr_thread_state_2 = ENTERED_THREAD; - - priority = (long)arg; - set_priority(pthread_self(), TRD_POLICY, priority); - - printf("writer2: attempt write lock\n"); - rc = pthread_rwlock_wrlock(&rwlock); - if(rc != 0) - { - printf("Error: wr_thread failed to get write lock, Error code:%d\n" - , rc); - exit(PTS_UNRESOLVED); - } - - wr_thread_state_2 = PASSED_LOCK; - printf("writer2: acquired writer lock\n"); - - /* Wait for main to wake us up */ - do{ - sleep(1); - }while(wr_thread_state_2 != EXITING_THREAD); - - printf("writer2: unlock writer lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("wr_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - - pthread_exit(0); - return NULL; -} - -int main() -{ - #ifndef _POSIX_THREAD_PRIORITY_SCHEDULING - printf("Posix Thread Execution Scheduling not supported\n"); - return PTS_UNSUPPORTED; - #endif - - int cnt = 0; - pthread_t writer1, reader, writer2; - int priority; - - /* main thread needs to have the highest priority*/ - priority = sched_get_priority_min(TRD_POLICY) + 3; - set_priority(pthread_self(), TRD_POLICY, priority); - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: write lock\n"); - /* We have no lock, this read lock should succeed */ - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("Error: main cannot get write lock when no one owns the lock\n"); - return PTS_UNRESOLVED; - } - - /* Now create 3 threads that block on this rwlock */ - - wr_thread_state_1 = NOT_CREATED_THREAD; - priority = sched_get_priority_min(TRD_POLICY) + 2; - printf("main: create writer1, with priority: %d\n", priority); - if(pthread_create(&writer1, NULL, fn_wr_1, (void*)(long)priority) != 0) - { - printf("main: Error creating writer1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 2 seconds, - we regard it as blocked */ - - /* We expect the writer1 to block */ - cnt = 0; - do{ - sleep(1); - }while (wr_thread_state_1 != 3 && cnt++ < 3); - - if(wr_thread_state_1 == 3 ) - { - printf("writer1 did not block on write lock, when main owns the lock\n"); - exit(PTS_UNRESOLVED); - } - else if(wr_thread_state_1 != 2) - { - printf("Unexpected writer1 state\n"); - exit(PTS_UNRESOLVED); - } - - /* Reader thread same priority as Writer1 thread */ - - rd_thread_state = 1; - priority = sched_get_priority_min(TRD_POLICY)+2; - printf("main: create reader, with priority: %d\n", priority); - if(pthread_create(&reader, NULL, fn_rd, (void*)(long)priority) != 0) - { - printf("main: failed at creating reader\n"); - return PTS_UNRESOLVED; - } - - /* We expect the reader to block*/ - cnt = 0; - do{ - sleep(1); - }while (rd_thread_state != 3 && cnt++ < 2); - - if(rd_thread_state == 3 ) - { - printf("Test Fail: reader did not block on read lock\n"); - exit(PTS_FAIL); - } - else if(rd_thread_state != 2) - { - printf("Unexpected reader state\n"); - exit(PTS_UNRESOLVED); - } - - /* Writer2 is the lowest priority thread */ - - wr_thread_state_2 = 1; - priority = sched_get_priority_min(TRD_POLICY); - printf("main: create writer2, with priority: %d\n", priority); - if(pthread_create(&writer2, NULL, fn_wr_2, (void*)(long)priority) != 0) - { - printf("main: Error creating writer2\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - - /* We expect the writer2 to block */ - cnt = 0; - do{ - sleep(1); - }while (wr_thread_state_2 != 3 && cnt++ < 2); - - if(wr_thread_state_2 == 3) - { - printf("writer2 did not block on write lock, when main owns the lock\n"); - exit(PTS_UNRESOLVED); - } - else if(wr_thread_state_2 != 2) - { - printf("Unexpected writer1 state\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: release write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: failed to release write lock\n"); - exit(PTS_UNRESOLVED); - } - - /* we expect writer1 get the lock */ - cnt = 0; - do{ - sleep(1); - }while (wr_thread_state_1 != 3 && cnt++ < 3); - - if(wr_thread_state_1 == 2 ) - { - printf("Test fail: writer did not get write lock, when main release the lock\n"); - exit(PTS_FAIL); - } - else if(wr_thread_state_1 != 3) - { - printf("Unexpected writer1 state\n"); - exit(PTS_UNRESOLVED); - } - - /* Let writer1 release the lock*/ - wr_thread_state_1 = 4; - - if(pthread_join(writer1, NULL) != 0) - { - printf("main: Error joining writer1\n"); - exit(PTS_UNRESOLVED); - } - - /* we expect the reader get the lock when writer1 has release the lock*/ - cnt = 0; - do{ - sleep(1); - }while (rd_thread_state !=3 && cnt++ < 3); - - if(rd_thread_state == 2 ) - { - printf("Test failed: reader did not get the lock when writer1 release the lock\n"); - exit(PTS_FAIL); - } - else if(rd_thread_state != 3) - { - printf("Unexpected reader state\n"); - exit(PTS_UNRESOLVED); - } - - /* Inform reader release the lock */ - rd_thread_state = 4; - - if(pthread_join(reader, NULL) != 0) - { - printf("main: Error joining reader\n"); - exit(PTS_UNRESOLVED); - } - - /* we expect writer2 get the lock */ - cnt = 0; - do{ - sleep(1); - }while (wr_thread_state_2 !=3 && cnt++ < 3); - - if(wr_thread_state_2 == 2 ) - { - printf("Test fail: writer2 still blocked on write lock, when main release the lock\n"); - exit(PTS_FAIL); - } - else if(wr_thread_state_2 != 3) - { - printf("Unexpected writer2 state\n"); - exit(PTS_UNRESOLVED); - } - - wr_thread_state_2 = 4; - - if(pthread_join(writer2, NULL) != 0) - { - printf("main: Error joining writer1\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/4-1.c deleted file mode 100644 index 0f75306555..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/4-1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_unlock(pthread_rwlock_t *rwlock) - * - * It 'may' fail if: - * [EINVAL] rwlock doesn't refer to an intialized read-write lock - * [EPERM] the current thread doesn't hold the lock on the rwlock - * - * Testing EINVAL in this test. - * - * Steps: - * 1. Call pthread_rwlock_unlock with an uninitialized rwlock - * 2. The test will pass even if it returns 0, but with a note stating that the standard - * states it 'may' fail. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - static pthread_rwlock_t rwlock; - int rc; - - rc = pthread_rwlock_unlock(&rwlock); - if(rc != 0) - { - if(rc == EINVAL) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED: Incorrect error code, expected 0 or EINVAL, got %d\n", rc); - return PTS_FAIL; - } - - printf("Test PASSED: Note*: Returned 0 instead of EINVAL, but standard specified _may_ fail.\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/4-2.c deleted file mode 100644 index 8e5bd3f97f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/4-2.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlock_unlock(pthread_rwlock_t *rwlock) - * - * It 'may' fail if: - * [EINVAL] rwlock doesn't refer to an intialized read-write lock - * [EPERM] the current thread doesn't hold the lock on the rwlock - * - * Testing EPERM in this test. - * - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main thread read lock 'rwlock' - * 3. Create a child thread, the thread should try to unlock the 'rwlock' - * 4. The test will pass even if it returns 0, but with a note stating that the standard - * states it 'may' fail. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_rwlock_t rwlock; -static int rc, thread_state; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_unlk(void *arg) -{ - thread_state = ENTERED_THREAD; - printf("un_thread: unlock read lock\n"); - rc = pthread_rwlock_unlock(&rwlock); - thread_state = EXITING_THREAD; - return NULL; -} - -int main() -{ - int cnt = 0; - int rc = 0; - - pthread_t un_thread; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("main: Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("main: Error at pthread_rwlock_rdlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired read lock\n"); - - thread_state = NOT_CREATED_THREAD; - - printf("main: create un_thread\n"); - if(pthread_create(&un_thread, NULL, fn_unlk, NULL) != 0) - { - printf("main: Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* Wait for child to exit */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state != EXITING_THREAD) - { - printf("Unexpected thread state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(un_thread, NULL) != 0) - { - printf("Error at pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - /* Cleaning up */ - pthread_rwlock_unlock(&rwlock); - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("error at pthread_rwlock_destroy()\n"); - return PTS_UNRESOLVED; - } - - /* Test the return code of un_thread when it attempt to unlock the rwlock it didn't - * own in the first place. */ - - if(rc != 0) - { - if(rc == EPERM) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED: Incorrect error code, expected 0 or EPERM, got %d\n", rc); - return PTS_FAIL; - } - - printf("Test PASSED: Note*: Returned 0 instead of EPERM, but standard specified _may_ fail.\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/assertions.xml deleted file mode 100644 index cf176ce41d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/assertions.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - pthread_rwlock_unlock( ) function shall release a lock held on the - read-write lock objectreferenced by rwlock - If this function is called to release a read lock from the read-write lock object - and there are other read locks currently held on this read-write lock object, - the read-write lock object remains in the read locked state. - If this function releases the last read lock for this read-write lock object, - the read-write lock object shall be put in the unlocked state with no owners. - - - - If this function is called to release a write lock for this read-write - lock object, the read-write lock object shall be put in the unlocked state. - - - - If there are threads blocked on the lock when it becomes available, - the scheduling policy shall determine which thread(s) shall acquire the lock. - If the Thread Execution Scheduling option is supported, when threads executing - with the scheduling policies SCHED_FIFO, SCHED_RR, or SCHED_SPORADIC are waiting - on the lock, they shall acquire the lock in priority order when the lock - becomes available. For equal priority threads, write locks shall take precedence - over read locks. - - - - If successful, the pthread_rwlock_unlock( ) function shall return zero; - otherwise, an error number shall be returned to indicate the error. - - [EINVAL] rwlock doesn't refer to an intialized read-write lock - [EPERM] the current thread doesn't hold the lock on the rwlock - - The pthread_rwlock_unlock( ) function shall not return an error code of [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/coverage.txt deleted file mode 100644 index 87bb335191..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_unlock/coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -This document defines the coverage for the pthread_rwlock_unlock() function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/1-1.c deleted file mode 100644 index 31942988a7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/1-1.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) - * - * The function shall apply a write lock to the read-write lock referenced by - * 'rwlock'. The calling thread acquires the write lock if no other thread - * (reader or writer) holds the read-write lock 'rwlock'. Otherwise, the thread - * shall block until it can acquire the lock. - * - * Steps: - * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() - * 2. Main thread lock 'rwlock' for reading with pthread_rwlock_rdlock() - * 3. Create a child thread, the thread lock 'rwlock' for writing, shall block - * 4. Main thread unlock 'rwlock', child thread should get the write lock - * 5. Main thread lock 'rwlock' for writing - * 6. Create child thread to lock 'rwlock' for writing, should block - * 7. Main thread unlock 'rwlock' - * 8. Child got the lock - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_rwlock_t rwlock; -static int thread_state; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_wr(void *arg) -{ - - thread_state = ENTERED_THREAD; - int rc; - - printf("thread: attempt write lock\n"); - rc = pthread_rwlock_wrlock(&rwlock); - if(rc == 0) - { - printf("thread: acquired write lock\n"); - printf("thread: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("thread1: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - } - else - { - printf("Test FAILED: Error in pthread_rwlock_wrlock(), error code: %d\n", rc); - exit(PTS_FAIL); - } - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - pthread_t thread1, thread2; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt read lock\n"); - /* We have no lock, this read lock should succeed */ - if(pthread_rwlock_rdlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_rdlock()\n"); - return PTS_UNRESOLVED; - } - - printf("main: acquired read lock\n"); - thread_state = NOT_CREATED_THREAD; - printf("main: create thread1\n"); - if(pthread_create(&thread1, NULL, fn_wr, NULL) != 0) - { - printf("Error creating thread1\n"); - return PTS_UNRESOLVED; - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - /* the child thread did not block */ - printf("Test FAILED: The thread1 did not block\n"); - exit(PTS_FAIL); - } - else if(thread_state != ENTERED_THREAD) - { - /* for some reason the child thread did not start*/ - printf("Child thread in unexpected state\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock read lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Error releasing read lock\n"); - exit(PTS_UNRESOLVED); - } - - /* If the shared data is not altered by child after 3 seconds, - we regard it as blocked */ - /* thread1 should get the write lock */ - cnt = 0; - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - /* the child thread should get the lock */ - printf("Test FAILEd: thread1 did not get the write lock\n"); - exit(PTS_FAIL); - } - else if(thread_state != EXITING_THREAD) - { - /* for some reason the child does not start*/ - printf("Child thread1 in unexpected state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(thread1, NULL) != 0) - { - printf("Error joining thread1\n"); - exit(PTS_UNRESOLVED); - } - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("Test FAILED: main: Error geting write lock\n"); - return PTS_FAIL; - } - - printf("main: acquired write lock\n"); - - - thread_state = NOT_CREATED_THREAD; - cnt = 0; - printf("main: create thread2\n"); - if(pthread_create(&thread2, NULL, fn_wr, NULL) != 0) - { - printf("main: Error creating thread2\n"); - return PTS_UNRESOLVED; - } - - /* Thread2 should block */ - do{ - sleep(1); - }while (thread_state !=EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - printf("Test FAILED: thread2 should have block\n"); - exit(PTS_FAIL); - } - else if(thread_state != ENTERED_THREAD) - { - printf("thread2 in unexpected state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - printf("main: unlock write lock\n"); - - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error at releasing write lock\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_join(thread2, NULL) != 0) - { - printf("main: Error joining thread2\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/2-1.c deleted file mode 100644 index 98f5ba1786..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/2-1.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * Test pthread_rwlock_wrlock(pthread_rwlock_t * rwlock) - * - * If a signal is delivered to a thread waiting for a read-write lock for writing, upon - * return from the signal handler the thread resumes waiting for the read-write lock for - * writing as if it was not interrupted. - * - * Steps: - * 1. main thread create read-write lock 'rwlock', and lock it for writing - * 2. main thread create a thread sig_thread, the thread is set to handle SIGUSR1 - * 3. sig_thread try to lock 'rwlock' for writing but blocked - * 4. main thread send SIGUSR1 to sig_thread via pthread_kill, while sig_thread is blocking - * 5. test that thread handler is called - * 6. check that when thread handler returns, sig_thread resume block - * 7. main thread unlock 'rwlock', sig_thread should get the lock - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_t sig_thread; -static pthread_rwlock_t rwlock; - -/* thread_state indicates child thread state: - 1: not in child thread yet; - 2: just enter child thread ; - 3: just before child thread exit; -*/ - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static int thread_state; -static int handler_called; - -static void sig_handler() { - if(pthread_equal(pthread_self(), sig_thread)) - { - printf("sig_handler: handled signal SIGUSR1\n"); - handler_called = 1; - } - else - { - printf("signal was not handled by sig_thread\n"); - exit(PTS_UNRESOLVED); - } -} - -static void * th_fn(void *arg) -{ - struct sigaction act; - int rc = 0; - - /* Set up signal handler for SIGUSR1 */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - /* block all the signal while handling SIGUSR1 */ - sigfillset(&act.sa_mask); - sigaction(SIGUSR1, &act, NULL); - - thread_state = ENTERED_THREAD; - printf("sig_thread: attempt write lock\n"); - rc = pthread_rwlock_wrlock(&rwlock); - if(rc != 0) - { - printf("Test FAILED: sig_thread: Error at pthread_rwlock_wrlock(), error code:%d\n", rc); - exit(PTS_FAIL); - } - - printf("sig_thread: acquired write lock\n"); - printf("sig_thread: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("sig_thread: Error at pthread_rwlock_unlock()\n"); - exit(PTS_UNRESOLVED); - } - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt; - int rc = 0; - handler_called=0; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt write lock\n"); - rc = pthread_rwlock_wrlock(&rwlock); - if(rc != 0) - { - printf("main: Error at pthread_rwlock_wrlock(), error code:%d\n", rc); - return PTS_UNRESOLVED; - } - - thread_state = NOT_CREATED_THREAD; - if(pthread_create(&sig_thread, NULL, th_fn, NULL) != 0) - { - printf("Error at pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* wait at most 3 seconds for sig_thread to block*/ - cnt = 0; - do{ - sleep(1); - }while(thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - /* the sig_thread is not blocking*/ - printf("Test FAILED: the thread should block when getting write lock\n"); - exit(PTS_FAIL); - } - else if(thread_state != ENTERED_THREAD) - { - printf("sig_thread in unexpected state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } - - /* sig_thread is blocking */ - printf("main: fire SIGUSR1 to sig_thread\n"); - if(pthread_kill(sig_thread, SIGUSR1) != 0) - { - printf("Error at pthread_kill()\n"); - exit(PTS_UNRESOLVED); - } - - /* wait at most 3 seconds for the singal to be handled */ - cnt = 0; - do{ - sleep(1); - }while(handler_called == 0 && cnt++ < 3); - - if(handler_called != 1) - { - printf("The signal handler did not get called.\n"); - exit(PTS_UNRESOLVED); - } - - /* sig_thread resume to block? */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == 3) - { - printf("Test FAILED: upon return from signal handler, sig_thread does not resume to wait\n"); - exit(PTS_FAIL); - } - - printf("sig_thread: correctly still blocking after signal handler returns\n"); - printf("main: unlock write lock\n"); - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("main: Error releasing write lock\n"); - exit(PTS_UNRESOLVED); - } - - /* sig_thread should get write lock */ - cnt = 0; - do{ - sleep(1); - }while(thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state != EXITING_THREAD) - { - /* sig_thread does not unblock */ - printf("Test FAILED: sig_thread should get the write lock and exit\n"); - exit(PTS_FAIL); - } - - if(pthread_join(sig_thread, NULL) != 0) - { - printf("Error at pthread_join()\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("pthread_rwlock_destroy()\n"); - exit(PTS_UNRESOLVED); - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/3-1.c deleted file mode 100644 index cb7b4a6de8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/3-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) - * - * It may fail if: - * [EDEADLK] The current thread already owns the rwlock for writing or reading. - * - * Steps: - * 1. Create and initialize an rwlock - * 2. Perform a write lock via pthread_rwlock_wrlock() - * 3. Perform a write lock _again_ with pthread_rwlock_wrlock without first unlocking rwlock() - * 4. Test if returns EDEADLK or not. Note the standard states "may" fail, so the test always - * passes even if 0 is returned. - * - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - static pthread_rwlock_t rwlock; - int rc; - - if(pthread_rwlock_init(&rwlock, NULL) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - /* Attempt to write lock rwlock, it should return successfully */ - - printf("main: attempt write lock\n"); - if(pthread_rwlock_wrlock(&rwlock) != 0) - { - printf("Error at pthread_rwlock_wrlock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired write lock\n"); - - /* Now attempt to write lock again without first unlocking rwlock. It may return - * EDEADLK, but it may also return successfully. */ - - printf("main: attempt write lock\n"); - rc = pthread_rwlock_wrlock(&rwlock); - - /* Clean up before we test the return value of pthread_rwlock_wrlock() */ - if(pthread_rwlock_unlock(&rwlock) != 0) - { - printf("Error releasing write lock\n"); - exit(PTS_UNRESOLVED); - } - - if(pthread_rwlock_destroy(&rwlock) != 0) - { - printf("Error at pthread_rwlock_destroy()\n"); - return PTS_UNRESOLVED; - } - - if(rc != 0) - { - if(rc == EDEADLK) - { - printf("main: correctly got EDEADLK\n"); - printf("Test PASSED\n"); - return PTS_PASS; - } else - { - printf("Test FAILED: Incorrect return code %d\n", rc); - return PTS_FAIL; - } - } - - printf("main: acquired write lock\n"); - printf("main: unlock write lock\n"); - - printf("Test PASSED: Note*: Returned 0 instead of EDEADLK, but standard specified _may_ fail.\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/assertions.xml deleted file mode 100644 index 018aa7fb3b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/assertions.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - pthread_rwlock_wrlock( ) function shall apply a write lock to the read-write - lock referenced by rwlock. The calling thread acquires the write lock - if no other thread (reader or writer) holds the read-write lock rwlock. - Otherwise, the thread shall block until it can acquire the lock - - - - If a signal is delivered to a thread waiting for a read-write lock for writing, - upon return from the signal handler the thread resumes waiting for the - read-write lock for writing as if it was not interrupted. - - - - If successful, the pthread_rwlock_wrlock( ) function shall return zero; - otherwise, an error number shall be returned to indicate the error. - It may fail if: - - [EDEADLK] The current thread already owns the rwlock for writing or reading. - - Shall not return an error code of [EINTR]. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/coverage.txt deleted file mode 100644 index 2eb873967e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlock_wrlock/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_rwlock_wrlock() function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/1-1.c deleted file mode 100644 index 0063ad2a21..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/1-1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlockattr_destroy() - * shall destroy a read write attributes object. - * - * Steps: - * 1. Initialize a pthread_rwlockattr_t object using pthread_rwlockattr_init() - * 2. Destroy the attributes object using pthread_rwlockattr_destroy() - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_rwlockattr_t rwla; - - int rc; - - /* Initialize a rwlock attributes object */ - rc = pthread_rwlockattr_init(&rwla); - if(rc != 0) - { - printf("Error at pthread_rwlockattr_init(), error code: %d\n", rc); - return PTS_UNRESOLVED; - } - - /* Destroy the rwlock attributes object */ - rc = pthread_rwlockattr_destroy(&rwla); - if(rc != 0) - { - printf("Error at pthread_rwlockattr_destroy(), error code: %d\n", rc); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/2-1.c deleted file mode 100644 index e546ce0e7a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/2-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_rwlockattr_destroy() - * A destroyed 'attr' attributes object can be reinitialized using - * pthread_rwlockattr_init() - * - * Steps: - * 1. Initialize a pthread_rwlockattr_t object using pthread_rwlockattr_init() - * 2. Destroy that initialized attribute using pthread_rwlockattr_destroy() - * 3. Initialize the pthread_rwlockattr_t object again. This should not result - * in any error. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_rwlockattr_t rwla; - int rc = 0; - - /* Initialize a rwlock attributes object */ - rc = pthread_rwlockattr_init(&rwla); - if(rc != 0) - { - printf("Cannot initialize rwlock attributes object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy the rwlock attributes object */ - rc = pthread_rwlockattr_destroy(&rwla); - if(rc != 0) - { - printf("Cannot destroy the rwlock attributes object, error code: %d\n", rc); - return PTS_UNRESOLVED; - } - - /* Initialize the rwlock attributes object again. This shouldn't result in an error. */ - rc = pthread_rwlockattr_init(&rwla); - - if(rc != 0) - { - printf("Test FAILED, with error: %d\n", rc); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/3-1.sh deleted file mode 100755 index 0fc7f782fa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/3-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_rwlockattr_destroy returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/assertions.xml deleted file mode 100644 index 86d739d932..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/assertions.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - The function - int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr) - destroys a read write attributes objects. - - - A destroyed 'attr' attributes object can be reinitialized using - pthread_rwlockattr_init(); - - - If success, it returns 0. - - - An error number may be returned if: - [EINVAL] The value specified by 'attr' is invalid - This function shall not return an error ecode of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/coverage.txt deleted file mode 100644 index 41c3bedbdb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_destroy/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_destroy function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/1-1.c deleted file mode 100644 index f951b65eeb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/1-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlockattr_getpshared() - * - * It shall obtain the value of the process-shared attribute from 'attr'. - * - * Steps: - * 1. Initialize a pthread_rwlockattr_t object with pthread_rwlockattr_init() - * 2. Call pthread_rwlockattr_getpshared() to check if the process-shared - * attribute is set as the default value PTHREAD_PROCESS_PRIVATE. - * - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_rwlockattr_t rwla; - int pshared; - int rc = 0; - - #ifndef PTHREAD_PROCESS_SHARED - printf("process-shared attribute is not available for testing\n"); - return PTS_UNSUPPORTED; - #endif - - /* Initialize a rwlock attributes object */ - if(pthread_rwlockattr_init(&rwla) != 0) - { - printf("Error at pthread_rwlockattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* The default 'pshared' attribute should be PTHREAD_PROCESS_PRIVATE */ - rc = pthread_rwlockattr_getpshared(&rwla, &pshared); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_rwlockattr_getpshared(): %d\n", rc); - return PTS_FAIL; - } - - if(pshared != PTHREAD_PROCESS_PRIVATE) - { - printf("Test FAILED: Incorrect default pshared value: %d\n", pshared); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/2-1.c deleted file mode 100644 index e376ab0b0c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/2-1.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * The process-shared attribute shall be set to PTHREAD_PROCESS_SHARED - * to permit a read-write lock to be operated upon by any thread - * that has access to the memory where the read-write lock is allocated, - * even if the read-write lock is allocated in memory that is shared by - * multiple processes. - * - * steps: - * 1. Create a piece of shared memory object, create a read write lock 'rwlock' and - * set the PTHREAD_PROCESS_SHARED attribute. - * 2. Parent map the shared memory to its memory space, put 'rwlock' into it; - * 3. Parent get read lock; - * 4. Fork to create child, parent wait until child call pthread_rwlock_wrlock() - * 5. Child map the shared memory to its memory space; - * 6. Child call pthread_rwlock_trywrlock(), should fail with EBUSY; - * 7. Child call pthread_rwlock_wrlock(), should block; - * 8. Parent unlock 'rwlock' - * 9. Child should get the write lock. - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -struct shmstruct{ - pthread_rwlock_t rwl; - int data; -} *rwlock_data; - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNSUPPORTED; - #endif - - pthread_rwlockattr_t rwla; - int pshared = PTHREAD_PROCESS_SHARED; - - char shm_name[] = "tmp_pthread_rwlock_getpshared"; - int shm_fd; - int pid; - - /* Initialize a rwlock attributes object */ - if(pthread_rwlockattr_init(&rwla) != 0) - { - printf("Error at pthread_rwlockattr_init()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlockattr_setpshared(&rwla, pshared) != 0) - { - printf("Error at pthread_rwlockattr_setpshared()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_rwlockattr_getpshared(&rwla, &pshared) != 0) - { - printf("Test FAILED: Error at pthread_rwlockattr_getpshared()\n"); - return PTS_FAIL; - } - - if(pshared != PTHREAD_PROCESS_SHARED) - { - printf("Test FAILED: Got error shared attribute value %d\n", pshared); - return PTS_FAIL; - } - - /* Create shared object */ - shm_unlink(shm_name); - shm_fd = shm_open(shm_name, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - perror("Error at shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(shm_fd, sizeof(struct shmstruct)) != 0) { - perror("Error at ftruncate()"); - shm_unlink(shm_name); - return PTS_UNRESOLVED; - } - - /* Map the shared memory object to my memory */ - rwlock_data = mmap(NULL, sizeof(struct shmstruct), PROT_READ|PROT_WRITE, - MAP_SHARED, shm_fd, 0); - - if(rwlock_data == MAP_FAILED) - { - perror("Error at first mmap()"); - shm_unlink(shm_name); - return PTS_UNRESOLVED; - } - - if((pthread_rwlock_init(&(rwlock_data->rwl), &rwla)) != 0) - { - printf("Error at pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - if((pthread_rwlockattr_destroy(&rwla)) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Parent getting read lock.\n"); - if((pthread_rwlock_rdlock(&(rwlock_data->rwl))) != 0) - { - printf("Error at pthread_rwlock_rdlock()\n"); - return PTS_UNRESOLVED; - } - printf("Parent got read lock.\n"); - rwlock_data->data = 0; - - pid = fork(); - if(pid == -1) - { - perror("Error at fork()"); - return PTS_UNRESOLVED; - } - else if(pid > 0) - { - /* Parent */ - /* wait until child do wrlock */ - while(rwlock_data->data == 0) - { - sleep(1); - } - - printf("Parent unlocking.\n"); - if(pthread_rwlock_unlock(&(rwlock_data->rwl)) != 0) - { - printf("Parent: error at pthread_rwlock_unlock()\n"); - return PTS_FAIL; - } - printf("Parent unlocked.\n"); - - /* Wait for child to end */ - wait(NULL); - - if((shm_unlink(shm_name)) != 0) - { - perror("Error at shm_unlink()"); - return PTS_UNRESOLVED; - } - - if(rwlock_data->data == -1) - { - printf("Test FAILED: child did not block on write lock\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - /* Child */ - /* Map the shared object to child's memory */ - rwlock_data = mmap(NULL, sizeof(struct shmstruct), PROT_READ|PROT_WRITE, - MAP_SHARED, shm_fd, 0); - - if(rwlock_data == MAP_FAILED) - { - perror("Error at first mmap()"); - return PTS_UNRESOLVED; - } - - printf("Child tries to get write lock, should get EBUSY.\n"); - if((pthread_rwlock_trywrlock(&(rwlock_data->rwl))) != EBUSY) - { - printf("Test FAILED: Child expects EBUSY\n"); - return PTS_FAIL; - } - printf("Child got EBUSY.\n"); - - printf("Child do wrlock.\n"); - - /* Tell parent it can unlock now */ - rwlock_data->data = 1; - - /* Should block until parent unlock */ - if((pthread_rwlock_wrlock(&(rwlock_data->rwl))) != 0) - { - printf("Child:pthread_rwlock_wrlock() error\n"); - printf("Test FAILED: Error while write lock the shared rwlock\n"); - rwlock_data->data = -1; - return PTS_FAIL; - } - printf("Child got wrlock.\n"); - if((pthread_rwlock_unlock(&(rwlock_data->rwl))) != 0) - { - printf("Child:pthread_rwlock_unlock() error\n"); - printf("Error while write unlock the shared rwlock\n"); - rwlock_data->data = -1; - return PTS_FAIL; - } - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/4-1.c deleted file mode 100644 index 3c0dc1e45f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/4-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlockattr_getpshared() - * - * It shall obtain the value of the process-shared attribute from 'attr'. - * The default value of the process-shared attribute shall be PTHREAD_PROCESS_PRIVATE. - * - * Steps: - * 1. Initialize a pthread_rwlockattr_t object with pthread_rwlockattr_init() - * 2. Call pthread_rwlockattr_getpshared() to check if the process-shared - * attribute is set as the default value PTHREAD_PROCESS_PRIVATE. - * - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_rwlockattr_t rwla; - int pshared; - - #ifndef PTHREAD_PROCESS_SHARED - printf("process-shared attribute is not available for testing\n"); - return PTS_UNSUPPORTED; - #endif - - /* Initialize a rwlock attributes object */ - if(pthread_rwlockattr_init(&rwla) != 0) - { - printf("Error at pthread_rwlockattr_init()\n"); - return PTS_UNRESOLVED; - } - - /* The default 'pshared' attribute should be PTHREAD_PROCESS_PRIVATE */ - if(pthread_rwlockattr_getpshared(&rwla, &pshared) != 0) - { - printf("Error at pthread_rwlockattr_getpshared()\n"); - return PTS_UNRESOLVED; - } - - if(pshared != PTHREAD_PROCESS_PRIVATE) - { - printf("Test FAILED: Incorrect default pshared value: %d\n", pshared); - return PTS_FAIL; - } - - /* Cleanup */ - if((pthread_rwlockattr_destroy(&rwla)) != 0) - { - printf("Error at pthread_rwlockattr_destroy()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/5-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/5-1.sh deleted file mode 100755 index bef3abb833..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/5-1.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test pthread_rwlockattr_getpshared() fails and an error number is returned if: -# -# Upon success, it returns 0, and stores the value of the process-shared attribute of 'attr' -# into 'pshared'. -# - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/assertions.xml deleted file mode 100644 index ceda552a6d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/assertions.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - The function - - int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict attr, - int *restrict pshared); - - It shall obtain the value of the process-shared attribute from 'attr'. - - - - The process-shared attribute shall be set to PTHREAD_PROCESS_SHARED - to permit a read-write lock to be operated upon by any thread - that has access to the memory where the read-write lock is allocated, - even if the read-write lock is allocated in memory that is shared by - multiple processes. - - - - If the process-shared attribute is PTHREAD_PROCESS_PRIVATE, - the read-write lock shall only be operated upon by threads created - within the same process as the thread that initialized the read-write lock; - if threads of different processes attempt to operate on such a read-write lock, - the behavior is undefined. - - - The default value of the process-shared attribute shall be PTHREAD_PROCESS_PRIVATE. - - - - Upon success, it returns 0, and stores the value of the process-shared - attribute of 'attr' into 'pshared'. - - - - It MAY fail if: - [EINVAL] - 'attr' is invalid. - Shall not return an error code of [EINTR] - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/coverage.txt deleted file mode 100644 index 638b2b4bc9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_getpshared/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document defines the coverage for the pthread_mutexattr_getpshared function: - -Assertion Tested? -1 YES -2 YES -3 NO: since the behavior is "undefined" -4 YES -5 YES -6 NO - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/1-1.c deleted file mode 100644 index f0adf85e36..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/1-1.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: adam.li REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlockattr_init() - * shall initialize a read-write attributes object 'attr' with the default - * value for all of the attributes defined by the implementation. - - * Steps: - * 1. Initialize a pthread_rwlockattr_t object with pthread_rwlockattr_init() - * 2. Call pthread_rwlockattr_getpshared() to check if the process-shared - * attribute is set as the default value PTHREAD_PROCESS_PRIVATE. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_rwlockattr_t rwa; - int rc; - -#ifdef PTHREAD_PROCESS_SHARED - int pshared; -#endif - /* Initialize a read-write lock attributes object */ - rc = pthread_rwlockattr_init(&rwa); - if(rc != 0) - { - printf("Test FAILED, pthread_rwlockattr_init() returns %d\n", rc); - return PTS_FAIL; - } - -#ifdef PTHREAD_PROCESS_SHARED - /* If the symbol {PTHREAD_PROCESS_SHARED} is defined, the attribute - * process-shared should be provided and its default value should be - * PTHREAD_PROCESS_PRIVATE */ - if(pthread_rwlockattr_getpshared(&rwa, &pshared) != 0) - { - printf("Error obtaining the attribute process-shared\n"); - return PTS_UNRESOLVED; - } - - if(pshared == PTHREAD_PROCESS_PRIVATE) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - printf("Test FAILED, the default process-shared attribute is not PTHREAD_PROCESS_PRIVATE\n"); - return PTS_FAIL; - } -#endif - - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNSUPPORTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/2-1.c deleted file mode 100644 index afe7ccdd5c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/2-1.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: adam.li REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * After a read-write lock attributes object has been used to initialize - * one or more read-write locks, any function affecting the attributes object - * (including destruction) shall not affect any previously - * initialized read-write locks. - * Steps: - * 1. Initialize a pthread_rwlockattr_t object with pthread_rwlockattr_init()i - * 2. Initialize two pthread_rwlock_t objects with this pthread_rwlockattr_t object - * 3. Destruct this pthread_rwlockattr_t objects. - * 4. The two pthread_rwlock_t objects should safely be used to lock and unlock. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_rwlockattr_t rwa; - pthread_rwlock_t rwl1, rwl2; - int rc; - - /* Initialize a read-write lock attributes object */ - rc = pthread_rwlockattr_init(&rwa); - if(rc != 0) - { - printf("Error at pthread_rwlockattr_init(), returns %d\n", rc); - return PTS_UNRESOLVED; - } - - if((rc = pthread_rwlock_init(&rwl1, &rwa)) != 0) - { - printf("Error at 1st pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - if((rc = pthread_rwlock_init(&rwl2, &rwa)) != 0) - { - printf("Error at 2nd pthread_rwlock_init()\n"); - return PTS_UNRESOLVED; - } - - if((rc = pthread_rwlock_rdlock(&rwl1)) != 0) - { - printf("Error at pthread_rwlock_rdlock(): rwl1\n"); - return PTS_UNRESOLVED; - } - - if((rc = pthread_rwlockattr_destroy(&rwa)) != 0 ) - { - printf("Error at pthread_rwlockattr_destory()\n"); - return PTS_UNRESOLVED; - } - if((rc = pthread_rwlock_unlock(&rwl1)) != 0) - { - printf("Error at pthread_rwlock_unlock: rwl1\n"); - printf("Test Failed.\n"); - return PTS_FAIL; - } - - if((rc = pthread_rwlock_rdlock(&rwl2)) != 0) - { - printf("Error at pthread_rwlock_rdlock():rwl2\n"); - printf("Test Failed.\n"); - return PTS_FAIL; - } - if((rc = pthread_rwlock_unlock(&rwl2)) != 0) - { - printf("Error at pthread_rwlock_unlock:rwl2\n"); - printf("Test Failed.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/3-1.sh deleted file mode 100755 index 191ee5a8c2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/3-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Test pthread_rwlockattr_init returns 0 on success. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/assertions.xml deleted file mode 100644 index 2b3b637ef9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/assertions.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - pthread_rwlockattr_init( ) function shall initialize a read-write lock attributes - object attr with the default value for all of the attributes defined by the - implementation. - - - - After a read-write lock attributes object has been used to initialize - one or more read-write locks, any function affecting the attributes object - (including destruction) shall not affect any previously - initialized read-write locks. - - - - If successful, the pthread_rwlockattr_init( ) functions shall return zero; - otherwise, an error number shall be returned to indicate the error. - - - - pthread_rwlockattr_init( ) function shall fail if: - [ENOMEM] Insufficient memory exists to initialize the read-write - lock attributes object. - This function shall not return an error code of [EINTR]. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/coverage.txt deleted file mode 100644 index ba3f6b8c51..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_init/coverage.txt +++ /dev/null @@ -1,10 +0,0 @@ -This document defines the coverage for the pthread_rwlockattr_init function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 NO *Looking for a way to use up the memory without screwing - up the machine. - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/1-1.c deleted file mode 100644 index 31c6b1605e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/1-1.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_rwlockattr_setpshared() - * - * It shall set the value of the process-shared attribute from 'attr'. - * - * Steps: - * 1. Initialize a pthread_rwlockattr_t object with pthread_rwlockattr_init(). - * 2. Set the process shared to PTHREAD_PROCESS_PRIVATE. - * 3. Get the attribute and test whether the setting in step 2 is correct. - * 4. Set the process shared to PTHREAD_PROCESS_SHARED. - * 5. Get the attribute and test whether the setting in step 4 is correct. - * - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_rwlockattr_t rwla; - int pshared; - int rc = 0; - - #ifndef PTHREAD_PROCESS_SHARED - printf("process-shared attribute is not available for testing\n"); - return PTS_UNSUPPORTED; - #endif - - /* Initialize a rwlock attributes object */ - if(pthread_rwlockattr_init(&rwla) != 0) - { - printf("Error at pthread_rwlockattr_init()\n"); - return PTS_UNRESOLVED; - } - - rc = pthread_rwlockattr_setpshared(&rwla, PTHREAD_PROCESS_PRIVATE); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_rwlockattr_setpshared(), return error: %d\n", rc); - return PTS_FAIL; - } - - if(pthread_rwlockattr_getpshared(&rwla, &pshared) != 0) - { - printf("Error at pthread_rwlockattr_getpshared()\n"); - return PTS_UNRESOLVED; - } - - if(pshared != PTHREAD_PROCESS_PRIVATE) - { - printf("Test FAILED: Expect PTHREAD_PROCESS_PRIVATE, but got %d\n", pshared); - return PTS_FAIL; - } - - rc = pthread_rwlockattr_setpshared(&rwla, PTHREAD_PROCESS_SHARED); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_rwlockattr_setpshared(), return error: %d\n", rc); - return PTS_FAIL; - } - - if(pthread_rwlockattr_getpshared(&rwla, &pshared) != 0) - { - printf("Error at pthread_rwlockattr_getpshared()\n"); - return PTS_UNRESOLVED; - } - - if(pshared != PTHREAD_PROCESS_SHARED) - { - printf("Test FAILED: Expect PTHREAD_PROCESS_SHARED, but got %d\n", pshared); - return PTS_FAIL; - } - - if(pthread_rwlockattr_destroy(&rwla) != 0) - { - printf("Error at pthread_rwlockattr_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/2-1.sh deleted file mode 100755 index 9767ae412b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# If successful, the pthread_rwlockattr_setpshared( ) function shall -# return zero; otherwise, an error number shall be returned to indicate -# the error. -# - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/assertions.xml deleted file mode 100644 index 71ab08e31e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/assertions.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - pthread_rwlockattr_setpshared( ) - function shall set the process-shared attribute in an initialized - attributes object referenced by attr. - - - - If successful, the pthread_rwlockattr_setpshared( ) function shall - return zero; otherwise, an error number shall be returned to indicate - the error. - - - It MAY fail if: - [EINVAL] - 'attr' is invalid. - Shall not return an error code of [EINTR] - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/coverage.txt deleted file mode 100644 index c41cca8b17..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_rwlockattr_setpshared/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -This document defines the coverage for the pthread_rwlockattr_init function: - -Assertion Tested? -1 YES -2 YES -3 NO -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_self/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_self/1-1.c deleted file mode 100644 index d20b3067d5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_self/1-1.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_self() - * - * Shall return the thread ID of the calling thread. No errors are defined. - * - * Steps: - * 1. Create a new thread. - * 2. The function that the thread calls will call pthread_self() and store - * the return value (which is the thread ID of the thread calling it) into - * a global variable. - * 3. Call pthread_equal and verify that the thread IDs are the same. - * 4. Verify that the new thread ID is not the same as main thread ID. - * - */ - -#include -#include -#include "posixtest.h" - -pthread_t new_th2; /* Global thread to hold the value of when pthread_self - returns from the thread function. */ - -void *a_thread_func() -{ - new_th2=pthread_self(); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th1; - - /* Create a new thread. */ - if(pthread_create(&new_th1, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to return */ - if(pthread_join(new_th1, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Call pthread_equal() and pass to it the new thread ID in both - * parameters. It should return a non-zero value, indicating that - * both thread IDs are equal, and therefore refer to the same - * thread. */ - if(pthread_equal(new_th1, new_th2) == 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - if (pthread_equal(new_th1, pthread_self()) != 0) - { - printf("Test FAILED -- 2 threads have the same ID\n"); - return PTS_FAIL; - } - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_self/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_self/assertions.xml deleted file mode 100644 index 32f75948c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_self/assertions.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - The function - - pthread_t pthread_self(void) - - returns the thread ID of the calling thread. No errors are defined. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_self/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_self/coverage.txt deleted file mode 100644 index 833a50f366..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_self/coverage.txt +++ /dev/null @@ -1,6 +0,0 @@ -This document defines the coverage for the pthread_self() function: - -Assertion Tested? -1 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/1-1.c deleted file mode 100644 index 0f3ccef210..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/1-1.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancelstate - * Atomically sets the cancelability state to 'state' and returns the old - * cancelability state in the location referenced by 'oldstate'. - * 'state' can either be PTHREAD_CANCEL_ENABLE, or PTHREAD_CANCEL_DISABLE. - * - * Test when a thread is PTHREAD_CANCEL_ENABLE - * - * STEPS: - * 1. Create a thread. - * 2. In the thread function, set the state to - * PTHREAD_CANCEL_ENABLE and the cancel_flag to 1. - * 3. Send out a thread cancel request to the new thread - * 4. If the cancel request was honored, the cancel_flag will remain 1. - * 5. If not, the thread will continue until the end of execution, cancel_flag will be set to -1 - * and,therefore failing the test. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cancel_flag; - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - /* Set cancel state to ENABLE, meaning it should honor all cancel requests. */ - /* Set cancel type to ASYNCHRONOUS so that it honors cancel requests immediately. */ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - cancel_flag=1; - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Wait until main() has sent out a cancel request, meaning until it - * sets sem1==INTHREAD. */ - while(sem1==INMAIN) - sleep(1); - - /* If the thread correctly honors the cancel request, then the cancel_flag will - * remain 1. If it contiues on with the thread execution, then the cancel_flag - * will be -1, and therefore failing this test. */ - pthread_testcancel(); - - /* Should not reach here if the thread correctly honors the cancel request. */ - cancel_flag=-1; - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cancel_flag=0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=INMAIN.) */ - while(sem1==INTHREAD) - sleep(1); - - if(pthread_cancel(new_th) != 0) - { - perror("Error sending cancel request\n"); - return PTS_UNRESOLVED; - } - - /* Indicate to the thread function that the thread cancel request - * has been sent to it. */ - sem1=INTHREAD; - - /* Wait for thread to end execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* This means that the cancel request was ignored rather than honored, and - * the test fails. */ - if(cancel_flag < 0) - { - printf("Test FAILED: Thread of cancel type PTHREAD_CANCEL_ENABLE did not honor cancel request\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/1-2.c deleted file mode 100644 index 26685c7d44..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/1-2.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancelstate - * Atomically sets the cancelability state to 'state' and returns the old - * cancelability state in the location referenced by 'oldstate'. - * 'state' can either be PTHREAD_CANCEL_ENABLE, or PTHREAD_CANCEL_DISABLE. - * - * Test when a thread is PTHREAD_CANCEL_DISABLE - * - * STEPS: - * 1. Create a thread. - * 2. In the thread function, set the state to - * PTHREAD_CANCEL_DISABLE and the cancel_flag to -1. - * 3. Send out a thread cancel request to the new thread - * 4. If the cancel request was honored, the cancel_flag will remain -1. - * 5. If not, the thread will continue until the end of execution, cancel_flag will be set to 1 - * and,therefore passing the test. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cancel_flag; - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - /* Set cancel state to DISABLE, meaning it shouldn't honor any cancel requests. */ - pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); - - cancel_flag=-1; - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Wait until main() has sent out a cancel request, meaning until it - * sets sem1==INTHREAD. */ - while(sem1==INMAIN) - sleep(1); - - /* If the thread incorrectly honors the cancel request, then the cancel_flag will - * remain -1. If it contiues on with the thread execution, then the cancel_flag - * will be 1, and therefore passing this test. */ - pthread_testcancel(); - - /* Should reach here if the thread correctly ignores the cancel - * request. */ - cancel_flag=1; - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cancel_flag=0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=INMAIN.) */ - while(sem1==INTHREAD) - sleep(1); - - if(pthread_cancel(new_th) != 0) - { - perror("Error sending cancel request\n"); - return PTS_UNRESOLVED; - } - - /* Indicate to the thread function that the thread cancel request - * has been sent to it. */ - sem1=INTHREAD; - - /* Wait for thread to end execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* This means that the cancel request was honored rather than ignored, and - * the test fails. */ - if(cancel_flag <= 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/2-1.c deleted file mode 100644 index 3d04b690e9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/2-1.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancelstate - * The cancelability state of a newly created thread is PTHREAD_CANCEL_ENABLE. - * - * STEPS: - * 1. Create a thread. - * 2. In the thread function, set cancel_flag to 1. - * 3. Send out a thread cancel request to the new thread - * 4. If the cancel request was honored, the cancel_flag will remain 1. - * 5. If not, the thread will continue until the end of execution, cancel_flag will be set to -1 - * and,therefore failing the test. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cancel_flag; - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - /* Set default cancel state should be ENABLE, meaning it should honor all - * cancel requests. */ - /* Set cancel type to ASYNCHRONOUS so that it honors cancel requests immediately. */ - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - cancel_flag=1; - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Wait until main() has sent out a cancel request, meaning until it - * sets sem1==INTHREAD. */ - while(sem1==INMAIN) - sleep(1); - - /* If the thread correctly honors the cancel request, then the cancel_flag will - * remain 1. If it contiues on with the thread execution, then the cancel_flag - * will be -1, and therefore failing this test. */ - pthread_testcancel(); - - /* Should not reach here if the thread correctly honors the cancel request. */ - cancel_flag=-1; - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cancel_flag=0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=INMAIN.) */ - while(sem1==INTHREAD) - sleep(1); - - if(pthread_cancel(new_th) != 0) - { - perror("Error sending cancel request\n"); - return PTS_UNRESOLVED; - } - - /* Indicate to the thread function that the thread cancel request - * has been sent to it. */ - sem1=INTHREAD; - - /* Wait for thread to end execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* This means that the cancel request was ignored rather than honored, and - * the test fails. */ - if(cancel_flag < 0) - { - printf("Test FAILED: Thread default cancel type is not PTHREAD_CANCEL_ENABLE, it did not honor cancel request\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/3-1.c deleted file mode 100644 index 71c36ceab8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/3-1.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancelstate - * It returns a 0 on success. It may return an error code of: - * - * [EINVAL] The specified state is not PTHREAD_CANCEL_ENABLE or - * PTHREAD_CANCEL_DISABLE. - - * It will not return EINTR. - * - * STEPS: - * 1. Create a thread. - * 2. In the thread function, set the state to an invalid value -100; - * 3. Check the return value. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int ret; /* Return value of pthread_setcancelstate(). */ - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - /* Set cancel state to an invalid integer and save the return value. */ - ret=pthread_setcancelstate(-100, NULL); - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing value */ - ret=0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* This means that pthread_setcancelstate() did not give an error when passed an - * invalid state value of -100. */ - if(ret != EINVAL) - { - if(ret == 0) - { - printf("Test PASSED: *NOTE: Returned 0 on error, though standard states 'may' fail.\n"); - return PTS_PASS; - } - - printf("Test FAILED: returned invalid error code of %d.\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/assertions.xml deleted file mode 100644 index 007d915221..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/assertions.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - The function - - int pthread_setcancelstate(int state, int* oldstate); - - Atomically sets the cancelability state to 'state' and returns the old - cancelability state in the location referenced by 'oldstate'. - - 'state' can either be PTHREAD_CANCEL_ENABLE, or PTHREAD_CANCEL_DISABLE. - - - The cancelability state of a newly created thread is PTHREAD_CANCEL_ENABLE. - - - It returns a 0 on success. It may return an error code of: - - [EINVAL] The specified state is not PTHREAD_CANCEL_ENABLE or - PTHREAD_CANCEL_DISABLE. - - It will not return EINTR. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/coverage.txt deleted file mode 100644 index a9304c9607..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcancelstate/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_setcancelstate function: - -Assertion Tested? -1 YES -2 YES -3 YES - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/1-1.c deleted file mode 100644 index d50e6e54f5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/1-1.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_setcanceltype - * Atomically sets the cancelability type to 'type' and returns the old - * cancelability type in the location referenced by 'oldtype'. - * 'state' can either be PTHREAD_CANCEL_DEFERRED, or PTHREAD_CANCEL_ASYNCHRONOUS. - * - * Test when a thread is PTHREAD_CANCEL_ASYNCHRONOUS - * - * STEPS: - * 1. Setup a mutex and lock it in main() - * 2. Create a thread. - * 3. In the thread function, set the type to PTHREAD_CANCEL_ASYNCHRONOUS - * 4. Setup a cleanup handler for the thread. - * 5. Make the thread block on the locked mutex - * 6. Send out a thread cancel request to the new thread - * 7. If the cancel request was honored immediately and correctly, the - * cleanup handler would have been executed, and the test will pass. - * 8. If not, main will wait for 10 seconds before it unlocks the mutex, and the thread - * will exit, failing the test. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ -# define TIMEOUT 10 /* Time out time in seconds */ - -int sem1; /* Manual semaphore */ -int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */ -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */ - - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is 1, it means that the thread was canceled. */ -void a_cleanup_func() -{ - cleanup_flag=1; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - pthread_cleanup_push(a_cleanup_func,NULL); - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Lock the mutex. It should have already been locked in main, so the thread - * should block. */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - /* Shouldn't get here if the cancel request was honored immediately - * like it should have been. */ - cleanup_flag=-1; - pthread_cleanup_pop(0); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int i=0; - - /* Initializing values */ - sem1=INTHREAD; - cleanup_flag=0; - - /* Lock the mutex */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - return PTS_UNRESOLVED; - } - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=INMAIN.) */ - while(sem1==INTHREAD) - sleep(1); - - /* Send cancel request to the thread. */ - if(pthread_cancel(new_th) != 0) - { - perror("Test FAILED: Error in pthread_cancel()\n"); - return PTS_UNRESOLVED; - } - /* Wait for the thread to either cancel immediately (as it should do) and call it's - * cleanup handler, or for TIMEOUT(10) seconds if the cancel request was not honored - * immediately. */ - while((cleanup_flag == 0) && (i != TIMEOUT)) - { - sleep(1); - i++; - } - - /* Unlock the mutex */ - pthread_mutex_unlock(&mutex); - - /* This means that the cleanup function wasn't called, so the cancel - * request was not honord immediately like it should have been. */ - if(cleanup_flag <= 0) - { - printf("Test FAILED: Cancel request timed out\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/1-2.c deleted file mode 100644 index b07f45a19f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/1-2.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_setcanceltype - * Atomically sets the cancelability type to 'type' and returns the old - * cancelability type in the location referenced by 'oldtype'. - * 'state' can either be PTHREAD_CANCEL_DEFERRED, or PTHREAD_CANCEL_ASYNCHRONOUS. - * - * Test when a thread is PTHREAD_CANCEL_DEFERRED - * - * STEPS: - * 1. Setup a mutex and lock it in main() - * 2. Create a thread. - * 3. In the thread function, set the type to PTHREAD_CANCEL_DEFERRED - * 4. Setup a cleanup handler for the thread. - * 5. Make the thread block on the locked mutex - * 6. Send out a thread cancel request to the new thread, and unlock the mutex allowing the - * thread to continue execution. - * 7. If the cancel request was honored immediately, the - * cleanup handler would have been executed, setting the cleanup_flag to -1, making the - * test fail. - * 8. If not, the thread will continue execution, pop the cleanup handler, set the cleanup - * flag to 1, and call the cancelation point pthread_testcancel(). The test will pass. - * 9. If the thread did not cancel at the cancelation point like it was supposed to, the thread - * will continue execution and set the cleanup_flag to -2, failing the test. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */ -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */ - - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is 1, it means that the thread was canceled. */ -void a_cleanup_func() -{ - cleanup_flag=-1; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); - - pthread_cleanup_push(a_cleanup_func,NULL); - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Lock the mutex. It should have already been locked in main, so the thread - * should block. */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - /* Should get here if the cancel request was deffered. */ - pthread_cleanup_pop(0); - cleanup_flag=1; - - /* Cancelation point. Cancel request should not be honored here. */ - pthread_testcancel(); - - /* Should not get here if the cancel request was honored at the cancelation point - * pthread_testcancel(). */ - cleanup_flag=-2; - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cleanup_flag=0; - - /* Lock the mutex */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - return PTS_UNRESOLVED; - } - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=INMAIN.) */ - while(sem1==INTHREAD) - sleep(1); - - /* Send cancel request to the thread. */ - if(pthread_cancel(new_th) != 0) - { - printf("Test FAILED: Couldn't cancel thread\n"); - return PTS_FAIL; - } - - /* Cancel request has been sent, unlock the mutex */ - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error in pthread_mutex_unlock()\n"); - return PTS_UNRESOLVED; - } - - /* Wait 'till the thread has been canceled or has ended execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* This means that the cleanup function wasn't called, so the cancel - * request was not honord immediately like it should have been. */ - if(cleanup_flag == -1) - { - printf("Test FAILED: Cancel request was not deferred.\n"); - return PTS_FAIL; - } - - if(cleanup_flag == -2) - { - printf("Test FAILED: (1) Cancel request not honored at cancelation point pthread_testcancel() OR (2) pthread_testcancel() not treated as a cancelation point.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/2-1.c deleted file mode 100644 index 1de90b49be..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/2-1.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_setcanceltype - The cancelability type of a newly created thread is PTHREAD_CANCEL_DEFERRED. - * - * STEPS: - * 1. Setup a mutex and lock it in main() - * 2. Create a thread. Without setting the cancel type, the default should be - * PTHREAD_CANCEL_DEFERRED. - * 3. Setup a cleanup handler for the thread. - * 4. Make the thread block on the locked mutex - * 5. Send out a thread cancel request to the new thread, and unlock the mutex allowing the - * thread to continue execution. - * 6. If the cancel request was honored immediately, the - * cleanup handler would have been executed, setting the cleanup_flag to -1, making the - * test fail. - * 7. If not, the thread will continue execution, pop the cleanup handler, set the cleanup - * flag to 1, and call the cancelation point pthread_testcancel(). The test will pass. - * 8. If the thread did not cancel at the cancelation point like it was supposed to, the thread - * will continue execution and set the cleanup_flag to -2, failing the test. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */ -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */ - - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is 1, it means that the thread was canceled. */ -void a_cleanup_func() -{ - cleanup_flag=-1; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - - pthread_cleanup_push(a_cleanup_func,NULL); - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Lock the mutex. It should have already been locked in main, so the thread - * should block. */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - /* Should get here if the cancel request was deffered. */ - pthread_cleanup_pop(0); - cleanup_flag=1; - - /* Cancelation point. Cancel request should not be honored here. */ - pthread_testcancel(); - - /* Should not get here if the cancel request was honored at the cancelation point - * pthread_testcancel(). */ - cleanup_flag=-2; - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cleanup_flag=0; - - /* Lock the mutex */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - return PTS_UNRESOLVED; - } - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=INMAIN.) */ - while(sem1==INTHREAD) - sleep(1); - - /* Send cancel request to the thread. */ - if(pthread_cancel(new_th) != 0) - { - perror("Test FAILED: Error in pthread_cancel()\n"); - return PTS_UNRESOLVED; - } - - /* Cancel request has been sent, unlock the mutex */ - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error in pthread_mutex_unlock()\n"); - return PTS_UNRESOLVED; - } - - /* Wait 'till the thread has been canceled or has ended execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* This means that the cleanup function wasn't called, so the cancel - * request was not honord immediately like it should have been. */ - if(cleanup_flag == -1) - { - printf("Test FAILED: Cancel request was not deferred.\n"); - return PTS_FAIL; - } - - if(cleanup_flag == -2) - { - printf("Test FAILED: (1) Cancel request not honored at cancelation point pthread_testcancel() OR (2) pthread_testcancel() not treated as a cancelation point.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/assertions.xml deleted file mode 100644 index e4f9307c34..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/assertions.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - The function - - int pthread_setcanceltype(int type, int* oldtype); - - Atomically sets the cancelability type to 'type' and returns the old - cancelability type in the location referenced by 'oldtype'. - - 'state' can either be PTHREAD_CANCEL_DEFERRED, or PTHREAD_CANCEL_ASYNCHRONOUS. - - - The cancelability type of a newly created thread is PTHREAD_CANCEL_DEFERRED. - - - It returns a 0 on success. It may return an error code of: - - [EINVAL] The specified state is not PTHREAD_CANCEL_DEFERRED or - PTHREAD_CANCEL_ASYNCHRONOUS. - - It will not return EINTR. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/coverage.txt deleted file mode 100644 index e6a958f0e1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setcanceltype/coverage.txt +++ /dev/null @@ -1,7 +0,0 @@ -This document defines the coverage for the pthread_setcanceltype function: - -Assertion Tested? -1 YES -2 YES -3 YES - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/1-1.c deleted file mode 100644 index 758e702b77..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/1-1.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * adam.li@intel.com - * - */ - - /* Set the sched parameter with pthread_setschedparam() then get */ -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - struct sched_param sparam; - int policy, priority, policy_1; - int rc; - - policy = SCHED_FIFO; - priority = sched_get_priority_min(policy); - sparam.sched_priority = priority; - - rc = pthread_setschedparam(pthread_self(), policy, &sparam); - if (rc != 0) - { - printf("Error at pthread_setschedparam: rc=%d\n", rc); - exit(PTS_FAIL); - } - rc = pthread_getschedparam(pthread_self(), &policy_1, &sparam); - if (rc != 0) - { - printf("Error at pthread_getschedparam: rc=%d\n", rc); - exit(PTS_UNRESOLVED); - } - //printf("policy: %d, priority: %d\n", policy_1, sparam.sched_priority); - if (policy_1 != policy || sparam.sched_priority != priority) - { - printf("pthread_getschedparam did not get the correct value\n"); - exit(PTS_FAIL); - } - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - pthread_join(new_th, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/1-2.c deleted file mode 100644 index 0d937d0444..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/1-2.c +++ /dev/null @@ -1,229 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function sets the scheduling policy and parameter of the specified thread. - -* The steps are: -* -> Create a new thread -* -> create another thread which changes the scheduling policy of the 1st thread - -* The test fails if the 1st thread policy is not changed. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*********************** standard includes ************************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*********************** Test framework ***********************************/ -/******************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/***************************** Configuration **********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/***************************** Test case *********************************/ -/******************************************************************************/ - -/* This function checks the thread policy & priority */ -void check_param( pthread_t thread, int policy, int priority ) -{ - int ret = 0; - - int t_pol; - - struct sched_param t_parm; - - /* Check the priority is valid */ - - if ( priority == -1 ) - { - UNRESOLVED( errno, "Wrong priority value" ); - } - - /* Get the thread's parameters */ - ret = pthread_getschedparam( thread, &t_pol, &t_parm ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get thread's parameters" ); - } - - if ( t_pol != policy ) - { - FAILED( "The thread's policy is not as expected" ); - } - - if ( t_parm.sched_priority != priority ) - { - FAILED( "The thread's priority is not as expected" ); - } -} - -/* thread function 1 */ -void * controler ( void * arg ) -{ - int ret = 0; - - /* Wait until the policy has been changed. */ - ret = pthread_barrier_wait( arg ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - /* check the thread attributes have been applied - (we only check what is reported, not the real behavior) - */ - check_param( pthread_self(), SCHED_RR, sched_get_priority_min( SCHED_RR ) ); - - return NULL; -} - -/* thread function 2 */ -void * changer( void * arg ) -{ - int ret = 0; - - struct sched_param sp; - sp.sched_priority = sched_get_priority_min( SCHED_RR ); - - if ( sp.sched_priority < 0 ) - { - UNTESTED( "Failed to get min SCHED_RR range" ); - } - - /* set the other thread's policy */ - ret = pthread_setschedparam( *( pthread_t * ) arg, SCHED_RR, &sp ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set other's thread policy" ); - } - - return NULL; -} - -/* The main test function. */ -int main( int argc, char *argv[] ) -{ - int ret = 0; - pthread_t tcontrol, tchange; - pthread_barrier_t bar; - - /* Initialize output routine */ - output_init(); - - ret = pthread_barrier_init( &bar, NULL, 2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init barrier" ); - } - - /* Create the controler thread */ - ret = pthread_create( &tcontrol, NULL, controler, &bar ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "thread creation failed" ); - } - - /* Now create the changer thread */ - ret = pthread_create( &tchange, NULL, changer, &tcontrol ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "thread creation failed" ); - } - - /* wait until the changer finishes */ - ret = pthread_join( tchange, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - - /* let the controler control */ - ret = pthread_barrier_wait( &bar ); - - if ( ( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ) ) - { - UNRESOLVED( ret, "barrier wait failed" ); - } - - - ret = pthread_join( tcontrol, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - ret = pthread_barrier_destroy( &bar ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "barrier destroy failed" ); - } - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/4-1.c deleted file mode 100644 index 0d5d5cc399..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/4-1.c +++ /dev/null @@ -1,199 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* If the function fails, the policy and parameter of the target thread -* shall not be modified. - -* The steps are: -* -> Create a new thread -* -> Change its priority to a known valid value. -* -> Change its priority to an invalid value. - -* The test fails if the priority is changed and an error returned. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*********************** standard includes ************************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*********************** Test framework ***********************************/ -/******************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/***************************** Configuration **********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/***************************** Test case *********************************/ -/******************************************************************************/ - -/* This function checks the thread policy & priority */ -void check_param( pthread_t thread, int policy, int priority ) -{ - int ret = 0; - - int t_pol; - - struct sched_param t_parm; - - /* Check the priority is valid */ - - if ( priority == -1 ) - { - UNRESOLVED( errno, "Wrong priority value" ); - } - - /* Get the thread's parameters */ - ret = pthread_getschedparam( thread, &t_pol, &t_parm ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get thread's parameters" ); - } - - if ( t_pol != policy ) - { - FAILED( "The thread's policy is not as expected" ); - } - - if ( t_parm.sched_priority != priority ) - { - FAILED( "The thread's priority is not as expected" ); - } -} - -/* thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - struct sched_param sp; - - /* Set priority to a known value */ - sp.sched_priority = sched_get_priority_max( SCHED_RR ); - - ret = pthread_setschedparam( pthread_self(), SCHED_RR, &sp ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set thread policy -- need to be root?" ); - } - - /* check the thread attributes have been applied - (we only check what is reported, not the real behavior) - */ - check_param( pthread_self(), SCHED_RR, sp.sched_priority ); - - /* Now set the priority to an invalid value. */ - sp.sched_priority++; - - ret = pthread_setschedparam( pthread_self(), SCHED_RR, &sp ); - - if ( ret != 0 ) - { - /* check the thread attributes have been applied - (we only check what is reported, not the real behavior) - */ - check_param( pthread_self(), SCHED_RR, sp.sched_priority - 1 ); -#if VERBOSE > 0 - output( "Setting to a wrong priority failed with error %d (%s).\n", - ret, - strerror( ret ) ); - } - else - { - output( "UNTESTED: setting to max prio + 1 did not fail.\n" ); -#endif - - } - - return NULL; -} - - -/* The main test function. */ -int main( int argc, char *argv[] ) -{ - int ret = 0; - pthread_t child; - - /* Initialize output routine */ - output_init(); - - /* Create the controler thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "thread creation failed" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - -#if VERBOSE > 0 - output( "Test PASSED.\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/5-1.c deleted file mode 100644 index b819bf7b25..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/5-1.c +++ /dev/null @@ -1,347 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function does not return EINTR - -* The steps are: -* -> kill a thread which calls pthread_setschedparam -* -> check that EINTR is never returned - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*********************** standard includes ************************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/******************************************************************************/ -/*********************** Test framework ***********************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/***************************** Configuration **********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - -/******************************************************************************/ -/***************************** Test case *********************************/ -/******************************************************************************/ - -char do_it = 1; -unsigned long count_ope = 0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig = 0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} - -thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig ( void * arg ) -{ - thestruct * thearg = ( thestruct * ) arg; - int ret; - pid_t process; - - process = getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread" ); - } - - while ( do_it ) - { -#ifdef WITH_SYNCHRO - - if ( ( ret = sem_wait( thearg->sem ) ) ) - { - UNRESOLVED( errno, "Sem_wait in sendsig" ); - } - - count_sig++; -#endif - - ret = kill( process, thearg->sig ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Kill in sendsig" ); - } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig1 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 1" ); - } - -#endif -} - -/* This one is registered for signal SIGUSR2 */ -void sighdl2( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig2 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 2" ); - } - -#endif -} - -/* Test function -- calls pthread_setschedparam() and checks that EINTR is never returned. */ -void * test( void * arg ) -{ - int ret = 0; - int pol1, pol2; - - struct sched_param sp1, sp2; - - pol1 = SCHED_FIFO; - pol2 = SCHED_RR; - sp1.sched_priority = sched_get_priority_min( SCHED_FIFO ); - sp2.sched_priority = sched_get_priority_min( SCHED_RR ); - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_UNBLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread" ); - } - - - while ( do_it ) - { - count_ope++; - ret = pthread_setschedparam( *( pthread_t * ) arg, pol1, &sp1 ); - - if ( ret == EINTR ) - { - FAILED( "EINTR was returned" ); - } - - ret = pthread_setschedparam( *( pthread_t * ) arg, pol2, &sp2 ); - - if ( ret == EINTR ) - { - FAILED( "EINTR was returned" ); - } - } - - return NULL; -} - - -/* Main function */ -int main ( int argc, char * argv[] ) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2, me; - thestruct arg1, arg2; - - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset ( &sa.sa_mask ); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - - if ( ( ret = sigaction ( SIGUSR1, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler1" ); - } - - sa.sa_handler = sighdl2; - - if ( ( ret = sigaction ( SIGUSR2, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler2" ); - } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset( &usersigs ); - - ret = sigaddset( &usersigs, SIGUSR1 ); - - ret |= sigaddset( &usersigs, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to add SIGUSR1 or 2 to a signal set" ); - } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread" ); - } - -#ifdef WITH_SYNCHRO - if ( sem_init( &semsig1, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig1 init" ); - } - - if ( sem_init( &semsig2, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig2 init" ); - } - -#endif - - me = pthread_self(); - - if ( ( ret = pthread_create( &th_work, NULL, test, &me ) ) ) - { - UNRESOLVED( ret, "Worker thread creation failed" ); - } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ( ( ret = pthread_create( &th_sig1, NULL, sendsig, ( void * ) & arg1 ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread creation failed" ); - } - - if ( ( ret = pthread_create( &th_sig2, NULL, sendsig, ( void * ) & arg2 ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread creation failed" ); - } - - - - /* Let's wait for a while now */ - sleep( 1 ); - - - /* Now stop the threads and join them */ - do - { - do_it = 0; - } - while ( do_it ); - - - if ( ( ret = pthread_join( th_sig1, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread join failed" ); - } - - if ( ( ret = pthread_join( th_sig2, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread join failed" ); - } - - - if ( ( ret = pthread_join( th_work, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread join failed" ); - } - - -#if VERBOSE > 0 - output( "Test executed successfully.\n" ); - - output( " %d operations.\n", count_ope ); - -#ifdef WITH_SYNCHRO - output( " %d signals were sent meanwhile.\n", count_sig ); - -#endif -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/assertions.xml deleted file mode 100644 index 9dd9e77060..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/assertions.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - The pthread_setschedparam( ) - function shall set the scheduling policy and associated scheduling parameters - for the thread whose thread ID is given by thread to the policy and - associated parameters provided in policy - and param, respectively. - - - - TSP If _POSIX_THREAD_SPORADIC_SERVER is defined, then the policy argument may have the - value SCHED_SPORADIC, with the exception for the pthread_setschedparam( ) function - that if the scheduling policy was not SCHED_SPORADIC at the time of the call, - it is implementation-defined whether the function is supported; in other words, - the implementation need not allow the application to dynamically change the - scheduling policy to SCHED_SPORADIC. The sporadic server scheduling policy - has the associated parameters sched_ss_low_priority, sched_ss_repl_period, - sched_ss_init_budget, sched_priority, and sched_ss_max_repl. The specified - sched_ss_repl_period shall be greater than or equal to the specified - sched_ss_init_budget for the function to succeed; if it is not, then the function - shall fail. The value of sched_ss_max_repl shall be within the inclusive - range [1,{SS_REPL_MAX}] for the function to succeed; if not, the function - shall fail. - - - - If successful, the pthread_setschedparam( ) - functions shall return zero; otherwise, an error number shall be returned - to indicate the error. - - - If the function fails, the policy and parameter of the target thread shall not -be modified. - - - The function does not return EINTR. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/coverage.txt deleted file mode 100644 index f858a60a17..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_setschedparam() function: - -Assertion Tested? -1 YES -2 NO -3 YES *Tested implictly by 1-1 - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedparam/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedprio/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedprio/1-1.c deleted file mode 100644 index f12fb41a72..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedprio/1-1.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * adam.li@intel.com - * - * The pthread_getschedparam( ) function shall retrieve the scheduling - * policy and scheduling parameters for the thread whose thread ID is - * given by thread and shall store those values in - * policy and param, respectively. The priority value returned from - * pthread_getschedparam( ) shall be - * the value specified by the most recent pthread_setschedparam( ), - * pthread_setschedprio( ), or pthread_create( ) call affecting the - * target thread. It shall not reflect any temporary adjustments to - * its priority as a result of any priority inheritance or ceiling functions. - * - */ - - /* Set the sched parameter with pthread_setschedprio then get */ -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - struct sched_param sparam; - int policy, priority, policy_1; - int rc; - - policy = SCHED_FIFO; - priority = sched_get_priority_min(policy); - sparam.sched_priority = priority; - - rc = pthread_setschedparam(pthread_self(), policy, &sparam); - if (rc != 0) - { - printf("Error at pthread_setschedparam: rc=%d\n", rc); - exit(PTS_UNRESOLVED); - } - rc = pthread_getschedparam(pthread_self(), &policy_1, &sparam); - if (rc != 0) - { - printf("Error at pthread_getschedparam: rc=%d\n", rc); - exit(PTS_UNRESOLVED); - } - printf("policy: %d, priority: %d\n", policy_1, sparam.sched_priority); - if (policy_1 != policy || sparam.sched_priority != priority) - { - printf("pthread_getschedparam did not get the correct value\n"); - exit(PTS_UNRESOLVED); - } - - rc = pthread_setschedprio(pthread_self(), priority + 1); - if (rc != 0) - { - printf("Error at pthread_setschedprio: rc=%d\n", rc); - exit(PTS_FAIL); - } - - rc = pthread_getschedparam(pthread_self(), &policy_1, &sparam); - if (rc != 0) - { - printf("Error at pthread_getschedparam: rc=%d\n", rc); - exit(PTS_UNRESOLVED); - } - printf("policy: %d, priority: %d\n", policy_1, sparam.sched_priority); - if (sparam.sched_priority != (priority + 1)) - { - printf("Priority is not set correctly\n"); - exit(PTS_FAIL); - } - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - pthread_join(new_th, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedprio/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedprio/assertions.xml deleted file mode 100644 index 70535c31c2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedprio/assertions.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - pthread_setschedprio( ) function shall set the scheduling priority - for the thread whose thread ID is given by thread to the value given by prio. - See Scheduling Policies (on page 44) for a description on how this function - call affects the ordering of the thread in the thread list for its - new priority. - - - - If the pthread_setschedprio( ) function fails, the scheduling priority - of the target thread shall not be changed. - - - - If successful, the pthread_setschedprio( ) function shall return zero; - otherwise, an error number shall be returned to indicate the error. - - - - If a thread whose policy or priority has been modified by pthread_setschedprio( ) - is a running thread or is runnable, the effect on its position in the thread list - depends on the direction of the modification, as follows: - a. If the priority is raised, the thread becomes the tail of the thread list. - b. If the priority is unchanged, the thread does not change position in the - thread list. - c. If the priority is lowered, the thread becomes the head of the thread list. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedprio/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedprio/coverage.txt deleted file mode 100644 index 487d505710..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setschedprio/coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -This document defines the coverage for the pthread_setschedprio() function: - -Assertion Tested? -1 YES -2 NO -3 YES *Tested implictly by 1-1 -4 NO - -Note: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/1-1.c deleted file mode 100644 index c2c22ce8ee..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/1-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that pthread_setspecific() - * - * shall associate a thread-specific value with a key obtained via a previouse call to - * pthread_key_create. Different threads may bind different values to the same key. - * Calling pthread_setspecific with a key value not obtiained from pthread_key_create of after - * the key has been deleted with pthread_key_delete is undefined. - * - * Steps: - * 1. Create NUM_OF_KEYS pthread_key_t objects - * 2. Set each key to a thread-specific value with pthread_setspecific() - * 3. Call pthread_getspecific() on each key and check that the value returned is correct. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_KEYS 10 -#define KEY_VALUE 0 - -int main() -{ - pthread_key_t keys[NUM_OF_KEYS]; - int i; - void* rc; - - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - -#define KEY_VALUE_1 100 -#define KEY_VALUE_2 200 - -pthread_key_t key; -void* rc1; -void* rc2; - -void *a_thread_func() -{ - /* Bind a value to key for this thread (this will be different from the value - * that we bind for the main thread) */ - if(pthread_setspecific(key, (void *)(KEY_VALUE_2)) != 0) - { - printf("Test FAILED: Could not set the value of the key to %d\n", (KEY_VALUE_2)); - pthread_exit((void*)PTS_FAIL); - return NULL; - } - - /* Get the bound value of the key that we just set. */ - rc2 = pthread_getspecific(key); - - pthread_exit(0); - return NULL; - -} - -int main() -{ - pthread_t new_th; - - /* Create the key */ - if(pthread_key_create(&key, NULL) != 0) - { - printf("Error: pthread_key_create() failed\n"); - return PTS_UNRESOLVED; - } - - /* Bind a value for this main thread */ - if(pthread_setspecific(key, (void *)(KEY_VALUE_1)) != 0) - { - printf("Test FAILED: Could not set the value of the key to %d\n", (KEY_VALUE_1)); - return PTS_FAIL; - } - - /* Create another thread. This thread will also bind a value to the key */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - printf("Error: in pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution */ - pthread_join(new_th, NULL); - - /* Get the value associated for the key in this main thread */ - rc1 = pthread_getspecific(key); - - /* Compare this value with the value associated for the key in the newly created - * thread, they should be different. */ - if(rc1 != (void *)(KEY_VALUE_1)) - { - printf("Test FAILED: Incorrect value bound to key, expected %d, got %ld\n", KEY_VALUE_1, (long)rc1); - return PTS_FAIL; - } - - if(rc2 != (void *)(KEY_VALUE_2)) - { - printf("Test FAILED: Incorrect value bound to key, expected %d, got %ld\n", KEY_VALUE_2, (long)rc2); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/3-1.sh deleted file mode 100755 index 95e3ba98d4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/3-1.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -# Test void *pthread_setspecific(pthread_key_t key) -# It returns 0 upon success, and an error number otherwise: - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertions 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/assertions.xml deleted file mode 100644 index 47201af49b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/assertions.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - The function - void *pthread_setspecific(pthread_key_t key) - shall acssociate a thread-specific value with a key obtained via a previouse call to - pthread_key_create. Different threads may bind different values to the same key. - Calling pthread_setspecific with a key value not obtiained from pthread_key_create of after - the key has been deleted with pthread_key_delete is undefined. - - - - pthread_setspecific may be called from a thread-specific data destructor function. - A call to pthread_getspecific() from a thread-specific data destructor routine may result - either in lost storage or in an infinite loop. - - - - It returns 0 upon success, and an error number otherwise: - - Shall fail if: - [ENOMEM] - Insufficient memory exists to associate the value with the key - May fail if: - [EINVAL] - The key value is invalid - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/coverage.txt deleted file mode 100644 index 2a6524cdd0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_getspecific function: - -Assertion Tested? -1 YES -2 NO *Will not test -3 YES *Will not test [ENOMEM] - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/10-1.c deleted file mode 100644 index 4c0d346ddf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/10-1.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Attempt to add SIGKILL and SIGSTOP to the process's signal mask and - verify that: - - They do not get added. - - pthread_sigmask() does not return -1. -*/ - -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - sigset_t set1, set2; - int pthread_sigmask_return_val = 1; - - sigemptyset(&set1); - sigemptyset(&set2); - sigaddset(&set1, SIGKILL); - sigaddset(&set1, SIGSTOP); - pthread_sigmask_return_val = pthread_sigmask(SIG_SETMASK, &set1, NULL); - pthread_sigmask(SIG_SETMASK, NULL, &set2); - - if (sigismember(&set2, SIGKILL)) { - printf("FAIL: SIGKILL was added to the signal mask\n"); - pthread_exit((void*)-1); - } - if (sigismember(&set2, SIGSTOP)) { - printf("FAIL: SIGSTOP was added to the signal mask\n"); - pthread_exit((void*)-1); - } - if (pthread_sigmask_return_val != 0) { - printf("FAIL: pthread_sigmask returned %d. System should be able to enforce blocking un-ignorable signals without causing pthread_sigmask() to return an error.\n", pthread_sigmask_return_val); - pthread_exit((void*)-1); - } - - printf("Test PASSED\n"); - pthread_exit((void*)0); - - /* To please some compilers */ - return NULL; -} - -int main() { - - int *thread_return_value; - - pthread_t new_thread; - - if (pthread_create(&new_thread, NULL, a_thread_func, NULL) != 0) { - perror("Error creating new thread\n"); - return PTS_UNRESOLVED; - } - - if (pthread_join(new_thread, (void*)&thread_return_value) != 0) { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if ((long)thread_return_value != 0) { - if ((long)thread_return_value == 1) { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - else if ((long)thread_return_value == -1) { - printf ("Test FAILED\n"); - return PTS_FAIL; - } - else { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - } - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/12-1.c deleted file mode 100644 index 5bdbbff40e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/12-1.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Steps: - 1. Set the signal mask to only having SIGABRT. - 2. Call pthread_sigmask again, this time with a randomly generated - value of how that is checked to make sure it does not equal any of the three defined - values of how which are SIG_SETMASK, SIG_BLOCK, or SIG_UNBLOCK. This should - cause pthread_sigmask() to return -1. For the second parameter in the - pthread_sigmask() function, use a set which contains SIGABRT and SIGALRM. - 3. Now verify using the is_changed() function that the only signal that is still - in the signal mask is SIGABRT. Neither SIGALRM nor any other signal should be - in the signal mask of the process. - -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NUMSIGNALS 26 - -int is_changed(sigset_t set, int sig) { - - int i; - int siglist[] = {SIGABRT, SIGALRM, SIGBUS, SIGCHLD, - SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT, - SIGPIPE, SIGQUIT, SIGSEGV, - SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU, - SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS, - SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ }; - - if (sigismember(&set, sig) != 1) { - return 1; - } - for (i=0; i -#include -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() { - - sigset_t actl; -/* - printf("SIG_SETMASK=%d\n", SIG_SETMASK); - printf("SIG_BLOCK=%d\n", SIG_BLOCK); - printf("SIG_UNBLOCK=%d\n", SIG_UNBLOCK); - printf("r=%d\n", r); -*/ - sigemptyset(&actl); - sigaddset(&actl, SIGABRT); - - if (pthread_sigmask(SIG_SETMASK, &actl, NULL) != 0) { - perror("pthread_sigmask() did not return 0\n"); - pthread_exit((void*)-1); - } - - printf("PASS: pthread_sigmask returned 0.\n"); - pthread_exit((void*)0); - - /* To please some compilers */ - return NULL; -} - -int main() { - - int *thread_return_value; - - pthread_t new_thread; - - if (pthread_create(&new_thread, NULL, a_thread_func, NULL) != 0) { - perror("Error creating new thread\n"); - return PTS_UNRESOLVED; - } - - if (pthread_join(new_thread, (void*)&thread_return_value) != 0) { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if ((long)thread_return_value != 0) { - if ((long)thread_return_value == 1) { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - else if ((long)thread_return_value == -1) { - printf ("Test FAILED\n"); - return PTS_FAIL; - } - else { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - } - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/15-1.c deleted file mode 100644 index de4b40dbed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/15-1.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Simply, if pthread_sigmask returns a 0 here, test passes. - -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - - sigset_t set; - sigaddset (&set, SIGABRT); - - if (pthread_sigmask(SIG_SETMASK, &set, NULL) != 0) { - perror("pthread_sigmask failed -- returned -- test aborted"); - return PTS_FAIL; - } - printf("pthread_sigmask passed\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/16-1.c deleted file mode 100644 index f61ccaa4e1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/16-1.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Steps: - 1. Call pthread_sigmask with a randomly generated - value of how that is checked to make sure it does not equal any of the three defined - values of how which are SIG_SETMASK, SIG_BLOCK, or SIG_UNBLOCK. This should - cause pthread_sigmask() to return EINVAL. If it doesn't, then fail, otherwise pass. - -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int get_rand() { - - int r; - r=rand(); - if ((r == SIG_BLOCK) || (r == SIG_SETMASK) || (r == SIG_UNBLOCK)) { - r = get_rand(); - } - return r; -} - -void *a_thread_func() { - - int r=get_rand(); - sigset_t actl; -/* - printf("SIG_SETMASK=%d\n", SIG_SETMASK); - printf("SIG_BLOCK=%d\n", SIG_BLOCK); - printf("SIG_UNBLOCK=%d\n", SIG_UNBLOCK); - printf("r=%d\n", r); -*/ - sigemptyset(&actl); - sigaddset(&actl, SIGABRT); - - if (pthread_sigmask(r, &actl, NULL) != EINVAL) { - perror("pthread_sigmask() did not fail even though invalid how parameter was passed to it.\n"); - pthread_exit((void*)-1); - } - - printf("PASS: pthread_sigmask returned the correct error value.\n"); - pthread_exit((void*)0); - - /* To please some compilers */ - return NULL; -} - -int main() { - - int *thread_return_value; - - pthread_t new_thread; - - if (pthread_create(&new_thread, NULL, a_thread_func, NULL) != 0) { - perror("Error creating new thread\n"); - return PTS_UNRESOLVED; - } - - if (pthread_join(new_thread, (void*)&thread_return_value) != 0) { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if ((long)thread_return_value != 0) { - if ((long)thread_return_value == 1) { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - else if ((long)thread_return_value == -1) { - printf ("Test FAILED\n"); - return PTS_FAIL; - } - else { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - } - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/18-1.c deleted file mode 100644 index 26526c5304..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/18-1.c +++ /dev/null @@ -1,371 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function does not return EINTR - -* The steps are: -* -> kill a thread which calls pthread_sigmask -* -> check that EINTR is never returned - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -char do_it = 1; -unsigned long count_ope = 0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig = 0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} - -thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig ( void * arg ) -{ - thestruct * thearg = ( thestruct * ) arg; - int ret; - pid_t process; - - process = getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread" ); - } - - while ( do_it ) - { -#ifdef WITH_SYNCHRO - - if ( ( ret = sem_wait( thearg->sem ) ) ) - { - UNRESOLVED( errno, "Sem_wait in sendsig" ); - } - - count_sig++; -#endif - - ret = kill( process, thearg->sig ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Kill in sendsig" ); - } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig1 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 1" ); - } - -#endif -} - -/* This one is registered for signal SIGUSR2 */ -void sighdl2( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig2 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 2" ); - } - -#endif -} - -int init_ctl; -/* Init function */ -void initializer( void ) -{ - init_ctl++; - return ; -} - - -/* Test function -- calls pthread_sigmask() and checks that EINTR is never returned. */ -void * test( void * arg ) -{ - int ret = 0; - sigset_t set; - int i, j=0; - int signals[] = { SIGBUS, SIGKILL, SIGABRT, SIGCHLD, SIGHUP }; -#define NUM_SIGNALS (sizeof(signals)/sizeof(int)) - int operation[] = {SIG_SETMASK, SIG_BLOCK, SIG_UNBLOCK}; - - ret = sigemptyset( &set ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to initialize signal set" ); - } - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_UNBLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread" ); - } - - - while ( do_it ) - { - count_ope++; - - for ( i = 0; i < 3; i++ ) - { - j++; - j %= 2 * NUM_SIGNALS; - - if ( j >= NUM_SIGNALS ) - ret = sigdelset( &set, signals[ j - NUM_SIGNALS ] ); - else - ret = sigaddset( &set, signals[ j ] ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to initialize signal set" ); - } - - ret = pthread_sigmask( operation[ i ], &set, NULL ); - - if ( ret == EINTR ) - { - FAILED( "pthread_sigmask returned EINTR" ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to initialize signal set" ); - } - } - } - - return NULL; -} - -/* Main function */ -int main ( int argc, char * argv[] ) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset ( &sa.sa_mask ); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - - if ( ( ret = sigaction ( SIGUSR1, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler1" ); - } - - sa.sa_handler = sighdl2; - - if ( ( ret = sigaction ( SIGUSR2, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler2" ); - } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset( &usersigs ); - - ret = sigaddset( &usersigs, SIGUSR1 ); - - ret |= sigaddset( &usersigs, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to add SIGUSR1 or 2 to a signal set" ); - } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread" ); - } - -#ifdef WITH_SYNCHRO - if ( sem_init( &semsig1, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig1 init" ); - } - - if ( sem_init( &semsig2, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig2 init" ); - } - -#endif - - if ( ( ret = pthread_create( &th_work, NULL, test, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread creation failed" ); - } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ( ( ret = pthread_create( &th_sig1, NULL, sendsig, ( void * ) & arg1 ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread creation failed" ); - } - - if ( ( ret = pthread_create( &th_sig2, NULL, sendsig, ( void * ) & arg2 ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread creation failed" ); - } - - - - /* Let's wait for a while now */ - sleep( 1 ); - - - /* Now stop the threads and join them */ - do - { - do_it = 0; - } - while ( do_it ); - - - if ( ( ret = pthread_join( th_sig1, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread join failed" ); - } - - if ( ( ret = pthread_join( th_sig2, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread join failed" ); - } - - - if ( ( ret = pthread_join( th_work, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread join failed" ); - } - - -#if VERBOSE > 0 - output( "Test executed successfully.\n" ); - - output( " %d operations.\n", count_ope ); - -#ifdef WITH_SYNCHRO - output( " %d signals were sent meanwhile.\n", count_sig ); - -#endif -#endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/4-1.c deleted file mode 100644 index 9106d97bba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/4-1.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - The resulting set shall be the union of the current set and the signal - set pointed to by set, if the value of the argument how is SIG_BLOCK. - - Steps: - 1. Have main create a new thread and wait for its termination. - 2. Inside the new thread, set up the signal mask such that it contains - only SIGABRT. - 3. Also inside the new thread, using the SIG_BLOCK as the value to - pthread_sigmask's first parameter, add SIGALRM. Now both signals - should be in the signal mask of the new thread. - 4. Raise both signals make sure that the handler associated with these - signals wasn't executed. - 5. Also make sure that both signals are pending. - 6. Pass one of three return codes to the main() function: - - A value of -1 if one of the two signals wasn't found pending or - causes the handler to be executed. - - A value of 0 if both signals were infact pending and the handler - wasn't executed. - - A value of 1 incase of any UNRESOLVED situation such as an - unexpected function failure. -*/ - -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - - -void *a_thread_func() -{ - struct sigaction act; - sigset_t blocked_set1, blocked_set2, pending_set; - sigemptyset(&blocked_set1); - sigemptyset(&blocked_set2); - sigaddset(&blocked_set1, SIGABRT); - sigaddset(&blocked_set2, SIGALRM); - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - pthread_exit((void*)1); - } - - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - pthread_exit((void*)1); - } - - if (pthread_sigmask(SIG_SETMASK, &blocked_set1, NULL) == -1) { - perror("Unexpected error while attempting to use pthread_sigmask.\n"); - pthread_exit((void*)1); - } - - if (pthread_sigmask(SIG_BLOCK, &blocked_set2, NULL) == -1) { - perror("Unexpected error while attempting to use pthread_sigmask.\n"); - pthread_exit((void*)1); - } - - if ((raise(SIGABRT) == -1) | (raise(SIGALRM) == -1)) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - pthread_exit((void*)1); - } - - if (handler_called) { - printf("FAIL: Signal was not blocked\n"); - pthread_exit((void*)-1); - } - - if (sigpending(&pending_set) == -1) { - perror("Unexpected error while attempting to use sigpending\n"); - pthread_exit((void*)1); - } - - if ((sigismember(&pending_set, SIGABRT) != 1) | (sigismember(&pending_set, SIGALRM) != 1)) { - perror("FAIL: sigismember did not return 1\n"); - pthread_exit((void*)-1); - } - - pthread_exit((void*)0); - return NULL; -} - -int main() { - - int *thread_return_value; - - pthread_t new_thread; - - if (pthread_create(&new_thread, NULL, a_thread_func, NULL) != 0) { - perror("Error creating new thread\n"); - return PTS_UNRESOLVED; - } - - if (pthread_join(new_thread, (void*)&thread_return_value) != 0) { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if ((long)thread_return_value != 0) { - if ((long)thread_return_value == 1) { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - else if ((long)thread_return_value == -1) { - printf ("Test FAILED\n"); - return PTS_FAIL; - } - else { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - } - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/5-1.c deleted file mode 100644 index 98a89609a4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/5-1.c +++ /dev/null @@ -1,163 +0,0 @@ -/* -* Copyright (c) 2003, Intel Corporation. All rights reserved. -* Created by: salwan.searty REMOVE-THIS AT intel DOT com -* This file is licensed under the GPL license. For the full content -* of this license, see the COPYING file at the top level of this -* source tree. - -The resulting set shall be the the signal set pointed to by set - -Steps: -1. Have main create a new thread and wait for its termination. -2. Inside the new thread, set up the signal mask such that it contains - only SIGABRT (by passing SIG_SETMASK value to pthread_sigmask) -4. Raise SIGABRT, and make sure that the handler associated with it - wasn't executed, otherwise fail. -5. Also make sure that SIGABRT is pending, otherwise fail. - -* patch * -5b. Change mask to SIGUSR1 and check that the handler is called. This means -that SIG_SETMASK removed the old signal from the set. -* /patch * - -6. Pass one of three return codes to the main() function: - - A value of -1 if SIGABRT wasn't found pending or - causes the handler to be executed. - - A value of 0 if SIGABRT was in fact pending and the handler - wasn't executed. - - A value of 1 incase of any UNRESOLVED situation such as an - unexpected function failure. -*/ - -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler( int signo ) -{ - handler_called = 1; -} - -void *a_thread_func() -{ - - struct sigaction act; - sigset_t blocked_set, pending_set; - sigemptyset( &blocked_set ); - sigaddset( &blocked_set, SIGABRT ); - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset( &act.sa_mask ); - - if ( sigaction( SIGABRT, &act, 0 ) == -1 ) - { - perror( "Unexpected error while attempting to setup test " - "pre-conditions" ); - pthread_exit( ( void* ) 1 ); - } - - if ( pthread_sigmask( SIG_SETMASK, &blocked_set, NULL ) == -1 ) - { - perror( "Unexpected error while attempting to use pthread_sigmask.\n" ); - pthread_exit( ( void* ) 1 ); - } - - if ( raise( SIGABRT ) == -1 ) - { - perror( "Unexpected error while attempting to setup test " - "pre-conditions" ); - pthread_exit( ( void* ) 1 ); - } - - if ( handler_called ) - { - printf( "FAIL: Signal was not blocked\n" ); - pthread_exit( ( void* ) - 1 ); - } - - if ( sigpending( &pending_set ) == -1 ) - { - perror( "Unexpected error while attempting to use sigpending\n" ); - pthread_exit( ( void* ) 1 ); - } - - if ( sigismember( &pending_set, SIGABRT ) == -1 ) - { - perror( "Unexpected error while attempting to use sigismember.\n" ); - pthread_exit( ( void* ) - 1 ); - } - - if ( sigismember( &pending_set, SIGABRT ) != 1 ) - { - perror( "FAIL: sigismember did not return 1\n" ); - pthread_exit( ( void* ) 1 ); - } - - sigemptyset( &blocked_set ); - sigaddset( &blocked_set, SIGUSR1 ); - - if ( pthread_sigmask( SIG_SETMASK, &blocked_set, NULL ) == -1 ) - { - perror( "Unexpected error while attempting to use pthread_sigmask.\n" ); - pthread_exit( ( void* ) 1 ); - } - - sched_yield(); - - if ( !handler_called ) - { - printf( "FAIL: Old signal was not removed from mask.\n" ); - pthread_exit( ( void* ) - 1 ); - } - - pthread_exit( ( void* ) 0 ); - return NULL; - -} - -int main() -{ - - int * thread_return_value; - - pthread_t new_thread; - - if ( pthread_create( &new_thread, NULL, a_thread_func, NULL ) != 0 ) - { - perror( "Error creating new thread\n" ); - return PTS_UNRESOLVED; - } - - if ( pthread_join( new_thread, ( void* ) & thread_return_value ) != 0 ) - { - perror( "Error in pthread_join()\n" ); - return PTS_UNRESOLVED; - } - - if ( ( long ) thread_return_value != 0 ) - { - if ( ( long ) thread_return_value == 1 ) - { - printf ( "Test UNRESOLVED\n" ); - return PTS_UNRESOLVED; - } - else if ( ( long ) thread_return_value == -1 ) - { - printf ( "Test FAILED\n" ); - return PTS_FAIL; - } - else - { - printf ( "Test UNRESOLVED\n" ); - return PTS_UNRESOLVED; - } - } - - printf( "Test PASSED\n" ); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/6-1.c deleted file mode 100644 index 5769970e12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/6-1.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - The resulting set shall be the intersection of the current set and - the complement of the set pointed to by set. - - Steps: - 1. Have main create a new thread and wait for its termination. - 2. Inside the new thread, set up the signal mask such that it contains - both SIGABRT and SIGALRM - 3. Also inside the new thread, using the SIG_UNBLOCK as the value to - pthread_sigmask's first parameter, unblock SIGALRM. Now only SIGABRT - should be in the signal mask of the new thread. - 4. Raise SIGALRM, and verify that handler was called, otherwise - test fails. - 5. Reset handler_called variable to 0. Raise SIGABRT, and verify that - handler wasn't called, otherwise test fails. - 6. Make sure that the only pending signal is SIGABRT, otherwise fail. - 7. Return one of three return codes to the main() function: - - A value of -1 if any of failures mentioned above occured. - - A value of 0 if both SIGALRM was successfully blocked. - - A value of 1 incase of any UNRESOLVED situation such as an - unexpected function failure. -*/ - -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -void *a_thread_func() -{ - struct sigaction act; - sigset_t set1, set2, pending_set; - - sigemptyset(&set1); - sigaddset(&set1, SIGABRT); - sigaddset(&set1, SIGALRM); - - sigemptyset(&set2); - sigaddset(&set2, SIGALRM); - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - pthread_exit((void*)1); - } - - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - pthread_exit((void*)1); - } - - if (pthread_sigmask(SIG_SETMASK, &set1, NULL) == -1) { - perror("Unexpected error while attempting to use pthread_sigmask.\n"); - pthread_exit((void*)1); - } - - if (pthread_sigmask(SIG_UNBLOCK, &set2, NULL) == -1) { - perror("Unexpected error while attempting to use pthread_sigmask.\n"); - pthread_exit((void*)1); - } - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - pthread_exit((void*)1); - } - - if (!handler_called) { - printf("FAIL: Handler was not called for even though signal was removed from the signal mask\n"); - pthread_exit((void*)-1); - } - - handler_called = 0; - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - pthread_exit((void*)1); - } - - if (handler_called) { - printf("FAIL: Hanlder was called for even though signal should have been in the signal mask\n"); - pthread_exit((void*)-1); - } - - if (sigpending(&pending_set) == -1) { - perror("Unexpected error while attempting to use sigpending\n"); - pthread_exit((void*)1); - } - - if (sigismember(&pending_set, SIGABRT) != 1) { - perror("FAIL: sigismember did not return 1\n"); - pthread_exit((void*)-1); - } - - if (sigismember(&pending_set, SIGALRM) != 0) { - perror("FAIL: sigismember did not return 0\n"); - pthread_exit((void*)-1); - } - - pthread_exit((void*)0); - return NULL; -} - -int main() { - - int *thread_return_value; - - pthread_t new_thread; - - if (pthread_create(&new_thread, NULL, a_thread_func, NULL) != 0) { - perror("Error creating new thread\n"); - return PTS_UNRESOLVED; - } - - if (pthread_join(new_thread, (void*)&thread_return_value) != 0) { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if ((long)thread_return_value != 0) { - if ((long)thread_return_value == 1) { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - else if ((long)thread_return_value == -1) { - printf ("Test FAILED\n"); - return PTS_FAIL; - } - else { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - } - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/7-1.c deleted file mode 100644 index 2c339a1056..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/7-1.c +++ /dev/null @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2003, Intel Corporation. All rights reserved. -* Created by: salwan.searty REMOVE-THIS AT intel DOT com -* This file is licensed under the GPL license. For the full content -* of this license, see the COPYING file at the top level of this -* source tree. - -Go through all the signals (with the exception of SIGKILL and SIGSTOP -since they cannot be added to a process's signal mask) and add each one -to the signal mask. Every time a signal gets added to the signal mask -(using the pthread_sigmask() function), make sure that all signals added -before it in preceding iterations before it, exist in the old signal set -returned by the pthread_sigmask functions. - -*/ - -#include -#include -#include -#include "posixtest.h" - -#define NUMSIGNALS 26 - -void *a_thread_func() -{ - sigset_t oactl, tempset; - int i, j, test_failed = 0; - - int siglist[] = {SIGABRT, SIGALRM, SIGBUS, SIGCHLD, - SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT, - SIGPIPE, SIGQUIT, SIGSEGV, - SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU, - SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS, - SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ }; - - for ( i = 0; i < NUMSIGNALS; i++ ) - { - sigemptyset( &oactl ); - sigemptyset( &tempset ); - sigaddset( &tempset, siglist[ i ] ); - pthread_sigmask( SIG_BLOCK, &tempset, &oactl ); - - if ( i > 0 ) - { - for ( j = 0; j < i; j++ ) - { - if ( sigismember( &oactl, siglist[ j ] ) != 1 ) - { - test_failed = 1; - } - } - - for ( j = i + 1; j < NUMSIGNALS; j++ ) - { - if ( sigismember( &oactl, siglist[ j ] ) != 0 ) - { - test_failed = 1; - } - } - } - } - - if ( test_failed != 0 ) - { - printf( "Old set is invalid.\n" ); - pthread_exit( ( void* ) - 1 ); - } - - printf( "Test PASSED: oactl did contain all signals that were added to the signal mask.\n" ); - pthread_exit( ( void* ) 0 ); - - /* To please some compilers */ - return NULL; -} - - -int main() -{ - - int * thread_return_value; - - pthread_t new_thread; - - if ( pthread_create( &new_thread, NULL, a_thread_func, NULL ) != 0 ) - { - perror( "Error creating new thread\n" ); - return PTS_UNRESOLVED; - } - - if ( pthread_join( new_thread, ( void* ) & thread_return_value ) != 0 ) - { - perror( "Error in pthread_join()\n" ); - return PTS_UNRESOLVED; - } - - if ( ( long ) thread_return_value != 0 ) - { - if ( ( long ) thread_return_value == 1 ) - { - printf ( "Test UNRESOLVED\n" ); - return PTS_UNRESOLVED; - } - else if ( ( long ) thread_return_value == -1 ) - { - printf ( "Test FAILED\n" ); - return PTS_FAIL; - } - else - { - printf ( "Test UNRESOLVED\n" ); - return PTS_UNRESOLVED; - } - } - - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/8-1.c deleted file mode 100644 index d812332f03..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/8-1.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: salwan.searty REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Steps: - 1. Add only SIGABRT to the signal mask. - 2. Make a call such as this: pthread_sigmask(SIG_BLOCK, NULL, &oactl). At - this point, we have obtained the signal mask in oactl. - 3. Now call is_changed to make sure that SIGABRT is still in oactl, and - that no other signal in the set is in oactl. - -*/ - -#include -#include -#include -#include "posixtest.h" - -#define NUMSIGNALS 26 - -int is_changed(sigset_t set, int sig) { - - int i; - int siglist[] = {SIGABRT, SIGALRM, SIGBUS, SIGCHLD, - SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT, - SIGPIPE, SIGQUIT, SIGSEGV, - SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU, - SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS, - SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ }; - - if (sigismember(&set, sig) != 1) { - return 1; - } - for (i=0; i -#include -#include -#include "posixtest.h" - -#define NUMSIGNALS 26 - -int is_changed(sigset_t set, int sig) { - - int i; - int siglist[] = {SIGABRT, SIGALRM, SIGBUS, SIGCHLD, - SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT, - SIGPIPE, SIGQUIT, SIGSEGV, - SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU, - SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS, - SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ }; - - if (sigismember(&set, sig) != 1) { - return 1; - } - for (i=0; i -#include -#include -#include "posixtest.h" - -#define NUMSIGNALS 26 - -int is_changed(sigset_t set, int sig) { - - int i; - int siglist[] = {SIGABRT, SIGALRM, SIGBUS, SIGCHLD, - SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT, - SIGPIPE, SIGQUIT, SIGSEGV, - SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU, - SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS, - SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ }; - - if (sigismember(&set, sig) != 1) { - return 1; - } - for (i=0; i -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; -int pthread_sigmask_return_val = 1; /* some value that's not a 1 or 0 */ - -void handler(int signo) -{ - handler_called = 1; - if (pthread_sigmask_return_val != 1) { - printf("FAIL: pthread_sigmask() returned before signal was delivered.\n"); - exit(PTS_FAIL); - } -} - -void *a_thread_func() -{ - struct sigaction act; - sigset_t blocked_set1; - sigemptyset(&blocked_set1); - sigaddset(&blocked_set1, SIGABRT); - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - pthread_exit((void*)1); - } - - if (pthread_sigmask(SIG_SETMASK, &blocked_set1, NULL) == -1) { - perror("Unexpected error while attempting to use pthread_sigmask.\n"); - pthread_exit((void*)1); - } - - if ((raise(SIGABRT) == -1)) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - pthread_exit((void*)1); - } - - pthread_sigmask_return_val = pthread_sigmask(SIG_UNBLOCK, &blocked_set1, NULL); - - if (pthread_sigmask_return_val != 0) { - perror("Unexpected error while attempting to use pthread_sigmask.\n"); - pthread_exit((void*)1); - } - - if (handler_called != 1) { - perror("Handler wasn't called, implying signal was not delivered.\n"); - pthread_exit((void*)1); - } - - printf("Test PASSED: signal was delivered before the call to pthread_sigmask returned.\n"); - pthread_exit((void*)0); - - /* To please some compilers */ - return NULL; -} - -int main() { - - int *thread_return_value; - - pthread_t new_thread; - - if (pthread_create(&new_thread, NULL, a_thread_func, NULL) != 0) { - perror("Error creating new thread\n"); - return PTS_UNRESOLVED; - } - - if (pthread_join(new_thread, (void*)&thread_return_value) != 0) { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if ((long)thread_return_value != 0) { - if ((long)thread_return_value == 1) { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - else if ((long)thread_return_value == -1) { - printf ("Test FAILED\n"); - return PTS_FAIL; - } - else { - printf ("Test UNRESOLVED\n"); - return PTS_UNRESOLVED; - } - } - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/assertions.xml deleted file mode 100644 index 5f34cd8ef5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/assertions.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - pthread_sigmask( ) function is used to examine or change (or both) the calling thread's signal - mask, independent of the number of threads the process contains. The function shall be -equivalent to sigprocmask( ), but with the ability to be used in a thread of a multi-threaded -process. - - - The sigprocmask( ) function is used to examine or change (or both) the signal mask of the calling -thread of a single-threaded process. - - -The argument set points to a set of signals to be used to change the currently blocked set, unless the -argument is a null pointer. - - - The resulting set shall be the union of the current set and the signal set pointed to by set, if the value -of the argument how is SIG_BLOCK. - - - The resulting set shall be the signal set pointed to by set, if the value of the argument how is SIG_SETMASK - - - The resulting set shall be the intersection of the current set and the complement of the signal set -pointed to by set, if the value of the argument how is SIG_UNBLOCK - - - The previous mask shall be stored in the location pointed to by oset, if the argument oset is not a null -pointer. - - - The value of the argument how is not significant and the process's signal mask shall be unchanged, and -thus the call can be used to enquire about currently blocked signals, if the argument set is a null -pointer. - - -After the call to sigprocmask(), if there are any pending unblocked signals, at least one of those -signals shall be delivered before the call to sigprocmask() returns. - - -The system shall not allow the blocking of signals which cannot be ignored, and shall not cause an error -to be indicated. - - -If any of the SIGFPE, SIGILL, SIGSEGV, or SIGBUS signals are generated while they are blocked, and the -signal was not generated by the kill(), sigqueue() or raise()functions, the result is undefined. - - - The thread's signal mask shall not be changed, if sigprocmask( ) fails. - - -In a multi-threaded process, the use of the sigprocmask( ) function is unspecified. - - -pthread_sigmask( ) shall return 0, Upon successful completion; otherwise, it shall return the corresponding -error number. - - -sigprocmask( ) shall return 0, Upon successful completion; otherwise, it shall return -1 -and errno shall be set to indicate the error, and the process' signal mask shall be unchanged. - - - An errno value of [EINVAL] shall be returned and the pthreadsigmask() function shall fail, if the -value of -the how argument is not equal to one of the defined values. - - - An errno value of [EINVAL] shall be returned and the sigprocmask() function shall fail, if the value of -the how argument is not equal to one of the defined values. - - - An error code of [EINTR] shall not be returned by the pthread_sigmask( ) function. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/coverage.txt deleted file mode 100644 index 3c4ff77eed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/coverage.txt +++ /dev/null @@ -1,25 +0,0 @@ -This document defines the coverage for function pthread_sigmask(). The functions pthread_sigmask() -and sigprocmask() are equivalent functions, but pthread_sigmask() should also work in a -multi-threaded process. The tests in this section are similar in n nature to the tests for the -sigprocmask() function, but calls will be made from threads that belong to multi-threaded processes -instead of single-threaded processes. - -Assertion Covered? -1 IMPLICITLY tested by assertions 1-18 -2 WON'T test. Pertains only to sigprocmask(). -3 IMPLICITLY tested by assertions 4-6 -4 YES -5 YES -6 YES -7 YES -8 YES -9 YES -10 YES -11 WON'T test, because POSIX does not define behavior in this case. -12 YES -13 WON'T test, because POSIX does not define behavior in this case. -14 YES -15 WON'T test, pertains only to sigprocmask() -16 YES -17 WON'T test, pertains only to sigprocmask() -18 NO, won't test for now. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_sigmask/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/1-1.c deleted file mode 100644 index 57cc3843e3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/1-1.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_spin_destroy(pthread_spinlock_t * lock) - * - * pthread_spin_destroy( ) function shall destroy the spin lock - * referenced by lock and release any resources used by the lock. - * - * Steps: - * 1. Initialize a pthread_spinlock_t object 'spinlock' with - * pthread_spin_init() - * 2. Main thread lock 'spinlock', should get the lock - * 3. Main thread unlock 'spinlock' - * 4. Main thread destroy the 'spinlock' - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_spinlock_t spinlock; - -int main() -{ - int rc = 0; - - printf("main: initialize spin lock\n"); - if(pthread_spin_init(&spinlock, PTHREAD_PROCESS_PRIVATE) != 0) - { - printf("main: Error at pthread_spin_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt spin lock\n"); - - /* We should get the lock */ - if(pthread_spin_lock(&spinlock) != 0) - { - printf("Unresolved: main cannot get spin lock when no one owns the lock\n"); - return PTS_UNRESOLVED; - } - - printf("main: acquired spin lock\n"); - - printf("main: unlock spin lock\n"); - if(pthread_spin_unlock(&spinlock) != 0) - { - printf("main: Error at pthread_spin_unlock()\n"); - return PTS_UNRESOLVED; - } - - printf("main: destroy spin lock\n"); - rc = pthread_spin_destroy(&spinlock); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_spin_destroy()" - "Return code : %d\n", rc); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/2-1.sh deleted file mode 100755 index 059da4c43b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Upon successful completion, these functions shall return zero; -# otherwise, an error number shall be returned to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/3-1.c deleted file mode 100644 index c580e26d8b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/3-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_spin_destroy(pthread_spinlock_t *lock) may fail if: - * - * [EBUSY] The implementation has detected an attempt to - * initialize or destroy a spin lock while it is in use - * (for example, while being used in a pthread_spin_lock( ) - * call) by another thread. - * - * Note: This test will always pass - * - * Steps: - * 1. Initialize a pthread_spinlock_t object 'spinlock' with - * pthread_spin_init() - * 2. Main thread lock 'spinlock', should get the lock - * 3. Create a child thread. The thread call pthread_spin_destroy() - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_spinlock_t spinlock; - -static void* fn_chld(void *arg) -{ - int rc = 0; - - printf("child: destroy spin lock\n"); - rc = pthread_spin_destroy(&spinlock); - if(rc == EBUSY) - { - printf("child: correctly got EBUSY\n"); - printf("Test PASSED\n"); - } - else - { - printf("child: got return code %d, %s\n", rc, strerror(rc)); - printf("Test PASSED: *Note: Did not return EBUSY when destroying a spinlock already in use, but standard says 'may' fail\n"); - } - exit(PTS_PASS); -} - -int main() -{ - pthread_t child_thread; - - if(pthread_spin_init(&spinlock, PTHREAD_PROCESS_PRIVATE) != 0) - { - printf("main: Error at pthread_spin_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt spin lock\n"); - - /* We should get the lock */ - if(pthread_spin_lock(&spinlock) != 0) - { - printf("main cannot get spin lock when no one owns the lock\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired spin lock\n"); - - printf("main: create thread\n"); - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error creating child thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution */ - pthread_join(child_thread, NULL); - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/assertions.xml deleted file mode 100644 index 8d9b97bb24..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/assertions.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - pthread_spin_destroy( ) function shall destroy the spin lock - referenced by lock and release any resources used by the lock. - - - - Upon successful completion, these functions shall return zero; - otherwise, an error number shall be returned to indicate the error. - - - - - The functions may fail if: - [EBUSY] The implementation has detected an attempt to - initialize or destroy a spin lock while it is in use - (for example, while being used in a pthread_spin_lock( ) - call) by another thread. - - [EINVAL] The value specified by lock is invalid. - - These functions shall not return an error code of EINTR. - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/coverage.txt deleted file mode 100644 index 2e145afe67..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_destroy/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_spin_destroy() function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/1-1.c deleted file mode 100644 index 1205d3a83a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/1-1.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_spin_init(pthread_spinlock_t * lock, int pshared) - * - * pthread_spin_init() shall allocate any resources required to use - * the spin lock referenced by 'lock' and initialize the lock to an - * unlocked state. - * - * Steps: - * 1. Initialize a pthread_spinlock_t object 'spinlock' with - * pthread_spin_init() - * 2. Main thread lock 'spinlock', should get the lock - * 3. Main thread unlock 'spinlock' - * 4. Main thread destroy the 'spinlock' - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_spinlock_t spinlock; - -int main() -{ - int rc = 0; - int pshared; - - #ifdef PTHREAD_PROCESS_PRIVATE - pshared = PTHREAD_PROCESS_PRIVATE; - #else - pshared = -1; - #endif - - rc = pthread_spin_init(&spinlock, pshared); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_spin_init(): %d\n", rc); - return PTS_FAIL; - } - - printf("main: attempt spin lock\n"); - - /* We should get the lock */ - if(pthread_spin_lock(&spinlock) != 0) - { - perror("Error: main cannot get spin lock when no one owns the lock\n"); - return PTS_UNRESOLVED; - } - - printf("main: acquired spin lock\n"); - - if(pthread_spin_unlock(&spinlock) != 0) - { - perror("main: Error at pthread_spin_unlock()\n"); - return PTS_UNRESOLVED; - } - - rc = pthread_spin_destroy(&spinlock); - if(rc != 0) - { - printf("Error at pthread_spin_destroy(): %d\n", rc); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/2-1.c deleted file mode 100644 index 4737add53a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/2-1.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_spin_init(pthread_spinlock_t *lock, int pshared) - * - * If the Thread Process-Shared Synchronization option is supported and - * the value of pshared is PTHREAD_PROCESS_SHARED, the implementation shall - * permit the spin lock to be opreated upon by any thread that has access - * to the memory where the spin lock is allocated, even if it is allocated - * in memory that is shared by multiple processes. - * - * steps: - * 1. Create a piece of shared memory object, create a spin lock 'spinlock' and - * set the PTHREAD_PROCESS_SHARED attribute. - * 2. Parent map the shared memory to its memory space, put 'spinlock' into it; - * 3. Parent get the spin lock; - * 4. Fork to create child - * 5. Child map the shared memory to its memory space; - * 6. Child call pthread_spin_trylock(), should fail with EBUSY - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -struct shmstruct{ - pthread_spinlock_t spinlock; - int data; -} *spinlock_data; - -int main() -{ - - /* Make sure there is process-shared capability. */ - #ifndef PTHREAD_PROCESS_SHARED - fprintf(stderr,"process-shared attribute is not available for testing\n"); - return PTS_UNSUPPORTED; - #endif - - int pshared = PTHREAD_PROCESS_SHARED; - - char shm_name[] = "tmp_pthread_spinlock_getpshared"; - int shm_fd; - int pid; - - /* Create shared object */ - shm_unlink(shm_name); - shm_fd = shm_open(shm_name, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - perror("Error at shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(shm_fd, sizeof(struct shmstruct)) != 0) { - perror("Error at ftruncate()"); - shm_unlink(shm_name); - return PTS_UNRESOLVED; - } - - /* Map the shared memory object to parent's memory */ - spinlock_data = mmap(NULL, sizeof(struct shmstruct), PROT_READ|PROT_WRITE, - MAP_SHARED, shm_fd, 0); - - if(spinlock_data == MAP_FAILED) - { - perror("Error at first mmap()"); - shm_unlink(shm_name); - return PTS_UNRESOLVED; - } - - /* Initialize spinlock */ - if((pthread_spin_init(&(spinlock_data->spinlock), pshared)) != 0) - { - printf("Test FAILED: Error at pthread_rwlock_init()\n"); - return PTS_FAIL; - } - - printf("main: attempt spin lock\n"); - if((pthread_spin_lock(&(spinlock_data->spinlock))) != 0) - { - printf("Error at pthread_spin_lock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired spin lock\n"); - - /* Initialize spinlock data */ - spinlock_data->data = 0; - - /* Fork a child process */ - pid = fork(); - if(pid == -1) - { - perror("Error at fork()"); - return PTS_UNRESOLVED; - } - else if(pid > 0) - { - /* Parent */ - /* wait until child writes to spinlock data */ - while(spinlock_data->data != 1) - sleep(1); - - printf("main: unlock spin lock\n"); - if(pthread_spin_unlock(&(spinlock_data->spinlock)) != 0) - { - printf("Parent: error at pthread_spin_unlock()\n"); - return PTS_UNRESOLVED; - } - - /* Tell child that parent unlocked the spin lock */ - spinlock_data->data = 2; - - /* Wait until child ends */ - wait(NULL); - - if((shm_unlink(shm_name)) != 0) - { - perror("Error at shm_unlink()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - /* Child */ - /* Map the shared object to child's memory */ - spinlock_data = mmap(NULL, sizeof(struct shmstruct), PROT_READ|PROT_WRITE, - MAP_SHARED, shm_fd, 0); - - if(spinlock_data == MAP_FAILED) - { - perror("child : Error at mmap()"); - return PTS_UNRESOLVED; - } - - printf("child: attempt spin lock\n"); - if((pthread_spin_trylock(&(spinlock_data->spinlock))) != EBUSY) - { - printf("Test FAILED: Child expects EBUSY\n"); - return PTS_FAIL; - } - printf("child: correctly got EBUSY\n"); - - /* Tell parent it can unlock now */ - spinlock_data->data = 1; - - /* Wait for parent to unlock spinlock */ - while(spinlock_data->data != 2) - sleep(1); - - /* Child tries to get spin lock after parent unlock, - * it should get the lock. */ - printf("child: attempt spin lock\n"); - if((pthread_spin_trylock(&(spinlock_data->spinlock))) != 0) - { - printf("Test FAILED: Child should get the lock\n"); - return PTS_FAIL; - } - printf("child: acquired spin lock\n"); - - printf("child: unlock spin lock\n"); - if(pthread_spin_unlock(&(spinlock_data->spinlock)) != 0) - { - printf("Child: error at pthread_spin_unlock()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_spin_destroy(&(spinlock_data->spinlock)) != 0) - { - printf("Child: error at pthread_spin_destroy()\n"); - return PTS_UNRESOLVED; - } - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/2-2.c deleted file mode 100644 index 82c33ccb73..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/2-2.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_spin_init(pthread_spinlock_t *lock, int pshared) - * - * If the Thread Process-Shared Synchronization option is supported - * and the value of pshared is PTHREAD_PROCESS_PRIVATE, or if the option - * is not supported, the spin lock shall only be operated upon by threads created - * within the same process as the thread that initialized the spin lock. - * If threads of different processed attempt to operation on such a spin - * lock, the behavior is undefined. - * - * NOTE: This case will always PASS - * - * steps: - * 1. Create a piece of shared memory object, create a spin lock 'spinlock' and - * set the PTHREAD_PROCESS_PRIVATE attribute. - * 2. Parent map the shared memory to its memory space, put 'spinlock' into it; - * 3. Parent get the spin lock; - * 4. Fork to create child - * 5. Child map the shared memory to its memory space; - * 6. Child call pthread_spin_trylock() - * 7. Main unlock - * 8. Child call pthread_spin_trylock() - */ - - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -struct shmstruct{ - pthread_spinlock_t spinlock; - int data; -} *spinlock_data; - -int main() -{ - - int pshared; - - /* Make sure there is process-shared capability. */ - #ifdef PTHREAD_PROCESS_PRIVATE - pshared = PTHREAD_PROCESS_PRIVATE; - #else - pshared = -1; - #endif - - char shm_name[] = "tmp_pthread_spinlock_init"; - int shm_fd; - int pid; - int rc; - - /* Create shared object */ - shm_unlink(shm_name); - shm_fd = shm_open(shm_name, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if(shm_fd == -1) - { - perror("Error at shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(shm_fd, sizeof(struct shmstruct)) != 0) { - perror("Error at ftruncate()"); - shm_unlink(shm_name); - return PTS_UNRESOLVED; - } - - /* Map the shared memory object to parent's memory */ - spinlock_data = mmap(NULL, sizeof(struct shmstruct), PROT_READ|PROT_WRITE, - MAP_SHARED, shm_fd, 0); - - if(spinlock_data == MAP_FAILED) - { - perror("Error at first mmap()"); - shm_unlink(shm_name); - return PTS_UNRESOLVED; - } - - if((pthread_spin_init(&(spinlock_data->spinlock), pshared)) != 0) - { - printf("Test FAILED: Error at pthread_rwlock_init()\n"); - return PTS_FAIL; - } - - printf("main: attempt spin lock\n"); - if((pthread_spin_lock(&(spinlock_data->spinlock))) != 0) - { - printf("Error at pthread_spin_lock()\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired spin lock\n"); - - /* Initialized spinlock data */ - spinlock_data->data = 0; - - pid = fork(); - if(pid == -1) - { - perror("Error at fork()"); - return PTS_UNRESOLVED; - } - else if(pid > 0) - { - /* Parent */ - /* wait until child writes to spinlock data */ - while(spinlock_data->data != 1) - sleep(1); - - printf("main: unlock spin lock\n"); - if(pthread_spin_unlock(&(spinlock_data->spinlock)) != 0) - { - printf("main: error at pthread_spin_unlock()\n"); - return PTS_UNRESOLVED; - } - - /* Tell child that parent unlocked the spin lock */ - spinlock_data->data = 2; - - /* Wait until child ends */ - wait(NULL); - - if((shm_unlink(shm_name)) != 0) - { - perror("Error at shm_unlink()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; - } - else - { - /* Child */ - /* Map the shared object to child's memory */ - spinlock_data = mmap(NULL, sizeof(struct shmstruct), PROT_READ|PROT_WRITE, - MAP_SHARED, shm_fd, 0); - - if(spinlock_data == MAP_FAILED) - { - perror("child : Error at mmap()"); - return PTS_UNRESOLVED; - } - - printf("child: attempt spin lock\n"); - rc = pthread_spin_trylock(&(spinlock_data->spinlock)); - if( rc != EBUSY) - printf("child: get return code %d, %s\n", rc, strerror(rc)); - else - printf("child: correctly got EBUSY\n"); - - /* Tell parent it can unlock now */ - spinlock_data->data = 1; - - while(spinlock_data->data != 2) - sleep(1); - - printf("child: attempt spin lock\n"); - rc = pthread_spin_trylock(&(spinlock_data->spinlock)); - if(rc == 0) - printf("child: acquired spin lock\n"); - else - printf("child: get return code %d, %s\n", rc, strerror(rc)); - - printf("child: unlock spin lock\n"); - if(pthread_spin_unlock(&(spinlock_data->spinlock)) != 0) - { - printf("Child: error at pthread_spin_unlock()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_spin_destroy(&(spinlock_data->spinlock)) != 0) - { - printf("Child: error at pthread_spin_destroy()\n"); - return PTS_UNRESOLVED; - } - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/3-1.sh deleted file mode 100755 index c2af6be059..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Upon successful completion, pthread_spin_init() shall return zero; -# otherwise, an error number shall be returned to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/4-1.c deleted file mode 100644 index 0934e4e2b3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/4-1.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_spin_init(pthread_spinlock_t * lock, int pshared) - * - * These functions may fail if: - * [EBUSY] The implementation has detected an attempt to initialize or destroy a spin - * lock while it is in use (for example, while being used in a pthread_spin_lock( ) - * call) by another thread. - * - * Note: This case will always pass. - * - * Steps: - * 1. Initialize a pthread_spinlock_t object 'spinlock' with - * pthread_spin_init() - * 2. Main thread lock 'spinlock', should get the lock - * 3. Main create a child thread - * 4. Child thread initialize the spin lock when main holds the lock - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_spinlock_t spinlock; -static int pshared; - -static void* fn_chld(void* arg) -{ - int rc; - /* child: initialize a spin lock being locked by main thread */ - printf("child: attempt initialize spin lock\n"); - rc = pthread_spin_init(&spinlock, pshared); - if(rc == EBUSY) - printf("child: correctly got EBUSY\n"); - else - { - printf("child: got return code %d, %s\n", rc, strerror(rc)); - printf("Test PASSED: *Note: Did not return EBUSY when initializing a spinlock already in use, but standard says 'may' fail\n"); - } - exit(PTS_PASS); -} - -int main() -{ - int rc = 0; - pthread_t child_thread; - - #ifdef PTHREAD_PROCESS_PRIVATE - pshared = PTHREAD_PROCESS_PRIVATE; - #else - pshared = -1; - #endif - - printf("main: initialize spin lock\n"); - - rc = pthread_spin_init(&spinlock, pshared); - if(rc != 0) - { - printf("Test FAILED: Error at pthread_spin_init()\n"); - return PTS_FAIL; - } - - printf("main: attempt spin lock\n"); - - /* We should get the lock */ - if(pthread_spin_lock(&spinlock) != 0) - { - printf("Error: main cannot get spin lock when no one owns the lock\n"); - return PTS_UNRESOLVED; - } - - printf("main: acquired spin lock\n"); - - printf("main: create thread\n"); - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error creating child thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution */ - pthread_join(child_thread, NULL); - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/assertions.xml deleted file mode 100644 index 0f82273b37..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/assertions.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - The function - - int pthread_spin_init(pthread_spinlock_t *lock, int pshared); - - shall allocate any resources required to use the spin lock - referenced by lock and initialize the lock to an unlocked state. - - - - If the Thread Process-Shared Synchronization option is supported and the value of pshared is - PTHREAD_PROCESS_SHARED, the implementation shall permit the spin lock to be operated - upon by any thread that has access to the memory where the spin lock is allocated, even if it - is allocated in memory that is shared by multiple processes. - If the Thread Process-Shared Synchronization option is supported and the value of pshared is - PTHREAD_PROCESS_PRIVATE, or if the option is not supported, the spin lock shall only be - operated upon by threads created within the same process as the thread that initialized the - spinlock. If threads of differing processes attempt to operate on such a spin lock, the - behavior is undefined. - - - - Upon successful completion, these functions shall return zero; otherwise, an error number shall - be returned to indicate the error. - - - - This function may fail if: - -[EBUSY] The implementation has detected an attempt to initialize or destroy a spin - lock while it is in use (for example, while being used in a pthread_spin_lock( ) - by another thread. - -[EINVAL] The value specified by lock is invalid. - - It shall fail if: - -[EAGAIN] The system lacks the necessary resources to initialize another spin lock. - -[ENOMEM] Insufficient memory exists to initialize the lock. - - These functions shall not return an error code of EINTR. - - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/coverage.txt deleted file mode 100644 index 1576966f70..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_init/coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -This document defines the coverage for the pthread_spin_init() function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/1-1.c deleted file mode 100644 index a86723b3a0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/1-1.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_spin_lock(pthread_spinlock_t *lock) - * - * The function shall lock the spin lock referenced by lock. The calling thread - * shall acquire the lock if it is not held by another thread. Otherwise, the - * thread shall spin (that is, shall not return from the pthread_spin_lock()) - * until the lock becomes available. - * - * Steps: - * 1. Initialize a pthread_spinlock_t object 'spinlock' with - * pthread_spin_init() - * 2. Main thread lock 'spinlock', should get the lock - * 3. Create a child thread. The thread lock 'spinlock', should spin. - * 4. After child thread spin for 2 seconds, send SIGALRM to it. - * 5. Child thread check its status in the signal handler. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_spinlock_t spinlock; -volatile static int thread_state; - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 -#define GET_SPIN_LOCK 4 - -static void sig_handler() -{ - /* Just return */ - pthread_exit(0); - return; -} - -static void* fn_chld(void *arg) -{ - int rc = 0; - - struct sigaction act; - struct timespec ts; - thread_state = ENTERED_THREAD; - int cnt = 0; - - /* Unblock the SIGALRM signal for the thread */ - sigemptyset (&act.sa_mask); - sigaddset(&act.sa_mask, SIGALRM); - if (pthread_sigmask (SIG_UNBLOCK, &act.sa_mask, NULL)) - { - perror("thread: could not unblock SIGALRM\n"); - return (void *)PTS_UNRESOLVED; - } - - /* Set up child thread to handle SIGALRM */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - sigfillset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - - printf("thread: send SIGALRM to me after 2 secs\n"); - alarm(2); - - printf("thread: attempt spin lock\n"); - rc = pthread_spin_lock(&spinlock); - if(rc != 0) - { - printf("Test FAILED: thread failed to get spin lock,error code:%d\n" , rc); - pthread_exit((void*)PTS_FAIL); - } - - printf("thread: acquired spin lock\n"); - - thread_state = GET_SPIN_LOCK; - /* Wait 10 seconds for SIGALRM to be sent */ - while( cnt++ < 10) - { - ts.tv_sec = 1; - ts.tv_nsec = 0; - nanosleep(&ts, NULL); - } - - /* Shouldn't get here. If we do, it means that SIGALRM wasn't sent/received */ - printf("Error in thread: SIGALRM was not received/sent correctly, timedout after 10 secs of waiting.\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return NULL; -} - -int main() -{ - pthread_t child_thread; - void *value_ptr; - struct sigaction sa; - - /* Block the SIGALRM signal for main thread */ - sigemptyset (&sa.sa_mask); - sigaddset(&sa.sa_mask, SIGALRM); - if (pthread_sigmask (SIG_BLOCK, &sa.sa_mask, NULL)) - { - perror("main: could not block SIGALRM\n"); - return PTS_UNRESOLVED; - } - - if(pthread_spin_init(&spinlock, PTHREAD_PROCESS_PRIVATE) != 0) - { - perror("main: Error at pthread_spin_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt spin lock\n"); - - /* We should get the lock */ - if(pthread_spin_lock(&spinlock) != 0) - { - printf("Test FAILED: main cannot get spin lock when no one owns the lock\n"); - return PTS_FAIL; - } - - printf("main: acquired spin lock\n"); - - thread_state = NOT_CREATED_THREAD; - - printf("main: create thread\n"); - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error creating child thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution */ - if(pthread_join(child_thread, &value_ptr) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check the return value of the thread */ - if(thread_state == GET_SPIN_LOCK) - { - printf("Test FAILED: Child thread did not spin on spin lock when other thread holds the lock\n"); - exit(PTS_FAIL); - } - else if(thread_state == ENTERED_THREAD) - { - printf("thread: spins on spin lock\n"); - printf("Test PASSED\n"); - exit(PTS_PASS); - } - else - { - printf("Unexpected child thread state: %d\n", thread_state); - exit(PTS_UNRESOLVED); - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/1-2.c deleted file mode 100644 index 24e3c708ff..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/1-2.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_spin_lock(pthread_spinlock_t *lock) - * - * The function shall lock the spin lock referenced by lock. The calling thread - * shall acquire the lock if it is not held by another thread. Otherwise, the - * thread shall spin (that is, shall not return from the pthread_spin_lock()) - * until the lock becomes available. - * - * Steps: - * 1. Initialize a pthread_spinlock_t object 'spinlock' with - * pthread_spin_init() - * 2. Main thread lock 'spinlock', should get the lock - * 3. Create a child thread. The thread lock 'spinlock', should spin. - * 4. Main thread unlock 'spinlock' - * 5. Child thread should get 'spinlock' - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_spinlock_t spinlock; -volatile static int thread_state; - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_chld(void *arg) -{ - int rc = 0; - thread_state = ENTERED_THREAD; - - /* Lock the spinlock */ - printf("thread: attempt spin lock\n"); - rc = pthread_spin_lock(&spinlock); - if(rc != 0) - { - printf("Test FAILED: child failed to get spin lock,error code:%d\n" , rc); - exit(PTS_FAIL); - } - printf("thread: acquired spin lock\n"); - - /* Just some time between locking and unlocking */ - sleep(1); - - /* Unlock the spin lock */ - printf("thread: unlock spin lock\n"); - if(pthread_spin_unlock(&spinlock)) - { - printf("child: Error at pthread_spin_unlock()\n"); - exit(PTS_UNRESOLVED); - } - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - - pthread_t child_thread; - - /* Initialize spinlock */ - if(pthread_spin_init(&spinlock, PTHREAD_PROCESS_PRIVATE) != 0) - { - printf("main: Error at pthread_spin_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt spin lock\n"); - - /* We should get the lock */ - if(pthread_spin_lock(&spinlock) != 0) - { - printf("Test FAILED: main cannot get spin lock when no one owns the lock\n"); - return PTS_FAIL; - } - printf("main: acquired spin lock\n"); - - /* Initialize thread state */ - thread_state = NOT_CREATED_THREAD; - - /* Create thread */ - printf("main: create thread\n"); - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error creating child thread\n"); - return PTS_UNRESOLVED; - } - - cnt = 0; - /* Expect the child thread to spin on spin lock. Wait for 3 seconds. */ - do{ - sleep(1); - }while (thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - printf("Test FAILED: child thread did not spin on spin lock when other thread holds the lock\n"); - return PTS_FAIL; - } - else if(thread_state != ENTERED_THREAD) - { - printf("main: Unexpected thread state %d\n", thread_state); - return PTS_UNRESOLVED; - } - - printf("main: unlock spin lock\n"); - if(pthread_spin_unlock(&spinlock) != 0) - { - printf("main: Error at pthread_spin_unlock()\n"); - return PTS_UNRESOLVED; - } - - /* We expected the child get the spin lock and exit */ - cnt = 0; - do{ - sleep(1); - }while (thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: child thread did not get spin lock\n"); - return PTS_FAIL; - } - else if(thread_state != EXITING_THREAD) - { - printf("main: Unexpected thread state %d\n", thread_state); - return PTS_UNRESOLVED; - } - - /* Wait for thread to finish execution */ - if(pthread_join(child_thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Destroy the spinlock */ - if(pthread_spin_destroy(&spinlock) != 0) - { - printf("Error at pthread_spin_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/2-1.sh deleted file mode 100755 index 059da4c43b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - -# Upon successful completion, these functions shall return zero; -# otherwise, an error number shall be returned to indicate the error. - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/3-1.c deleted file mode 100644 index 51cce7b802..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/3-1.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_spin_lock(pthread_spinlock_t *lock) - * - * The pthread_spin_lock( ) function may fail if: - * [EDEADLK] The calling thread already holds the lock. - * - * This case will always pass. The thread might keep spin - * when re-lock the spin lock. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static void sig_handler() -{ - printf("main: interrupted by SIGALARM\n"); - printf("Test PASSED: *Note: Did not return EDEADLK when re-locking a spinlock already in use, but standard says 'may' fail\n"); - pthread_exit((void*)PTS_PASS); -} - - -int main() -{ - int rc; - pthread_spinlock_t spinlock; - struct sigaction act; - - /* Set up child thread to handle SIGALRM */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - sigfillset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - - - if(pthread_spin_init(&spinlock, PTHREAD_PROCESS_PRIVATE) != 0) - { - printf("main: Error at pthread_spin_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt spin lock\n"); - - /* We should get the lock */ - if(pthread_spin_lock(&spinlock) != 0) - { - printf("Test FAILED: main cannot get spin lock when no one owns the lock\n"); - return PTS_FAIL; - } - printf("main: acquired spin lock\n"); - - printf("main: send SIGALRM to me after 2 secs\n"); - alarm(2); - - printf("main: re-lock spin lock\n"); - rc = pthread_spin_lock(&spinlock); - - if(rc == EDEADLK) - { - printf("main: correctly got EDEADLK when re-locking the spin lock\n"); - printf("Test PASSED\n"); - } - else - { - printf("main: get return code: %d , %s\n", rc, strerror(rc)); - printf("Test PASSED: *Note: Did not return EDEADLK when re-locking a spinlock already in use, but standard says 'may' fail\n"); - } - - /* Unlock spinlock */ - pthread_spin_unlock(&spinlock); - - /* Destroy spinlock */ - pthread_spin_destroy(&spinlock); - - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/3-2.c deleted file mode 100644 index adf71d98b7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/3-2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_spin_lock(pthread_spinlock_t *lock) - * - * 35543 These functions may fail if: - * 35544 [EINVAL] The value specified by lock does not - * refer to an initialized spin lock object. - * - * This case will always pass. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int rc; - -static void sig_handler() -{ - printf("main: interrupted by SIGALARM\n"); - if(rc == EINVAL) - { - printf("main: correctly got EINVAL\n"); - printf("Test PASSED\n"); - } - else - { - printf("main: get return code: %d, %s\n", rc, strerror(rc)); - printf("Test PASSED: *Note: Did not return EINVAL when attempting to lock an uninitialized spinlock, but standard says 'may' fail\n"); - } - - exit(PTS_PASS); -} - -int main() -{ - pthread_spinlock_t spinlock; - struct sigaction act; - - /* Set up child thread to handle SIGALRM */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - sigfillset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - - printf("main: attemp to lock an un-initialized spin lock\n"); - - printf("main: Send SIGALRM to me after 5 secs\n"); - alarm(5); - - /* Attempt to lock an uninitialized spinlock */ - rc = pthread_spin_lock(&spinlock); - - /* If we get here, call sig_handler() to check the return code of - * pthread_spin_lock() */ - sig_handler(); - - /* Unlock spinlock */ - pthread_spin_unlock(&spinlock); - - /* Destroy spinlock */ - pthread_spin_destroy(&spinlock); - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/assertions.xml deleted file mode 100644 index 4c829bc588..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/assertions.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - The function shall lock the spin lock referenced by lock. The calling thread - shall acquire the lock if it is not held by another thread. Otherwise, the - thread shall spin (that is, shall not return from the pthread_spin_lock()) - until the lock becomes available. - - - - Upon successful completion, these functions shall return zero; otherwise, an error number - shall be returned to indicate the error. - - - - The pthread_spin_lock( ) function may fail if: - - [EDEADLK] The calling thread already holds the lock. - [EINVAL] The value specified by lock does not refer to an initialized spin lock object. - - These functions shall not return an error code of EINTR. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/coverage.txt deleted file mode 100644 index 7aeb561903..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_lock/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_spin_lock() function: - -Assertion Tested? -1 YES -2 YES -3 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/1-1.c deleted file mode 100644 index 8b29a80e02..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/1-1.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_spin_trylock(pthread_spinlock_t *lock) - * - * The function shall lock the spin lock referenced by 'lock' if it is not - * held by any thread. Otherwise, the function shall fail. - * - * Steps: - * 1. Initialize a pthread_spinlock_t object 'spinlock' with - * pthread_spin_init() - * 2. Main thread lock 'spinlock', using pthread_spin_trylock(), - * should get the lock successfully. - * 3. Create a child thread. The thread lock 'spinlock', - * using pthread_spin_trylock(), shall fail with EBUSY. - * 4. If the child spins on the lock, after 2 seconds, send SIGALRM to it. - * 5. Child thread check its state in the signal handler. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_spinlock_t spinlock; -volatile static int thread_state; -int rc; - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void sig_handler() -{ - if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: thread incorrectly spins on trylock\n"); - exit(PTS_FAIL); - } - else - { - printf("UNRESOLVED: Unexpected child thread state %d\n", thread_state); - exit(PTS_UNRESOLVED); - } -} - -static void* fn_chld(void *arg) -{ - rc = 0; - - struct sigaction act; - thread_state = ENTERED_THREAD; - - /* Set up child thread to handle SIGALRM */ - act.sa_flags = 0; - act.sa_handler = sig_handler; - sigfillset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - - /* thread: send SIGALRM to me after 2 seconds in case in spins on trylock */ - alarm(2); - - printf("thread: attempt trylock\n"); - rc = pthread_spin_trylock(&spinlock); - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t child_thread; - - if(pthread_spin_init(&spinlock, PTHREAD_PROCESS_PRIVATE) != 0) - { - printf("main: Error at pthread_spin_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt to trylock\n"); - - /* We should get the lock */ - if(pthread_spin_trylock(&spinlock) != 0) - { - printf("Test FAILED: main cannot get spin lock when no one owns the lock\n"); - return PTS_FAIL; - } - printf("main: acquired spin lock\n"); - - thread_state = NOT_CREATED_THREAD; - printf("main: create thread\n"); - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error creating child thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution */ - pthread_join(child_thread, NULL); - - /* Check the return code of pthread_spin_trylock */ - if(rc != EBUSY) - { - printf("Test FAILED: pthread_spin_trylock should return EBUSY, instead got error code:%d\n" , rc); - return PTS_FAIL; - } - - printf("thread: correctly returned EBUSY on trylock\n"); - printf("Test PASSED\n"); - return PTS_PASS; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/2-1.sh deleted file mode 100755 index efa9be1433..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -#If successful, the pthread_spin_trylock( ) function shall return zero; otherwise, an error -#number shall be returned to indicate the error. - - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/3-1.sh deleted file mode 100755 index 8b4989d207..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/3-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -#The pthread_spin_trylock( ) function shall fail if: -#[EBUSY] A thread currently holds the lock. - - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/4-1.c deleted file mode 100644 index 69ffc78e4e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/4-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_spin_trylock(pthread_spinlock_t *lock) - * - * Note: This case will always pass - * - * These functions may fail if: - * [EINVAL] The value specified by lock does not refer to an initialized spin lock object. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - - pthread_spinlock_t spinlock; - int rc; - - /* attemp to lock an uninitalized spin lock */ - - rc = pthread_spin_trylock(&spinlock); - if(rc == EINVAL) - { - printf("Correctly got EINVAL at pthread_spin_trylock()\n"); - printf("Test PASSED\n"); - } - else - { - printf("Expected EINVAL, but get return code: %d,%s\n", rc, strerror(rc)); - printf("Test PASSED: *Note: Returned incorrect value, but standard says 'may' fail\n"); - } - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/assertions.xml deleted file mode 100644 index 56e2d49b57..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/assertions.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - pthread_spin_trylock( ) function shall lock the spin lock referenced by lock if it is not - held by any thread. Otherwise, the function shall fail. - - - - Upon successful completion, these functions shall return zero; otherwise, an error number shall - be returned to indicate the error. - - - - The pthread_spin_trylock( ) function shall fail if: - [EBUSY] A thread currently holds the lock. - - - - These functions may fail if: - [EINVAL] The value specified by lock does not refer to an initialized spin lock object. - - These functions shall not return an error code of EINTR. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/coverage.txt deleted file mode 100644 index b6c8ef4eed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_trylock/coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -This document defines the coverage for the pthread_spin_trylock() function: - -Assertion Tested? -1 YES -2 YES -3 YES -4 YES - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/1-1.c deleted file mode 100644 index 95bdead346..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/1-1.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_spin_unlock(pthread_spinlock_t *lock) - * - * The function shall release the spin lock referenced by 'lock' which - * was locked via the pthread_spin_lock() or pthread_spin_trylock(). - * - * Steps: - * 1. Initialize a pthread_spinlock_t object 'spinlock' with - * pthread_spin_init() - * 2. Main thread lock 'spinlock' with pthread_spin_lock(), should get the lock - * 3. Main thread unlock 'spinlock' - * 4. Create a child thread. The thread try to lock 'spinlock', with - * pthread_spin_trylock(), should get the lock. - * 5. Child thread unlock - * 6. Main thread lock 'spinlock', using pthread_spin_trylock(), should get - * lock - * 7. Main thread unlock 'spinlock' - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_spinlock_t spinlock; -volatile static int thread_state; - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_chld(void *arg) -{ - int rc = 0; - thread_state = ENTERED_THREAD; - - printf("thread: attempt trylock\n"); - rc = pthread_spin_trylock(&spinlock); - if(rc != 0) - { - printf("Test FAILED: thread failed to get spin lock," - "Error code:%d\n" , rc); - exit(PTS_FAIL); - } - printf("thread: acquired spin lock\n"); - - printf("thread: unlock spin lock\n"); - if(pthread_spin_unlock(&spinlock)) - { - printf("thread: Error at pthread_spin_unlock()\n"); - exit(PTS_FAIL); - } - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int rc; - - pthread_t child_thread; - - if(pthread_spin_init(&spinlock, PTHREAD_PROCESS_PRIVATE) != 0) - { - printf("main: Error at pthread_spin_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt spin lock\n"); - - /* We should get the lock */ - if(pthread_spin_lock(&spinlock) != 0) - { - printf("main: cannot get spin lock when no one owns the lock\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired spin lock\n"); - - printf("main: unlock spin lock\n"); - rc = pthread_spin_unlock(&spinlock); - if(rc != 0) - { - printf("main: Error at pthread_spin_unlock()\n"); - return PTS_FAIL; - } - - thread_state = NOT_CREATED_THREAD; - printf("main: create thread\n"); - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution */ - if(pthread_join(child_thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - return PTS_UNRESOLVED; - } - - printf("main: try to lock again when thread unlocked\n"); - if(pthread_spin_trylock(&spinlock) != 0) - { - printf("main: Should get spin lock\n"); - return PTS_FAIL; - } - - printf("main: acquired spin lock\n"); - printf("main: unlock spin lock\n"); - if(pthread_spin_unlock(&spinlock) != 0) - { - printf("Test FAILED: main: Error at pthread_spin_unlock()\n"); - return PTS_FAIL; - } - - if(pthread_spin_destroy(&spinlock) != 0) - { - printf("Error at pthread_spin_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/1-2.c deleted file mode 100644 index c826442159..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/1-2.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_spin_unlock(pthread_spinlock_t *lock) - * - * The function shall release the spin lock referenced by 'lock' which - * was locked via the pthread_spin_lock() or pthread_spin_trylock(). - * - * CAUTION: If setting the priority of the process running this case - * higher than other process in the system, the system might become - * unresponsive. The child will spin on the spinlock, no other process - * can interupt it. - * - * Steps: - * 1. Initialize a pthread_spinlock_t object 'spinlock' with - * pthread_spin_init() - * 2. Main thread lock 'spinlock', should get the lock - * 3. Create a child thread. The thread lock 'spinlock' with pthread_spin_lock() - * should spin on the lock. - * 4. Main thread unlock 'spinlock' - * 5. Child thread should get 'spinlock' - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_spinlock_t spinlock; -volatile static int thread_state; - -#define NOT_CREATED_THREAD 1 -#define ENTERED_THREAD 2 -#define EXITING_THREAD 3 - -static void* fn_chld(void *arg) -{ - int rc = 0; - thread_state = ENTERED_THREAD; - - printf("thread: attempt spin lock\n"); - rc = pthread_spin_lock(&spinlock); - if(rc != 0) - { - printf("Test FAILED: thread failed to get spin lock error code:%d\n" , rc); - exit(PTS_FAIL); - } - printf("thread: acquired spin lock\n"); - - sleep(1); - - printf("thread: unlock spin lock\n"); - if(pthread_spin_unlock(&spinlock)) - { - printf("Test FAILED: Error at pthread_spin_unlock()\n"); - exit(PTS_FAIL); - } - - thread_state = EXITING_THREAD; - pthread_exit(0); - return NULL; -} - -int main() -{ - int cnt = 0; - - pthread_t child_thread; - - if(pthread_spin_init(&spinlock, PTHREAD_PROCESS_PRIVATE) != 0) - { - printf("main: Error at pthread_spin_init()\n"); - return PTS_UNRESOLVED; - } - - printf("main: attempt spin lock\n"); - - /* We should get the lock */ - if(pthread_spin_lock(&spinlock) != 0) - { - printf("Error: main cannot get spin lock when no one owns the lock\n"); - return PTS_UNRESOLVED; - } - printf("main: acquired spin lock\n"); - - thread_state = NOT_CREATED_THREAD; - printf("main: create thread\n"); - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error creating child thread\n"); - return PTS_UNRESOLVED; - } - - cnt = 0; - /* Expect the child thread to spin on spin lock */ - do{ - sleep(1); - }while (thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == EXITING_THREAD) - { - printf("Test FAILED: child thread did not spin on spin lock when other thread holds the lock\n"); - return PTS_FAIL; - } - else if(thread_state != ENTERED_THREAD) - { - printf("main: Unexpected thread state %d\n", thread_state); - return PTS_UNRESOLVED; - } - - printf("main: unlock spin lock\n"); - if(pthread_spin_unlock(&spinlock) != 0) - { - printf("Test FAILED: main: Error at pthread_spin_unlock()\n"); - return PTS_FAIL; - } - - /* We expected the child get the spin lock and exit */ - cnt = 0; - do{ - sleep(1); - }while (thread_state != EXITING_THREAD && cnt++ < 3); - - if(thread_state == ENTERED_THREAD) - { - printf("Test FAILED: child thread did not get spin lock\n"); - return PTS_FAIL; - } - else if(thread_state != EXITING_THREAD) - { - printf("main: Unexpected thread state %d\n", thread_state); - return PTS_UNRESOLVED; - } - - if(pthread_join(child_thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - return PTS_UNRESOLVED; - } - - if(pthread_spin_destroy(&spinlock) != 0) - { - printf("Error at pthread_spin_destroy()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/2-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/2-1.sh deleted file mode 100755 index cc03fffbe4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/2-1.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2002, Intel Corporation. All rights reserved. -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - -#If successful, the pthread_spin_unlock( ) function shall return zero; otherwise, an error number -#shall be returned to indicate the error. - - -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1. See output for status" -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/3-1.c deleted file mode 100644 index 06cb6664b2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/3-1.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test pthread_spin_unlock(pthread_spinlock_t *lock) - * - * This case will always PASS. - * - * The functions may fail if: - * The pthread_spin_unlock( ) function may fail if: - * [EPERM] The calling thread does not hold the lock. - * - * Steps: - * 1. Create a thread that will initialize and lock a spinlock - * 2. Main will try to unlock the spinlock (it doesn't hold the lock) - * 3. Check the return code to see if it returns [EPERM]. - * - * Note: This test will always pass since the standard specifies 'may' fail. - * - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -static pthread_spinlock_t spinlock; -volatile static int sem; - -#define INTHREAD 0 -#define INMAIN 1 - -static void* fn_chld(void *arg) -{ - int rc = 0; - - /* Initialize spin lock */ - if(pthread_spin_init(&spinlock, PTHREAD_PROCESS_PRIVATE) != 0) - { - printf("main: Error at pthread_spin_init()\n"); - exit(PTS_UNRESOLVED); - } - - /* Lock the spinlock */ - printf("thread: attempt spin lock\n"); - rc = pthread_spin_lock(&spinlock); - if(rc != 0) - { - printf("Error: thread failed to get spin lock error code:%d\n" , rc); - exit(PTS_UNRESOLVED); - } - printf("thread: acquired spin lock\n"); - - /* Wait for main to try and unlock this spinlock */ - sem = INMAIN; - while(sem == INMAIN) - sleep(1); - - /* Cleanup just in case */ - pthread_spin_unlock(&spinlock); - - if(pthread_spin_destroy(&spinlock) != 0) - { - printf("Error at pthread_spin_destroy()"); - exit(PTS_UNRESOLVED); - } - - pthread_exit(0); - return NULL; -} - -int main() -{ - int rc; - pthread_t child_thread; - - sem = INTHREAD; - - /* Create a thread that will initialize and lock a spinlock */ - printf("main: create thread\n"); - if(pthread_create(&child_thread, NULL, fn_chld, NULL) != 0) - { - printf("main: Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to lock the spinlock */ - while(sem == INTHREAD) - sleep(1); - - printf("main: attempt to unlock a spinlock that we don't own\n"); - rc = pthread_spin_unlock(&spinlock); - if(rc != 0) - { - printf("main: Error at pthread_spin_unlock()\n"); - return PTS_FAIL; - } - - /* Tell thread that we're done attempting to unlock the spinlock */ - sem = INTHREAD; - - /* Wait for thread to end execution */ - if(pthread_join(child_thread, NULL) != 0) - { - printf("main: Error at pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Test to see the return code of pthread_spin_unlock */ - if( rc == EPERM) - { - printf("main: correctly got EPERM when unlocking a spinlock we didn't have permission to unlock\n"); - printf("Test PASSED\n"); - } - else - { - printf("main: got return code :%d\n", rc); - printf("Test PASSED: *Note: Did not return EPERM when unlocking a spinlock it does not have a lock on, but standard says 'may' fail\n"); - } - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/assertions.xml deleted file mode 100644 index e965b01775..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/assertions.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - The pthread_spin_unlock( ) function shall release the spin lock referenced by lock which was - locked via the pthread_spin_lock( ) or pthread_spin_trylock( ) functions. - - - - Upon successful completion, the pthread_spin_unlock( ) function shall return zero; otherwise, - an error number shall be returned to indicate the error. - - - - The pthread_spin_unlock( ) function may fail if: - [EINVAL] An invalid argument was specified. - [EPERM] The calling thread does not hold the lock. - - These functions shall not return an error code of EINTR. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/coverage.txt deleted file mode 100644 index 1d2df5936a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_spin_unlock/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -This document defines the coverage for the pthread_spin_unlock() function: - -Assertion Tested? -1 YES -2 YES -3 YES "May" assertion, always pass - -NOTE: diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/1-1.c deleted file mode 100644 index f9992bda68..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/1-1.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_testcancel - * Atomically sets the cancelability type to 'type' and returns the old - * cancelability type in the location referenced by 'oldtype'. - * 'state' can either be PTHREAD_CANCEL_DEFERRED, or PTHREAD_CANCEL_ASYNCHRONOUS. - * - * Test when a thread is PTHREAD_CANCEL_DEFERRED - * - * STEPS: - * 1. Setup a mutex and lock it in main() - * 2. Create a thread. - * 3. In the thread function, set the type to PTHREAD_CANCEL_DEFERRED - * 4. Setup a cleanup handler for the thread. - * 5. Make the thread block on the locked mutex - * 6. Send out a thread cancel request to the new thread, and unlock the mutex allowing the - * thread to continue execution. - * 7. If the cancel request was honored immediately, the - * cleanup handler would have been executed, setting the cleanup_flag to -1, making the - * test fail. - * 8. If not, the thread will continue execution, pop the cleanup handler, set the cleanup - * flag to 1, and call the cancelation point pthread_testcancel(). The test will pass. - * 9. If the thread did not cancel at the cancelation point like it was supposed to, the thread - * will continue execution and set the cleanup_flag to -2, failing the test. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */ -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */ - - -/* Cleanup function that the thread executes when it is canceled. So if - * cleanup_flag is 1, it means that the thread was canceled. */ -void a_cleanup_func() -{ - cleanup_flag=-1; - return; -} - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); - - pthread_cleanup_push(a_cleanup_func,NULL); - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Lock the mutex. It should have already been locked in main, so the thread - * should block. */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - pthread_exit((void*)PTS_UNRESOLVED); - return (void*)PTS_UNRESOLVED; - } - - /* Should get here if the cancel request was deffered. */ - pthread_cleanup_pop(0); - cleanup_flag=1; - - /* Cancelation point. Cancel request should not be honored here. */ - pthread_testcancel(); - - /* Should not get here if the cancel request was honored at the cancelation point - * pthread_testcancel(). */ - cleanup_flag=-2; - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cleanup_flag=0; - - /* Lock the mutex */ - if(pthread_mutex_lock(&mutex) != 0) - { - perror("Error in pthread_mutex_lock()\n"); - return PTS_UNRESOLVED; - } - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=INMAIN.) */ - while(sem1==INTHREAD) - sleep(1); - - /* Send cancel request to the thread. */ - if(pthread_cancel(new_th) != 0) - { - printf("Test FAILED: Couldn't cancel thread\n"); - return PTS_FAIL; - } - - /* Cancel request has been sent, unlock the mutex */ - if(pthread_mutex_unlock(&mutex) != 0) - { - perror("Error in pthread_mutex_unlock()\n"); - return PTS_UNRESOLVED; - } - - /* Wait 'till the thread has been canceled or has ended execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* This means that the cleanup function wasn't called, so the cancel - * request was not honord immediately like it should have been. */ - if(cleanup_flag == -1) - { - perror("Cancel request was not deferred.\n"); - return PTS_UNRESOLVED; - } - - if(cleanup_flag == -2) - { - printf("Test FAILED:pthread_testcancel() not treated as a cancelation point.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/2-1.c deleted file mode 100644 index b94917092d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/2-1.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test pthread_cancelstate - * It will have no affect on the calling thread if cancelability is disabled. - * - * STEPS: - * 1. Create a thread. - * 2. In the thread function, set the state to - * PTHREAD_CANCEL_DISABLE and the cancel_flag to -1. - * 3. Send out a thread cancel request to the new thread - * 4. If the cancel request was honored, the cancel_flag will remain -1. - * 5. If not, the thread will continue until the end of execution, cancel_flag will be set to 1 - * and,therefore passing the test. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ -int cancel_flag; - -/* Function that the thread executes upon its creation */ -void *a_thread_func() -{ - /* Set cancel state to DISABLE, meaning it shouldn't honor any cancel requests. */ - pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); - - cancel_flag=-1; - - /* Indicate to main() that the thread has been created. */ - sem1=INMAIN; - - /* Wait until main() has sent out a cancel request, meaning until it - * sets sem1==INTHREAD. */ - while(sem1==INMAIN) - sleep(1); - - /* If the thread incorrectly honors the cancel request, then the cancel_flag will - * remain -1. If it contiues on with the thread execution, then the cancel_flag - * will be 1, and therefore passing this test. */ - pthread_testcancel(); - - /* Should reach here if the thread correctly ignores the cancel - * request. */ - cancel_flag=1; - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Initializing values */ - sem1=INTHREAD; - cancel_flag=0; - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Make sure thread is created before we cancel it. (wait for - * a_thread_func() to set sem1=INMAIN.) */ - while(sem1==INTHREAD) - sleep(1); - - if(pthread_cancel(new_th) != 0) - { - perror("Error sending cancel request\n"); - return PTS_UNRESOLVED; - } - - /* Indicate to the thread function that the thread cancel request - * has been sent to it. */ - sem1=INTHREAD; - - /* Wait for thread to end execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* This means that the cancel request was honored rather than ignored, and - * the test fails. */ - if(cancel_flag <= 0) - { - printf("Test FAILED: pthread_testcancel() was honored even though cancelability was disabled.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/assertions.xml deleted file mode 100644 index 51ef3ea8be..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/assertions.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - The function - - void pthread_testcancel(void); - - It will create a cancelation point in the calling thread. - - - It will have no affect on the calling thread if cancelability is disabled. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/coverage.txt deleted file mode 100644 index 8f1198b314..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_testcancel/coverage.txt +++ /dev/null @@ -1,6 +0,0 @@ -This document defines the coverage for the pthread_testcancel function: - -Assertion Tested? -1 YES -2 YES - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/1-1.c deleted file mode 100644 index cd47608e0d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/1-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the raise() function shall send the signal - * to the executing process. - * 1) Set up a signal handler for the signal that says we have caught the - * signal. - * 2) Raise the signal. - * 3) If signal handler was called, test passed. - * This test is only performed on one signal. All other signals are - * considered to be in the same equivalence class. - */ - -#include -#include -#include -#include "posixtest.h" - -#define SIGTOTEST SIGABRT - -void handler(int signo) -{ - printf("Caught signal being tested!\n"); - printf("Test PASSED\n"); - exit(0); -} - -int main() -{ - struct sigaction act; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGTOTEST, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - if (raise(SIGTOTEST) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_FAIL; - } - - printf("Should have exited from signal handler\n"); - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/1-2.c deleted file mode 100644 index 64c37d390c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/1-2.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the raise() function shall send the signal - * to the executing process when the executing process is a child - * process. - * 1) Set up a signal handler for a signal in the parent process. - * This handler returns failure if called. - * 2) Fork a child process. - * 2) In the child process: - * 3) Set up a signal handler for the same signal as in the parent process. - * This handler returns success if called. - * 4) Raise the signal. - * 5) If signal handler was called, return 1 (so WEXITSTATUS can test - * for success). - * 6) In parent, if 1 was received, test passed. - * This test is only performed on one signal. All other signals are - * considered to be in the same equivalence class. - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SIGTOTEST SIGABRT - -void parenthandler(int signo) -{ - printf("Caught signal from parent!\n"); - exit(-1); -} - -void childhandler(int signo) -{ - printf("Caught signal from child!\n"); - exit(0); -} - -int main() -{ - struct sigaction parentact; - - parentact.sa_handler=parenthandler; - parentact.sa_flags=0; - if (sigemptyset(&parentact.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGTOTEST, &parentact, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - - if (fork() == 0) { - /* child here */ - struct sigaction childact; - - childact.sa_handler=childhandler; - childact.sa_flags=0; - if (sigemptyset(&childact.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGTOTEST, &childact, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - if (raise(SIGTOTEST) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_FAIL; - } - - printf("Should have exited from signal handler\n"); - return PTS_FAIL; - } else { - /* parent here */ - int i; - - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - if (!WEXITSTATUS(i)) { - printf("Child exited normally\n"); - printf("Test PASSED\n"); - return PTS_PASS; - } - else { - printf("Child did not exit normally.\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - printf("Should not make it here.\n"); - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/10000-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/10000-1.c deleted file mode 100644 index 1db105b856..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/10000-1.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * General API test of the raise() function. - * Test calling raise with the following values: - * - MINIMUM valid (in this case SIGABRT signal) - * - MAXIMUM valid (in this case SIGXFSZ signal) - * Item with POSIX default action as T - SIGALRM - * Item with POSIX default action as A - (done - SIGABRT) - * Item with POSIX default action as I - SIGCHLD - * Item with POSIX default action as S - SIGTSTP - * Item with POSIX default action as C - SIGCONT - * - * Error conditions: - * Boundary values for int - * MIN INT = INT32_MIN - * MAX INT = INT32_MAX - * MIN INT - 1 = 2147483647 (this is what gcc will set to) - * MAX INT + 1 = -2147483647 (this is what gcc will set to) - * unassigned value = -1073743192 (ex. of what gcc will set to) - * unassigned value = 1073743192 (ex. of what gcc will set to) - * - * Steps: - * 1) Set up signal handlers for all valid signals - * 2) Call all valid signals and verify they are received. - * 3) Call all invalid signals and verify raise() returns 0 and sets - * errno to EINVAL. - * - * Note: This test case maps to multiple assertions: 1, 2 (implicitly), - * 5, 6, 7, so it was given a large number as a file name. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NUMVALIDTESTS 6 -#define NUMINVALIDTESTS 6 -static int valid_tests[NUMVALIDTESTS] = { - SIGABRT, SIGXFSZ, SIGALRM, SIGCHLD, SIGTSTP, SIGCONT -}; - -static int invalid_tests[NUMINVALIDTESTS] = { - INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192, 1073743192 -}; - -void handler(int signo) -{ - printf("Caught signal being tested!\n"); -} - -int main() -{ - int i; - int failure = 0; - struct sigaction act; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - - for (i = 0; i < NUMVALIDTESTS; i++) { - if (sigaction(valid_tests[i], &act, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - } - - for (i = 0; i < NUMVALIDTESTS; i++) { - if (raise(valid_tests[i]) != 0) { - printf("Could not raise signal being tested\n"); - failure = 1; - } - } - - for (i = 0; i < NUMINVALIDTESTS; i++) { - if (raise(invalid_tests[i]) == 0) { - printf("Received success raising an invalid signal\n"); - failure = 1; - } else { - if (EINVAL == errno) { - printf("errno correctly set\n"); - } else { - printf("errno not correctly set\n"); - failure = 1; - } - } - } - - if (failure) { - printf("At least one test FAILED -- see above\n"); - return PTS_FAIL; - } else { - printf("All tests PASSED\n"); - return PTS_PASS; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/2-1.c deleted file mode 100644 index 9379cbd5b6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/2-1.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the the raise() function does not return until after the - * signal handler it calls returns. - * This test is only performed on one signal. All other signals are - * considered to be in the same equivalence class. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SIGTOTEST SIGABRT - -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Declare a global variable to keep track of where we were. - */ -#define BEFOREHANDLER 1 -#define INHANDLER 2 -#define LEAVINGHANDLER 3 -int globalStatus = BEFOREHANDLER; - -void handler(int signo) -{ - globalStatus = INHANDLER; - printf("Caught signal being tested!\n"); - printf("Sleeping...\n"); - sleep(2); - globalStatus = LEAVINGHANDLER; -} - -int main() -{ - struct sigaction act; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGTOTEST, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - if (raise(SIGTOTEST) != 0) { - printf("Could not raise signal being tested\n"); - return PTS_FAIL; - } - - if ( (INHANDLER == globalStatus) || - (BEFOREHANDLER == globalStatus) ) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (LEAVINGHANDLER == globalStatus) { - printf ("Test PASSED\n"); - return PTS_PASS; - } - - printf("Should not reach here\n"); - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/4-1.c deleted file mode 100644 index 510f08e1d4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/4-1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Assertion 4 - that raise() is equivalent to kill(getpid(), sig); is - * essentially tested implicitly via assertion 1. - * This test is the reverse test case: Test assertion 1, but replace - * raise() with kill(getpid(), sig). It should pass if assertion 1 - * passes. - * 1) Set up a signal handler for the signal that says we have caught the - * signal. - * 2) Call kill(getpid(), ) - * 3) If signal handler was called, test passed. - * This test is only performed on one signal. All other signals are - * considered to be in the same equivalence class. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SIGTOTEST SIGABRT - -void handler(int signo) -{ - printf("Caught signal being tested!\n"); - printf("Test PASSED\n"); - exit(0); -} - -int main() -{ - struct sigaction act; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGTOTEST, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - if (kill(getpid(), SIGTOTEST) != 0) { - printf("Could not call kill\n"); - return PTS_UNRESOLVED; - } - - printf("Should have exited from signal handler\n"); - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/6-1.c deleted file mode 100644 index c69edbb7a0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/6-1.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the raise() function sends a non-zero value on - * unsuccessful completion. - * 1) Raise an invalid signal. - * 2) Verify a non-zero value is returned. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - if (raise(10000) == 0) { - printf("Incorrectly returned 0\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/7-1.c deleted file mode 100644 index 674eac3528..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/7-1.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test that the raise() sets errno to indicate the error on - * unsuccessful completion. - * 1) Raise an invalid signal. - * 2) Verify a non-zero value is returned. - * 3) Verify errno is set to EINVAL. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - if (raise(10000) == 0) { - printf("Incorrectly returned 0\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - - if (EINVAL == errno) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("errno not correctly set\n"); - return PTS_FAIL; - } - -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/assertions.xml deleted file mode 100644 index 38d95426ed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/assertions.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - The raise() function sends signal sig to the thread or process currently - executing. - - - If the signal causes a signal handler to be called, the raise() function - will wait for the signal handler to return before it returns. - - - If the implementation supports Threads, then raise() is equivalent to: - pthread_kill(pthread_self(), sig); - - - If the implementation does not support threads, then raise() is - equivalent to: - kill(getpid(), sig); - - - Upon successful completion, raise() returns 0. - - - Upon unsuccessful completion, raise() returns a non-zero value. - - - Upon unsuccessful completion, raise() sets errno to indicate the - error. The only defined value of errno for raise() is EINVAL if the - value of the sig argument is an invalid signal number. - - - Multiple assertions tested. - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/coverage.txt deleted file mode 100644 index 5768a703d6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/raise/coverage.txt +++ /dev/null @@ -1,16 +0,0 @@ -The current coverage of this suite is limited to testing raise() on processes. - -The threads items that could be added later are: - -- Test assertion 1 for threads. -- Test assertion 3. -This document defines the coverage for function raise(). - -Assertion Covered? -1 YES, only covering processes, not threads -2 YES -3 WON'T test for now since it is specific to threads -4 YES -5 IMPLICITLY tested by testing assertion 1 -6 YES -7 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-1.c deleted file mode 100644 index 1a76956289..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_get_priority_max() returns the maximum value on - * success for SCHED_RR policy. - */ -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_get_priority_max(SCHED_RR); - - if(result != -1 && errno == 0 ) { - printf("The maximum priority for policy SCHED_RR is %i.\n", - result); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("An error occurs"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-2.c deleted file mode 100644 index f1247afa8e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-2.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_get_priority_max() returns the maximum value on - * success for SCHED_FIFO policy. - */ -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_get_priority_max(SCHED_FIFO); - - if(result != -1 && errno == 0 ) { - printf("The maximum priority for policy SCHED_FIFO is %i.\n", - result); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("An error occurs"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-3.c deleted file mode 100644 index b35322fc5e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-3.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_get_priority_max() returns the maximum value on - * success for SCHED_SPORADIC policy. - */ -#include -#include -#include -#include -#include "posixtest.h" - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1)||defined(_POSIX_THREAD_SPORADIC_SERVER)&&(_POSIX_THREAD_SPORADIC_SERVER != -1) - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_get_priority_max(SCHED_SPORADIC); - - if(result != -1 && errno == 0 ) { - printf("The maximum priority for policy SCHED_SPORADIC is %i.\n", - result); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("An error occurs"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-4.c deleted file mode 100644 index 2deec04c07..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/1-4.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_get_priority_max() returns the maximum value on - * success for SCHED_OTHER policy. - */ -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_get_priority_max(SCHED_OTHER); - - if(result != -1 && errno == 0 ) { - printf("The maximum priority for policy SCHED_OTHER is %i.\n", - result); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("An error occurs"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/2-1.c deleted file mode 100644 index a27a8ffb71..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/2-1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_get_priority_max() returns -1 on failure. - */ -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_get_priority_max(-1); - - if(result == -1 && errno == EINVAL ) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if (result != -1) { - printf("did no returned -1.\n"); - return PTS_FAIL; - } - - if (errno != EINVAL) { - perror("error is not EINVAL"); - return PTS_FAIL; - } else { - printf("Unresolved test error\n"); - return PTS_UNRESOLVED; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/3-1.sh deleted file mode 100755 index b312f4e229..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/3-1.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Test that sched_get_priority_max() sets errno == EINVAL if policy is not a -# valid policy. -# This is tested implicitly via assertion 2. - -echo "Tested implicitly via assertion 2." -exit 0 - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/assertions.xml deleted file mode 100644 index e73f1aff90..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/assertions.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - sched_get_priority_max() returns the maximum priority value on success - - - sched_get_priority_max() returns -1 on failure - - - sched_get_priority_max() sets errno == EINVAL if policy is not a valid policy - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/coverage.txt deleted file mode 100644 index 56df8c651b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_max/coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES -3 YES \ No newline at end of file diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-1.c deleted file mode 100644 index dd2b52b36c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_get_priority_min() returns the minimum value on - * success for SCHED_RR policy. - */ -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_get_priority_min(SCHED_RR); - - if(result != -1 && errno == 0 ) { - printf("The minimum priority for policy SCHED_RR is %i.\n", - result); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("An error occurs"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-2.c deleted file mode 100644 index bff3688aa1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-2.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_get_priority_min() returns the appropriate minimum value on - * success for SCHED_FIFO policy. - */ -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_get_priority_min(SCHED_FIFO); - - if(result != -1 && errno == 0 ) { - printf("The minimum priority for policy SCHED_FIFO is %i.\n", - result); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("An error occurs"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-3.c deleted file mode 100644 index d64a522c1b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-3.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_get_priority_min() returns the appropriate minimum value on - * success for SCHED_SPORADIC policy. - */ -#include -#include -#include -#include -#include "posixtest.h" - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1)||defined(_POSIX_THREAD_SPORADIC_SERVER)&&(_POSIX_THREAD_SPORADIC_SERVER != -1) - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_get_priority_min(SCHED_SPORADIC); - - if(result != -1 && errno == 0 ) { - printf("The minimum priority for policy SCHED_SPORADIC is %i.\n", - result); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("An error occurs"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-4.c deleted file mode 100644 index de5bb5f61b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/1-4.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_get_priority_min() returns the appropriate minimum value on - * success for SCHED_OTHER policy. - */ -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_get_priority_min(SCHED_OTHER); - - if(result != -1 && errno == 0 ) { - printf("The minimum priority for policy SCHED_OTHER is %i.\n", - result); - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("An error occurs"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/2-1.c deleted file mode 100644 index 41717eb9a6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/2-1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_get_priority_min() returns -1 on failure - */ -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_get_priority_min(-1); - - if(result == -1 && errno == EINVAL ) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if (result != -1) { - printf("did not returned -1.\n"); - return PTS_FAIL; - } - - if (errno != EINVAL) { - perror("error is not EINVAL"); - return PTS_FAIL; - } else { - printf("Unresolved test error\n"); - return PTS_UNRESOLVED; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/3-1.sh deleted file mode 100755 index 16a31eefe2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/3-1.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Test that sched_get_priority_min() sets errno == EINVAL if policy is not a -# valid policy -# This is tested implicitly via assertion 2. - -echo "Tested implicitly via assertion 2." -exit 0 - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/assertions.xml deleted file mode 100644 index f1416529e5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/assertions.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - sched_get_priority_min() returns the minimum priority value on success - - - sched_get_priority_min() returns -1 on failure - - - sched_get_priority_min() sets errno == EINVAL if policy is not a valid - policy - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/coverage.txt deleted file mode 100644 index ed258368f0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_get_priority_min/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES max and min priorities are taken from the system (AIX) - only tested for SCHED_FIFO, SCHED_RR and SCHED_OTHER policy - speculative for AIX (FIFO2, FIFO3, FIFO4) -2 YES -3 YES \ No newline at end of file diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/1-1.c deleted file mode 100644 index 943bb36c4d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/1-1.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_getparam() function return the scheduling parameters of a - * process specified by pid in the sched_param structure pointed to by param. - */ -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - struct sched_param param; - int result = -1; - - param.sched_priority = -1; - - result = sched_getparam(getpid(), ¶m); - - if(result == 0 && - param.sched_priority != -1 && - errno == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != 0) { - printf("Return code is not zero.\n"); - return PTS_FAIL; - } else if(errno != 0) { - perror("Unexpected error"); - return PTS_FAIL; - } else if(param.sched_priority == -1) { - printf("The 'sched_priority' member does not change.\n"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/2-1.c deleted file mode 100644 index 0e2d7ee45e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/2-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the scheduling parameters are returned for the calling process - * when pid = 0. - */ -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - - struct sched_param param0; - struct sched_param param1; - int result0; - int result1; - - param0.sched_priority = -1; - param1.sched_priority = -1; - - result0 = sched_getparam(0, ¶m0); - result1 = sched_getparam(getpid(), ¶m1); - - if(result0 == result1 && - param0.sched_priority == param1.sched_priority && - errno == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("Different results between pid == 0 and pid == getpid().\n"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/3-1.c deleted file mode 100644 index 0747477d7e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/3-1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_getparam() returns 0 on success - */ -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - - struct sched_param param; - int result = -1; - - param.sched_priority = -1; - - result = sched_getparam(0, ¶m); - - if(result == 0 && - param.sched_priority != -1 && - errno == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(errno != 0 ) { - perror("Unexpected error"); - return PTS_FAIL; - } - - if(result != 0) { - printf("returned code is not zero.\n"); - return PTS_FAIL; - } else { - perror("Unresolved test error"); - return PTS_UNRESOLVED; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/4-1.c deleted file mode 100644 index 77edd0d4b6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/4-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_getparam() returns -1 on failure. - * - * The test create a child process which exit immediately and call - * sched_getparam with the pid of defunct child. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - - struct sched_param param; - int result = -1, child_pid; - int stat_loc; - - /* Create a child process which exit immediately */ - child_pid = fork(); - if(child_pid == -1){ - perror("An error occurs when calling fork()"); - return PTS_UNRESOLVED; - } else if (child_pid == 0){ - exit(0); - } - - /* Wait for the child process to exit */ - if(wait(&stat_loc) == -1){ - perror("An error occurs when calling wait()"); - return PTS_UNRESOLVED; - } - - /* Assume the pid is not yet reatributed to an other process */ - result = sched_getparam(child_pid, ¶m); - - if(result == -1 && errno == ESRCH) { - printf("Test PASSED\n"); - return PTS_PASS; - } - if(result != -1) { - printf("returned code is not -1.\n"); - return PTS_FAIL; - } - if(errno != ESRCH ) { - perror("errno is not ESRCH"); - return PTS_FAIL; - } else { - perror("Unresolved test error"); - return PTS_UNRESOLVED; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/5-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/5-1.sh deleted file mode 100755 index 8069030549..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/5-1.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -# -# Test that sched_getparam() sets errno == ESRCH if the pid cannot be found. -# This is tested implicitly via assertion 4. - -echo "Tested implicitly via assertion 4." -exit 0 - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/6-1.c deleted file mode 100644 index 9eb04f5eda..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/6-1.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_getparam() sets errno == EPERM if the requesting process - * does not have permission. - */ - - /* adam.li@intel.com - 2004-05-21 - * - * On Linux, e.g, the kernel makes no check on user permission to call this - * API. So basically we don't know on what condition a system should return - * EPERM. It is implementation defined. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -/** Set the euid of this process to a non-root uid */ -int set_nonroot() -{ - struct passwd *pw; - setpwent(); - /* search for the first user which is non root */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root")) - break; - endpwent(); - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return 1; - } - - if(setuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\n"); - return 1; - } - perror("An error occurs when calling seteuid()"); - return 1; - } - - printf("Testing with user '%s' (euid: %d)(uid: %d)\n", - pw->pw_name, (int)geteuid(), (int)getuid()); - return 0; -} - -int main(int argc, char **argv) -{ - - struct sched_param param; - int result = -1; - - /* We assume process Number 1 is created by root */ - /* and can only be accessed by root */ - /* This test should be run under standard user permissions */ - if (getuid() == 0) { - if (set_nonroot() != 0) { - printf("Cannot run this test as non-root user\n"); - return PTS_UNTESTED; - } - } - - result = sched_getparam( 1, ¶m); - - if(result == -1 && errno == EPERM) { - printf("Test PASSED\n"); - return PTS_PASS; - } - if(result == 0) { - printf("The function sched_getparam has successed.\n"); - return PTS_FAIL; - } - if(errno != EPERM ) { - perror("errno is not EPERM: The system allows a non-root" - "user to use sched_getparam()"); - return PTS_UNRESOLVED; - } else { - perror("Unresolved test error"); - return PTS_UNRESOLVED; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/assertions.xml deleted file mode 100644 index aca1085a24..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/assertions.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - The sched_getparam() function shall return the scheduling parameters of a - process specified by pid in the sched_param structure pointed to by param. - - - When pid = 0, the scheduling parameters are returned for the calling process - - - sched_getparam() returns 0 on success - - - sched_getparam() returns -1 on failure - - - sched_getparam() sets errno == ESRCH if the pid cannot be found - - - sched_getparam() sets errno == EPERM if the requesting process does not - have permission - - - sched_getparam() sets errno == EFAULT or EINVAL if param points to NULL - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/coverage.txt deleted file mode 100644 index 85c3720932..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/coverage.txt +++ /dev/null @@ -1,14 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES Can priority be negative ? -2 YES -3 YES -4 YES Assume that a pid is not reatributed immediately -5 YES -6 YES (Has root always uid 0 ? Process pid 1 always - belongs to root ?) -7 YES speculative test, not in the spec ! diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/speculative/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/speculative/7-1.c deleted file mode 100644 index ec1212b5c8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getparam/speculative/7-1.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test if sched_getparam() sets errno == EFAULT or EINVAL if param points to - * NULL. - * - * This behavior is not specified in the specs, so this test is speculative. - */ - -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_getparam( 0, NULL); - - if(result == -1 && errno == EFAULT) { - printf("sched_getparam() sets errno == EFAULT when param argument points to NULL\n"); - return PTS_PASS; - } - if(result == -1 && errno == EINVAL) { - printf("sched_getparam() sets errno == EINVAL when param argument points to NULL\n"); - return PTS_PASS; - } - - printf("sched_getparam() return %i and sets errno == %i.\n", - result, errno); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/1-1.c deleted file mode 100644 index cfe97f4647..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/1-1.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the scheduling policy is returned for the calling process when - * pid = 0 - */ -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - - int result0 = -1; - int result1 = -1; - - result0 = sched_getscheduler(0); - result1 = sched_getscheduler(getpid()); - - if(result0 == result1 && - errno == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if (result0 != result1) { - printf("Different results between pid == 0 and pid == getpid().\n"); - return PTS_FAIL; - } else { - perror("Unexpected error"); - return PTS_FAIL; - } - - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/2-1.c deleted file mode 100644 index 8424950202..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/2-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the behavior of sched_getscheduler() when pid is negative - * because it is unspecified. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the behavior of sched_getscheduler() when pid is negative\n because it is unspecified.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/3-1.c deleted file mode 100644 index f5dd453b36..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/3-1.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the values that can be returned by sched_getscheduler() are - * defined in the sched.h header - */ -#include -#include -#include -#include "posixtest.h" - -struct unique { - int value; - char *name; -} sym[] = { -#ifdef SCHED_FIFO - { - SCHED_FIFO, "SCHED_FIFO" - }, -#endif -#ifdef SCHED_RR - { - SCHED_RR, "SCHED_RR" - }, -#endif -#ifdef SCHED_SPORADIC - { - SCHED_SPORADIC,"SCHED_SPORADIC" - }, -#endif -#ifdef SCHED_OTHER - { - SCHED_OTHER, "SCHED_OTHER" - }, -#endif - { - 0, 0 - } -}; - - -int main(int argc, char **argv) -{ - int result = -1; - struct unique *tst; - - tst = sym; - result = sched_getscheduler(0); - - if(result == -1){ - printf("Returned code is -1.\n"); - return PTS_FAIL; - } - if(errno != 0 ) { - perror("Unexpected error"); - return PTS_FAIL; - } - - while (tst->name) { - if(result == tst->value) { - printf("Test PASSED\n"); - return PTS_PASS; - } - tst++; - } - - printf("The resulting scheduling policy is not one of standard policy.\nIt could be an implementation defined policy."); - return PTS_UNRESOLVED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/4-1.c deleted file mode 100644 index ca89bab8a1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/4-1.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_getscheduler() returns the scheduling policy of the - * specified process on success. - */ -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -1; - - result = sched_getscheduler(0); - - if(result != -1 && errno == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(errno != 0 ) { - perror("Unexpected error"); - return PTS_FAIL; - } else { - perror("Unresolved test error"); - return PTS_UNRESOLVED; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/5-1.c deleted file mode 100644 index e8a26a89fb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/5-1.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_getscheduler() returns -1 on failure. - * - * The test create a child process which exit immediately and call - * sched_getscheduler with the pid of defunct child. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - - int result = -1, child_pid; - int stat_loc; - - /* Create a child process which exit immediately */ - child_pid = fork(); - if(child_pid == -1){ - perror("An error occurs when calling fork()"); - return PTS_UNRESOLVED; - } else if (child_pid == 0){ - exit(0); - } - - /* Wait for the child process to exit */ - if(wait(&stat_loc) == -1){ - perror("An error occurs when calling wait()"); - return PTS_UNRESOLVED; - } - - /* Assume the pid is not yet reatributed to an other process */ - result = sched_getscheduler(child_pid); - - if(result == -1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(errno != ESRCH ) { - perror("ESRCH is not returned"); - return PTS_FAIL; - } - - if(result != -1) { - printf("Returned code is not -1.\n"); - return PTS_FAIL; - } else { - perror("Unresolved test error"); - return PTS_UNRESOLVED; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/6-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/6-1.sh deleted file mode 100755 index 5d13949fff..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/6-1.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -# -# Test that sched_getscheduler() sets errno == ESRCH if the pid cannot be -# found. -# This is tested implicitly via assertion 5. - -echo "Tested implicitly via assertion 5." -exit 0 - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/7-1.c deleted file mode 100644 index 6ef259970f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/7-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_getscheduler() sets errno == EPERM when the requesting - * process does not have permission - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -/** Set the euid of this process to a non-root uid */ -int set_nonroot() -{ - struct passwd *pw; - setpwent(); - /* search for the first user which is non root */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root")) - break; - endpwent(); - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return 1; - } - - if(seteuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\n"); - return 1; - } - perror("An error occurs when calling seteuid()"); - return 1; - } - - printf("Testing with user '%s' (uid: %d)\n", - pw->pw_name, (int)geteuid()); - return 0; -} - -int main(int argc, char **argv) -{ - - int result = -1; - - /* We assume process Number 1 is created by root */ - /* and can only be accessed by root */ - /* This test should be run under standard user permissions */ - if (getuid() == 0) { - if (set_nonroot() != 0) { - printf("Cannot run this test as non-root user\n"); - return PTS_UNTESTED; - } - } - - result = sched_getscheduler( 1 ); - - if(result == -1 && errno == EPERM) { - printf("Test PASSED\n"); - return PTS_PASS; - } - if(result == 0) { - printf("The function sched_getscheduler has successed.\n"); - return PTS_FAIL; - } - if(errno != EPERM ) { - perror("errno is not EPERM"); - return PTS_FAIL; - } else { - perror("Unresolved test error"); - return PTS_UNRESOLVED; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/assertions.xml deleted file mode 100644 index 6071c07925..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/assertions.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - When pid = 0, the scheduling policy is returned for the calling process - - - If pid is negative, the behavior is unspecified - - - The values that can be returned by sched_getscheduler() are defined in the - sched.h header - - - sched_getscheduler() returns the scheduling policy of the specified process - on success - - - sched_getscheduler() returns -1 on failure - - - sched_getscheduler() sets errno == ESRCH if the pid cannot be found - - - sched_getscheduler() sets errno == EPERM if the requesting process does not - have permission - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/coverage.txt deleted file mode 100644 index 6669dfcfdb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_getscheduler/coverage.txt +++ /dev/null @@ -1,14 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES Behavior is unspecified -3 YES Can not test the implementation defined policies -4 YES Don't test that the result is right. -5 YES Assume that a pid is not reatributed immediately -6 YES -7 YES - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/1-1.c deleted file mode 100644 index c4c9c4bc98..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/1-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the current execution time limit is returned for the calling - * process when pid = 0. - */ -#include -#include -#include -#include -#include "posixtest.h" -#include - -int main(int argc, char **argv) -{ - - struct timespec interval0; - struct timespec interval1; - int result0 = -1; - int result1 = -1; - - interval0.tv_sec = -1; - interval0.tv_nsec = -1; - - interval1.tv_sec = -1; - interval1.tv_nsec = -1; - - result0 = sched_rr_get_interval(0, &interval0); - result1 = sched_rr_get_interval(getpid(), &interval1); - - - if(result0 == result1 && - interval0.tv_sec == interval1.tv_sec && - interval0.tv_nsec == interval1.tv_nsec && - errno == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno != 0) { - perror("Unexpected error"); - return PTS_FAIL; - } else { - printf("Different results between pid == 0 and pid == getpid().\n"); - return PTS_FAIL; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/2-1.c deleted file mode 100644 index 8a3b190973..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/2-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * sched_rr_get_interval() returns 0 on success. - */ -#include -#include -#include -#include "posixtest.h" -#include - -int main(int argc, char **argv) -{ - struct timespec interval; - int result = -2; - - interval.tv_sec = -1; - interval.tv_nsec = -1; - - result = sched_rr_get_interval(0, &interval); - - if(result == 0 && - interval.tv_sec >= 0 && - interval.tv_nsec >= 0 && - errno == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if( interval.tv_sec == -1 ) { - printf("interval.tv_sec not updated.\n"); - return PTS_FAIL; - } - - if( interval.tv_nsec == -1 ) { - printf("interval.tv_nsec not updated.\n"); - return PTS_FAIL; - } - - if(result != 0) { - printf("Returned code != 0.\n"); - return PTS_FAIL; - } - - if(errno != 0 ) { - perror("Unexpected error"); - return PTS_FAIL; - } else { - perror("Unresolved test error"); - return PTS_UNRESOLVED; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/3-1.c deleted file mode 100644 index 356e2d7bf8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/3-1.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_rr_get_interval() returns -1 on failure. - * - * The test create a child process which exit immediately and call - * sched_rr_get_interval with the pid of defunct child. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" -#include - -int main(int argc, char **argv) -{ - - struct timespec interval; - int result = -2, child_pid, stat_loc; - - /* Create a child process which exit immediately */ - child_pid = fork(); - if(child_pid == -1){ - perror("An error occurs when calling fork()"); - return PTS_UNRESOLVED; - } else if (child_pid == 0){ - exit(0); - } - - /* Wait for the child process to exit */ - if(wait(&stat_loc) == -1){ - perror("An error occurs when calling wait()"); - return PTS_UNRESOLVED; - } - - /* Assume the pid is not yet reatributed to an other process */ - result = sched_rr_get_interval(child_pid, &interval); - - if(result == -1 && errno == ESRCH) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if( errno != ESRCH ) { - perror("Returned error is not ESRCH"); - return PTS_FAIL; - } - - if( result == 0 ) { - printf("Returned code == 0.\n"); - return PTS_FAIL; - } else { - perror("Unresolved test error"); - return PTS_UNRESOLVED; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/4-1.sh deleted file mode 100755 index d394453e3d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/4-1.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Test that sched_rr_get_interval() sets errno == ESRCH if the pid cannot be -# found. -# This is tested implicitly via assertion 3. - -echo "Tested implicitly via assertion 3." -exit 0 - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/assertions.xml deleted file mode 100644 index 193b2e5bde..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/assertions.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - When pid = 0, the current execution time limit is returned for the calling process - - - sched_rr_get_interval() returns 0 on success - - - sched_rr_get_interval() returns -1 on failure - - - sched_rr_get_interval() sets errno == ESRCH if the pid cannot be found - - - sched_rr_get_interval() returns an error if *interval argument points to NULL - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/coverage.txt deleted file mode 100644 index 3f1cc8d87e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/coverage.txt +++ /dev/null @@ -1,11 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES -3 YES Assume that a pid is not reatributed immediately -4 YES -5 YES speculative test diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/speculative/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/speculative/5-1.c deleted file mode 100644 index 3d457d7a8a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_rr_get_interval/speculative/5-1.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test if sched_rr_get_interval() sets errno == EFAULT or EINVAL if *interval - * points to NULL. - * - * This behavior is not specified in the specs, so this test is speculative. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -int main(int argc, char **argv) -{ - int result = -2; - - result = sched_rr_get_interval(0, NULL); - - if(result == -1 && errno == EFAULT) { - printf("sched_rr_get_interval() sets errno == EFAULT when interval argument points to NULL\n"); - return PTS_PASS; - } - if(result == -1 && errno == EINVAL) { - printf("sched_rr_get_interval() sets errno == EINVAL when interval argument points to NULL\n"); - return PTS_PASS; - } - - printf("sched_rr_get_interval() return %i and sets errno == %i.\n", - result, errno); - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/1-1.c deleted file mode 100644 index 18695dce19..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/1-1.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setparam() sets the scheduling parameters to the parameters - * specified in the sched_param structure pointed to by param. - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -void child_proc(){ - sigset_t sigset; - int sig; - - if(sigemptyset(&sigset) != 0) { - perror("An error occurs when calling sigemptyset()"); - exit(1); - } - if(sigaddset(&sigset,SIGUSR1) != 0) { - perror("An error occurs when calling sigaddset()"); - exit(1); - } - if(sigwait(&sigset, &sig) != 0) { - perror("An error occurs when calling sigwait()"); - exit(1); - } - - exit(0); -} - - -int main(){ - int result, child_pid, tmp_errno, policy; - int min_priority, new_priority, old_priority; - struct sched_param param; - - /* Create a child process which wait SIGUSR1 */ - child_pid = fork(); - if(child_pid == -1){ - perror("An error occurs when calling fork()"); - return PTS_UNRESOLVED; - } else if (child_pid == 0){ - child_proc(); - } - - if(sched_getparam(child_pid, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - kill(child_pid, SIGUSR1); - return PTS_UNRESOLVED; - } - - /* Assume that the process have permission to change priority of - its child */ - old_priority = param.sched_priority; - - policy = sched_getscheduler(0); - if(policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - min_priority = sched_get_priority_min(policy); - - new_priority = param.sched_priority == min_priority ? - (param.sched_priority = sched_get_priority_max(policy)) : - (param.sched_priority = min_priority); - - - result = sched_setparam(child_pid, ¶m); - tmp_errno = errno; - - if(sched_getparam(child_pid, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - kill(child_pid, SIGUSR1); - return PTS_UNRESOLVED; - } - - if(result == 0 && param.sched_priority == new_priority) { - printf("Test PASSED\n"); - kill(child_pid, SIGUSR1); - return PTS_PASS; - } else if(result == 0 && param.sched_priority == old_priority) { - printf("The param does not change.\n"); - kill(child_pid, SIGUSR1); - return PTS_FAIL; - } else if(result == -1 && tmp_errno == EPERM) { - printf("The process have not permission to change the param of its child.\n"); - kill(child_pid, SIGUSR1); - return PTS_UNRESOLVED; - } else if(result == -1 && tmp_errno == EINVAL) { - /* the new priority may be to big */ - /* test with a new priority lower than the old one */ - param.sched_priority = (new_priority -= 2); - result = sched_setparam(child_pid, ¶m); - - if(result == 0 && param.sched_priority == new_priority) { - printf("Test PASSED"); - kill(child_pid, SIGUSR1); - return PTS_PASS; - } - } - - perror("Unknow error"); - kill(child_pid, SIGUSR1); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/10-1.c deleted file mode 100644 index 553df23e0c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/10-1.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the process that is the head of the highest priority list preempt - * the process calling sched_setparam() when the calling process sets its own - * priority lower than that of one or more other non-empty process lists. - * - * There is no portable way to get the number of CPUs but the test should work - * for most of UNIX system (including but not limited to: Linux, Solaris, AIX, - * HPUX, *BSD). - * This test used shared memory. - * Steps: - * 1. Create a share memory segment. - * 2. Change the policy to SCHED_FIFO. - * 3. Create nb_cpu children processes which shall have the same priority - * and policy than the father (cf specs of fork). - * 4. Call sched_setparam with a priority smaller than those of children. - * 5. Check if the shared value has been changed by a child process. If not, - * the test fail. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#ifdef BSD -# include -# include -# include -#endif - -#ifdef HPUX -# include -# include -#endif - -/* Max number of loop for child_process */ -#define NB_LOOP 100000 - -int nb_cpu; -int *shmptr; /* shared memory */ - -/* Get the number of CPUs */ -int get_ncpu() { - int ncpu = -1; - - /* This syscall is not POSIX but it should work on many system */ -#ifdef _SC_NPROCESSORS_ONLN - ncpu = sysconf(_SC_NPROCESSORS_ONLN); -#else -# ifdef BSD - int mib[2]; - size_t len = sizeof(ncpu); - mib[0] = CTL_HW; - mib[1] = HW_NCPU; - sysctl(mib, 2, &ncpu, &len, NULL, 0); -# else -# ifdef HPUX - struct pst_dynamic psd; - pstat_getdynamic(&psd, sizeof(psd), 1, 0); - ncpu = (int)psd.psd_proc_cnt; -# endif /* HPUX */ -# endif /* BSD */ -#endif /* _SC_NPROCESSORS_ONLN */ - - return ncpu; -} - -void child_process(){ - alarm(2); - - while(1) { - (*shmptr)++; - sched_yield(); - } -} - -void kill_children(int *child_pid){ - int i; - - for(i=0; i -#include -#include "posixtest.h" - -#ifdef _POSIX_SPORADIC_SERVER -int main() { - printf("Not yet tested.\n"); - return PTS_UNTESTED; -} - -#else -int main() { - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/13-1.c deleted file mode 100644 index 9e86025b56..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/13-1.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the sched_ss_max_repl member of the param argument represent the - * maximum number of replenishments that are allowed to be pending - * simultaneously for the process scheduled under the SCHED_SPORADIC policy. - * - * @pt:SS - */ - -#include -#include -#include "posixtest.h" - -#ifdef _POSIX_SPORADIC_SERVER -int main() { - printf("Not yet tested.\n"); - return PTS_UNTESTED; -} - -#else -int main() { - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/14-1.c deleted file mode 100644 index 17ffcf954f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/14-1.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the sched_ss_low_priority, sched_ss_repl_period, and - * sched_ss_init_budget members of the param argument have no effect on the - * scheduling behavior if the scheduling policy of the target process is either - * SCHED_FIFO or SCHED_RR. - - * - * @pt:SS - */ - -#include -#include -#include "posixtest.h" - -#ifdef _POSIX_SPORADIC_SERVER -int main() { - printf("Not yet tested.\n"); - return PTS_UNTESTED; -} - -#else -int main() { - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/15-1.c deleted file mode 100644 index ce05e11716..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/15-1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the effects of the sched_ss_low_priority, - * sched_ss_repl_period, and sched_ss_init_budget members when the scheduling - * policy of the target process is not SCHED_FIFO, SCHED_RR, or SCHED_SPORADIC. - * It is implementation-defined. - * - * @pt:SS - */ - -#include -#include -#include "posixtest.h" - -#ifdef _POSIX_SPORADIC_SERVER -int main() { - printf("Will not test the effects of the sched_ss_low_priority,\nsched_ss_repl_period, and sched_ss_init_budget members when the scheduling\npolicy of the target process is not SCHED_FIFO, SCHED_RR, or SCHED_SPORADIC.\nIt is implementation-defined.\n"); - return PTS_UNTESTED; -} - -#else -int main() { - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/16-1.c deleted file mode 100644 index 8a2c035872..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/16-1.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the result of sched_setparam when the scheduling policy of the - * target process is not SCHED_FIFO, SCHED_RR, or SCHED_SPORADIC. It is - * implementation-defined. - * - * @pt:SS - */ - -#include -#include -#include "posixtest.h" - -#ifdef _POSIX_SPORADIC_SERVER -int main() { - printf(" Will not test the result of sched_setparam when the scheduling policy of the\ntarget process is not SCHED_FIFO, SCHED_RR, or SCHED_SPORADIC.\nIt is implementation-defined.\n"); - return PTS_UNTESTED; -} - -#else -int main() { - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/17-1.c deleted file mode 100644 index 52ef4e43ff..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/17-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test that sched_setparam have no effect on the scheduling of - * threads with system scheduling contention scope. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that sched_setparam have no effect on the scheduling of threads\n with system scheduling contention scope.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/18-1.c deleted file mode 100644 index 9a4920299e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/18-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test that the threads scheduling policy and associated parameters - * are not affected. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that the threads scheduling policy and associated parameters\nare not affected.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/19-1.c deleted file mode 100644 index d8bccb64d5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/19-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test that the underlying kernel-scheduled entities for the system - * contention scope threads are not be affected by this function. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that the underlying kernel-scheduled entities for the system\ncontention scope threads are not be affected by this sched_setparam().\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/2-1.c deleted file mode 100644 index 4aa97df0f4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/2-1.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the higher numerical values for the priority represent the higher - * priorities for the SCHED_FIFO policy. - * - * NO OTHER REALTIME PROCESS SHOULD RUN WHEN RUNNING THIS TEST. - * - * There is no portable way to get the number of CPUs but the test should work - * for most of UNIX system (including but not limited to: Linux, Solaris, AIX, - * HPUX, *BSD). - * Steps: - * 1. Get the number of CPUs. - * 2. Set the scheduling policy to SCHED_FIFO with a mean priority. - * 3. Lauch as many processes than CPU. The last process set its own priority - * to the min value. - * 4. Father process set its own priority to the max value. - * 5. Both children and father increment a counter in a basic loop. - * 6. The father send SIGTERM to the last child and get its counter. If child - * counter is reasonably lower than the fathers one, the test is - * succesfull. - * 7. The father kill all other children. - * - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#ifdef BSD -# include -# include -# include -#endif - -#ifdef HPUX -# include -# include -#endif - - -#define NB_LOOP 20000000 -#define NB_LOOP_CHILD 200000000 /* shall be much greater than NB_LOOP */ - -#define ACCEPTABLE_RATIO 2.0 - -#define STDIN 0 -#define STDOUT 1 -#define STDERR 2 - -int nb_child; /* Number of child processes == number of CPUs */ -int count = 0; -int the_pipe[2]; - -/* Get the number of CPUs */ -int get_ncpu() { - int ncpu = -1; - - /* This syscall is not POSIX but it should work on many system */ -#ifdef _SC_NPROCESSORS_ONLN - ncpu = sysconf(_SC_NPROCESSORS_ONLN); -#else -# ifdef BSD - int mib[2]; - size_t len = sizeof(ncpu); - mib[0] = CTL_HW; - mib[1] = HW_NCPU; - sysctl(mib, 2, &ncpu, &len, NULL, 0); -# else -# ifdef HPUX - struct pst_dynamic psd; - pstat_getdynamic(&psd, sizeof(psd), 1, 0); - ncpu = (int)psd.psd_proc_cnt; -# endif /* HPUX */ -# endif /* BSD */ -#endif /* _SC_NPROCESSORS_ONLN */ - - return ncpu; -} - -void child_process(int id){ - int i; - struct sched_param param; - - if(id == nb_child-1){ - param.sched_priority = sched_get_priority_min(SCHED_FIFO); - sched_setparam(getpid(), ¶m); - } - - for(i=0; i= ACCEPTABLE_RATIO) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(ratio <= (1/ACCEPTABLE_RATIO)) { - printf("Higher numerical values for the priority represent the lower priorities.\n"); - return PTS_FAIL; - } else { - printf("The difference between the processes is not representative.\n"); - return PTS_UNRESOLVED; - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/2-2.c deleted file mode 100644 index 91b026c33c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/2-2.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the higher numerical values for the priority represent the higher - * priorities for the SCHED_RR policy. - * - * NO OTHER REALTIME PROCESS SHOULD RUN WHEN RUNNING THIS TEST. - * - * There is no portable way to get the number of CPUs but the test should work - * for most of UNIX system (including but not limited to: Linux, Solaris, AIX, - * HPUX, *BSD). - * Steps: - * 1. Get the number of CPUs. - * 2. Set the scheduling policy to SCHED_RR with a mean priority. - * 3. Lauch as many processes than CPU. The last process set its own priority - * to the min value. - * 4. Father process set its own priority to the max value. - * 5. Both children and father increment a counter in a basic loop. - * 6. The father send SIGTERM to the last child and get its counter. If child - * counter is reasonably lower than the fathers one, the test is - * succesfull. - * 7. The father kill all other children. - * - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#ifdef BSD -# include -# include -# include -#endif - -#ifdef HPUX -# include -# include -#endif - - -#define NB_LOOP 20000000 -#define NB_LOOP_CHILD 200000000 /* shall be much greater than NB_LOOP */ - -#define ACCEPTABLE_RATIO 2.0 - -#define STDIN 0 -#define STDOUT 1 -#define STDERR 2 - -int nb_child; /* Number of child processes == number of CPUs */ -int count = 0; -int the_pipe[2]; - -/* Get the number of CPUs */ -int get_ncpu() { - int ncpu = -1; - - /* This syscall is not POSIX but it should work on many system */ -#ifdef _SC_NPROCESSORS_ONLN - ncpu = sysconf(_SC_NPROCESSORS_ONLN); -#else -# ifdef BSD - int mib[2]; - size_t len = sizeof(ncpu); - mib[0] = CTL_HW; - mib[1] = HW_NCPU; - sysctl(mib, 2, &ncpu, &len, NULL, 0); -# else -# ifdef HPUX - struct pst_dynamic psd; - pstat_getdynamic(&psd, sizeof(psd), 1, 0); - ncpu = (int)psd.psd_proc_cnt; -# endif /* HPUX */ -# endif /* BSD */ -#endif /* _SC_NPROCESSORS_ONLN */ - - return ncpu; -} - -void child_process(int id){ - int i; - struct sched_param param; - - if(id == nb_child-1){ - param.sched_priority = sched_get_priority_min(SCHED_RR); - sched_setparam(getpid(), ¶m); - } - - for(i=0; i= ACCEPTABLE_RATIO) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(ratio <= (1/ACCEPTABLE_RATIO)) { - printf("Higher numerical values for the priority represent the lower priorities.\n"); - return PTS_FAIL; - } else { - printf("The difference between the processes is not representative.\n"); - return PTS_UNRESOLVED; - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/20-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/20-1.c deleted file mode 100644 index 1a29416aa7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/20-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the underlying kernel-scheduled entities for the process - * contention scope threads have their scheduling parameters changed to the - * value specified in param. - */ - - -#include -#include -#include -#include -#include -#include "posixtest.h" - - -void * runner(void * arg) { - - while(1) sleep(1); - return NULL; -} - -int main() { - int new_priority, max_priority, policy, result; - struct sched_param param; - pthread_t tid; - pthread_attr_t attr; - - if(sched_getparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - pthread_exit((void*)-1); - } - - /* Make sure new_priority != old priority */ - policy = sched_getscheduler(getpid()); - max_priority = sched_get_priority_max(policy); - new_priority = (param.sched_priority == max_priority) ? - sched_get_priority_min(policy) : - max_priority; - - if(pthread_attr_init(&attr) != 0) { - printf("An error occurs when calling pthread_attr_init()"); - return PTS_UNRESOLVED; - } - result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS); - if(result == ENOTSUP) { - printf("Process contention scope threads are not supported.\n"); - return PTS_UNSUPPORTED; - } else if(result != 0) { - printf("An error occurs when calling pthread_attr_setscope()"); - return PTS_UNRESOLVED; - } - if(pthread_create(&tid, &attr, runner, NULL) != 0) { - printf("An error occurs when calling pthread_create()"); - return PTS_UNRESOLVED; - } - - - param.sched_priority = new_priority; - if(sched_setparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_setparam()"); - return PTS_UNRESOLVED; - } - - if(pthread_getschedparam(tid , &policy, ¶m) != 0) { - printf("An error occurs when calling pthread_getschedparam()"); - return PTS_UNRESOLVED; - } - - pthread_cancel(tid); - - if(param.sched_priority == new_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("sched_setparam() does not set the right param.\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/21-1.c deleted file mode 100644 index 772bd9a4d7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/21-1.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the underlying kernel-scheduled entities for the process - * contention scope threads that are created after this call completes inherit - * their scheduling policy from the process. - */ - - -#include -#include -#include -#include -#include -#include "posixtest.h" - - -void * runner(void * arg) { - - while(1) sleep(1); - return NULL; -} - -int main() { - int new_priority, max_priority, old_policy, policy, result; - struct sched_param param; - pthread_t tid; - pthread_attr_t attr; - - if(sched_getparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - pthread_exit((void*)-1); - } - /* Make sure new_priority != old priority */ - old_policy = sched_getscheduler(getpid()); - max_priority = sched_get_priority_max(old_policy); - new_priority = (param.sched_priority == max_priority) ? - sched_get_priority_min(old_policy) : - max_priority; - param.sched_priority = new_priority; - if(sched_setparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_setparam()"); - return PTS_UNRESOLVED; - } - - if(pthread_attr_init(&attr) != 0) { - printf("An error occurs when calling pthread_attr_init()"); - return PTS_UNRESOLVED; - } - result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS); - if(result == ENOTSUP) { - printf("Process contention scope threads are not supported.\n"); - return PTS_UNSUPPORTED; - } else if(result != 0) { - printf("An error occurs when calling pthread_attr_setscope()"); - return PTS_UNRESOLVED; - } - if(pthread_create(&tid, &attr, runner, NULL) != 0) { - printf("An error occurs when calling pthread_create()"); - return PTS_UNRESOLVED; - } - - - if(pthread_getschedparam(tid , &policy, ¶m) != 0) { - printf("An error occurs when calling pthread_getschedparam()"); - return PTS_UNRESOLVED; - } - - pthread_cancel(tid); - - if(policy == old_policy){ - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("The threads does not inherit the right policy.\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/21-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/21-2.c deleted file mode 100644 index 12cc030da0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/21-2.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the underlying kernel-scheduled entities for the process - * contention scope threads that are created after this call completes inherit - * their scheduling parameters from the process. - */ - - -#include -#include -#include -#include -#include -#include "posixtest.h" - - -void * runner(void * arg) { - - while(1) sleep(1); - return NULL; -} - -int main() { - int new_priority, max_priority, policy, result; - struct sched_param param; - pthread_t tid; - pthread_attr_t attr; - - if(sched_getparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - pthread_exit((void*)-1); - } - /* Make sure new_priority != old_priority */ - policy = sched_getscheduler(getpid()); - max_priority = sched_get_priority_max(policy); - new_priority = (param.sched_priority == max_priority) ? - sched_get_priority_min(policy) : - max_priority; - param.sched_priority = new_priority; - if(sched_setparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_setparam()"); - return PTS_UNRESOLVED; - } - - - if(pthread_attr_init(&attr) != 0) { - printf("An error occurs when calling pthread_attr_init()"); - return PTS_UNRESOLVED; - } - result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS); - if(result == ENOTSUP) { - printf("Process contention scope threads are not supported.\n"); - return PTS_UNSUPPORTED; - } else if(result != 0) { - printf("An error occurs when calling pthread_attr_setscope()"); - return PTS_UNRESOLVED; - } - if(pthread_create(&tid, &attr, runner, NULL) != 0) { - printf("An error occurs when calling pthread_create()"); - return PTS_UNRESOLVED; - } - - - if(pthread_getschedparam(tid , &policy, ¶m) != 0) { - printf("An error occurs when calling pthread_getschedparam()"); - return PTS_UNRESOLVED; - } - - pthread_cancel(tid); - - if(param.sched_priority == new_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("The threads does not inherit the right param.\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/22-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/22-1.c deleted file mode 100644 index bd25c3438c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/22-1.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the sched_setparam() function return zero on success. - */ -#include -#include -#include -#include "posixtest.h" - -int main(){ - int result; - struct sched_param param; - - if(sched_getparam(0, ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - result = sched_setparam(0, ¶m); - - if(result == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling parameter.\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } else { - printf("returned code is not 0.\n"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-1.c deleted file mode 100644 index 3f25914972..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the priority remain unchanged when the sched_priority - * member is not within the inclusive priority range for the current - * scheduling policy. - */ -#include -#include -#include "posixtest.h" - - -int main(){ - int policy, invalid_priority, old_priority; - struct sched_param param; - - if(sched_getparam(0, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - policy = sched_getscheduler(0); - if(policy == -1){ - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - invalid_priority = sched_get_priority_max(policy); - if(invalid_priority == -1){ - perror("An error occurs when calling sched_get_priority_max()"); - return PTS_UNRESOLVED; - } - - /* set an invalid priority */ - invalid_priority++; - param.sched_priority = invalid_priority; - sched_setparam(0,¶m); - - if(sched_getparam(0, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - if(param.sched_priority == old_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("The priority have changed.\n"); - return PTS_FAIL; - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-2.c deleted file mode 100644 index b664dba0a7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-2.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the priority remain unchanged when the sched_ss_low_priority - * member is not within the inclusive priority range for the sporadic server - * policy. - * - * @pt:SS - */ - -#include -#include -#include -#include "posixtest.h" - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int policy, invalid_priority, old_priority; - struct sched_param param; - - if(sched_getparam(0, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - policy = sched_getscheduler(0); - if(policy == -1){ - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } else if(policy != SCHED_SPORADIC){ - if(sched_setscheduler(0, SCHED_SPORADIC, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - } - - - invalid_priority = sched_get_priority_max(SCHED_SPORADIC); - if(invalid_priority == -1){ - perror("An error occurs when calling sched_get_priority_max()"); - return PTS_UNRESOLVED; - } - - /* set an invalid priority */ - invalid_priority++; - param.sched_ss_low_priority = invalid_priority; - param.sched_priority++; - sched_setparam(0,¶m); - - if(sched_getparam(0, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - if(param.sched_priority == old_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("The priority have changed.\n"); - return PTS_FAIL; - } -} - -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-3.c deleted file mode 100644 index 120cac90c1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-3.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the priority remain unchanged when the sched_ss_repl_period is not - * greater than or equal to the sched_ss_init_budget member. - * - * @pt:SS - */ -#include -#include -#include -#include "posixtest.h" - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int old_priority; - struct sched_param param; - - if(sched_getparam(0, ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - /* set a sched_ss_repl_period lower than the sched_ss_init_budget */ - param.sched_ss_repl_period.tv_sec = 1; - param.sched_ss_repl_period.tv_nsec = 0; - - param.sched_ss_init_budget.tv_sec = 2; - param.sched_ss_init_budget.tv_nsec = 0; - - param.sched_priority++; - sched_setparam(0,¶m); - - if(sched_getparam(0, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - if(param.sched_priority == old_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("The priority have changed.\n"); - return PTS_FAIL; - } -} - -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-4.c deleted file mode 100644 index 47f35294d6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-4.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the priority remain unchanged when the sched_ss_max_repl is lower - * than 1. - * - * @pt:SS - */ -#include -#include -#include -#include "posixtest.h" - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int old_priority; - struct sched_param param; - - if(sched_getparam(0, ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - param.sched_ss_max_repl = 0; - param.sched_priority++; - sched_setparam(0,¶m); - - if(sched_getparam(0, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - if(param.sched_priority == old_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("The priority have changed.\n"); - return PTS_FAIL; - } - - -} - -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-5.c deleted file mode 100644 index 0ec86d1a5b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-5.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the priority remain unchanged when the sched_ss_max_repl is - * greater than SS_REPL_MAX. - * - * @pt:SS - */ -#include -#include -#include -#include "posixtest.h" - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int old_priority; - struct sched_param param; - - if(sched_getparam(0, ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - param.sched_ss_max_repl = SS_REPL_MAX+1; - param.sched_priority++; - sched_setparam(0,¶m); - - if(sched_getparam(0, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - if(param.sched_priority == old_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("The priority have changed.\n"); - return PTS_FAIL; - } - - -} - -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-6.c deleted file mode 100644 index bef96dc73a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-6.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the priority remain unchanged when the requesting process - * does not have permission to set the scheduling parameters for the specified - * process, or does not have the appropriate privilege to invoke schedparam(). - */ -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -/** Set the euid of this process to a non-root uid */ -int set_nonroot() -{ - struct passwd *pw; - setpwent(); - /* search for the first user which is non root */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root")) - break; - endpwent(); - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return 1; - } - - if(setuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\n"); - return 1; - } - perror("An error occurs when calling seteuid()"); - return 1; - } - - printf("Testing with user '%s' (euid: %d)(uid: %d)\n", - pw->pw_name, (int)geteuid(), (int)getuid()); - return 0; -} -int main(){ - int old_priority; - struct sched_param param; - int rc; - - /* We assume process Number 1 is created by root */ - /* and can only be accessed by root */ - /* This test should be run under standard user permissions */ - - param.sched_priority = sched_get_priority_min(SCHED_FIFO); - /* Cannot test SCHED_OTHER, on 0 valid as its priority */ - sched_setscheduler(0, SCHED_FIFO, ¶m); - if (getuid() == 0) { - if (set_nonroot() != 0) { - printf("Cannot run this test as non-root user\n"); - return PTS_UNTESTED; - } - } - - if(sched_getparam(0, ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - param.sched_priority++; - rc = sched_setparam(0,¶m); - if (rc != -1 || (rc == -1 && errno != EPERM)) - { - perror("sched_setparam() does not return EPERM\n"); - return PTS_UNRESOLVED; - } - - if(sched_getparam(0, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - if(param.sched_priority == old_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("The priority have changed.\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-7.c deleted file mode 100644 index eb0e943898..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/23-7.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setparam() sets errno == ESRCH when no process can be found - * corresponding to that specified by pid. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - - -int main(){ - struct sched_param param; - int child_pid, stat_loc, old_priority; - - if(sched_getparam(0, ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - /* Create a child process which exit immediately */ - child_pid = fork(); - if(child_pid == -1){ - perror("An error occurs when calling fork()"); - return PTS_UNRESOLVED; - } else if (child_pid == 0){ - exit(0); - } - - /* Wait for the child process to exit */ - if(wait(&stat_loc) == -1){ - perror("An error occurs when calling wait()"); - return PTS_UNRESOLVED; - } - - /* Assume the pid is not yet reatributed to an other process */ - param.sched_priority++; - sched_setparam(child_pid, ¶m); - - if(sched_getparam(0, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - if(param.sched_priority == old_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } else { - printf("The priority have changed.\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/24-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/24-1.sh deleted file mode 100755 index 216df22379..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/24-1.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh -# This is tested implicitly via assertions 25, 26 and 27. - -echo "Tested implicitly via assertions 25, 26 and 27." -exit 0 \ No newline at end of file diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-1.c deleted file mode 100644 index db05bb5d26..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setparam() sets errno == EINVAL when the sched_priority - * member is not within the inclusive priority range for the current - * scheduling policy. - */ -#include -#include -#include -#include "posixtest.h" - - -int main(){ - int policy, invalid_priority, result; - struct sched_param param; - - policy = sched_getscheduler(0); - if(policy == -1){ - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - invalid_priority = sched_get_priority_max(policy); - if(invalid_priority == -1){ - perror("An error occurs when calling sched_get_priority_max()"); - return PTS_UNRESOLVED; - } - /* set an invalid priority */ - invalid_priority++; - - param.sched_priority = invalid_priority; - - result = sched_setparam(0,¶m); - - if(result == -1 && errno == EINVAL){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != -1) { - printf("The returned code is not -1.\n"); - return PTS_FAIL; - } else if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling parameter.\nTry to launch this test as root\n"); - return PTS_UNRESOLVED; - } else { - perror("Unknow error"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-2.c deleted file mode 100644 index 7adfd28dfa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-2.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setparam() sets errno == EINVAL when the - * sched_ss_low_priority member is not within the inclusive priority range for - * the sporadic server policy. - * - * @pt:SS - */ - - -#include -#include -#include -#include -#include "posixtest.h" - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int policy, invalid_priority, result; - struct sched_param param; - - policy = sched_getscheduler(0); - if(policy == -1){ - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } else if(policy != SCHED_SPORADIC){ - - if(sched_getparam(0, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - if(sched_setscheduler(0, SCHED_SPORADIC, ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - } - - - invalid_priority = sched_get_priority_max(SCHED_SPORADIC); - if(invalid_priority == -1){ - perror("An error occurs when calling sched_get_priority_max()"); - return PTS_UNRESOLVED; - } - - /* set an invalid priority */ - invalid_priority++; - - param.sched_ss_low_priority = invalid_priority; - - result = sched_setparam(0,¶m); - - if(result == -1 && errno == EINVAL){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != -1) { - printf("The returned code is not -1.\n"); - return PTS_FAIL; - } else if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling parameter.\nTry to launch this test as root\n"); - return PTS_UNRESOLVED; - } else { - perror("Unknow error"); - return PTS_FAIL; - } -} - -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-3.c deleted file mode 100644 index 7354c60e2d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-3.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setparam() sets errno == EINVAL when the - * sched_ss_repl_period is not greater than or equal to the - * sched_ss_init_budget member. - * - * @pt:SS - */ -#include -#include -#include -#include -#include "posixtest.h" - - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int policy, result; - struct sched_param param; - - if(sched_getparam(0, ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - /* set a sched_ss_repl_period lower than the sched_ss_init_budget */ - param.sched_ss_repl_period.tv_sec = 1; - param.sched_ss_repl_period.tv_nsec = 0; - - param.sched_ss_init_budget.tv_sec = 2; - param.sched_ss_init_budget.tv_nsec = 0; - - result = sched_setparam(0,¶m); - - if(result == -1 && errno == EINVAL){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != -1) { - printf("The returned code is not -1.\n"); - return PTS_FAIL; - } else if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling parameter.\nTry to launch this test as root\n"); - return PTS_UNRESOLVED; - } else { - perror("Unknow error"); - return PTS_FAIL; - } -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-4.c deleted file mode 100644 index a0d626aa36..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/25-4.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setparam() sets errno == EINVAL when the sched_ss_max_repl - * is not within the inclusive range [1,SS_REPL_MAX] - * - * @pt:SS - */ -#include -#include -#include -#include -#include "posixtest.h" - - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int policy, result; - int result_code = PTS_PASS; - struct sched_param param; - - if(sched_getparam(0, ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - /* test when sched_ss_max_repl < 1 */ - param.sched_ss_max_repl = 0; - result = sched_setparam(0,¶m); - - if(result != -1) { - printf("The returned code is not -1 when sched_ss_max_repl < 1.\n"); - result_code = PTS_FAIL; - } else if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling parameter.\nTry to launch this test as root\n"); - result_code = PTS_UNRESOLVED; - } else if(errno != EINVAL) { - perror("Unknow error"); - result_code = PTS_FAIL; - } - - /* test when sched_ss_max_repl > SS_REPL_MAX */ - param.sched_ss_max_repl = SS_REPL_MAX+1; - result = sched_setparam(0,¶m); - - if(result == -1 && errno == EINVAL) { - if(result_code == PTS_PASS){ - printf("Test PASSED\n"); - } - return result_code; - } else if(result != -1) { - printf("The returned code is not -1 when sched_ss_max_repl > SS_REPL_MAX.\n"); - return PTS_FAIL; - } else if(errno == EPERM) { - if(result_code == PTS_FAIL){ - printf("This process does not have the permission to set its own scheduling parameter.\nTry to launch this test as root\n"); - return PTS_FAIL; - } - return PTS_UNRESOLVED; - } else { - perror("Unknow error"); - return PTS_FAIL; - } - - -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/26-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/26-1.c deleted file mode 100644 index be820cdea4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/26-1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setparam() sets errno == EPERM when the requesting process - * does not have permission to set the scheduling parameters for the specified - * process, or does not have the appropriate privilege to invoke schedparam(). - */ -#include -#include -#include -#include -#include "posixtest.h" - - - -int main(){ - int result; - struct sched_param param; - - /* We assume process Number 1 is created by root */ - /* and can only be accessed by root */ - /* This test should be run under standard user permissions */ - if (getuid() == 0) { - puts("Run this test case as a Regular User, but not ROOT"); - return PTS_UNTESTED; - } - - if(sched_getparam(0, ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - result = sched_setparam(1, ¶m); - - if(result == -1 && errno == EPERM) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno != EPERM) { - perror("errno is not EPERM"); - return PTS_FAIL; - } else { - printf("The returned code is not -1.\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/27-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/27-1.c deleted file mode 100644 index 5ba7d0faea..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/27-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setparam() sets errno == ESRCH when no process can be found - * corresponding to that specified by pid. - * - * The test create a child process which exit immediately and call - * sched_setparam with the pid of defunct child. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - - -int main(){ - struct sched_param param; - int result, child_pid, stat_loc; - - if(sched_getparam(0, ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - /* Create a child process which exit immediately */ - child_pid = fork(); - if(child_pid == -1){ - perror("An error occurs when calling fork()"); - return PTS_UNRESOLVED; - } else if (child_pid == 0){ - exit(0); - } - - /* Wait for the child process to exit */ - if(wait(&stat_loc) == -1){ - perror("An error occurs when calling wait()"); - return PTS_UNRESOLVED; - } - - /* Assume the pid is not yet reatributed to an other process */ - result = sched_setparam(child_pid, ¶m); - - if(result == -1 && errno == ESRCH) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != -1) { - printf("The returned code is not -1.\n"); - return PTS_FAIL; - } else if (errno == EPERM) { - printf("This process does not have the permission to invoke sched_setparam().\nTry to launch this test as root\n"); - return PTS_UNRESOLVED; - } else { - perror("errno is not ESRCH"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/3-1.c deleted file mode 100644 index bd9fbb629c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/3-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the behavior of sched_setparam() when pid is negative because - * it is unspecified. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the behavior of sched_setparam() when pid is negative because\nit is unspecified.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/4-1.sh deleted file mode 100755 index 8edaea45b3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/4-1.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1." -exit 0 \ No newline at end of file diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/5-1.c deleted file mode 100644 index c6398d4baa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/5-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the scheduling policy and scheduling parameters are set for - * the calling process when pid == 0. - */ -#include -#include -#include -#include -#include "posixtest.h" - -int main(){ - int result, new_priority, old_priority, max_prio, policy; - struct sched_param param; - - if(sched_getparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - policy = sched_getscheduler(getpid()); - if(policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - /* Make sure new_priority != old_priority */ - max_prio = sched_get_priority_max(policy); - old_priority = param.sched_priority; - new_priority = (old_priority == max_prio) ? - sched_get_priority_min(policy) : - max_prio; - param.sched_priority = new_priority; - - result = sched_setparam(0, ¶m); - - if(sched_getparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - if(result == 0 && param.sched_priority == new_priority) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result == 0 && param.sched_priority == old_priority) { - printf("The param does not change\n"); - return PTS_FAIL; - } else if(result == -1 && errno == EPERM) { - printf("The process have not permission to change its own param.\n"); - return PTS_UNRESOLVED; - } - - perror("Unknow error"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/6-1.c deleted file mode 100644 index b452450cbe..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/6-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the conditions under which one process has permission to - * change the scheduling parameters of another process, because they are - * implementation-defined. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the conditions under which one process has permission to\nchange the scheduling parameters of another process, because they are\nimplementation-defined.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/7-1.c deleted file mode 100644 index 15150f8d3a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/7-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test that implementations may require the requesting process to - * have the appropriate privilege to set its own scheduling parameters or those - * of another process. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that implementations may require the requesting process to\nhave the appropriate privilege to set its own scheduling parameters or those\nof another process.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/8-1.c deleted file mode 100644 index f6413ad3fa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/8-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Will not test that the target process is moved to the tail of the thread - * list for its priority when it is running. - */ - -#include -#include "posixtest.h" - -int main() { - printf("Will not test that the target process is moved to the tail of the thread\nlist for its priority when it is running.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/9-1.c deleted file mode 100644 index b4e4c6e222..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/9-1.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the process specified by the pid argument preempt a lowest - * priority running process, if the priority of the process specified by the - * pid argument is set higher than that of the lowest priority running process - * and if the specified process is ready to run. - * - * NO OTHER REALTIME PROCESS SHOULD RUN WHEN RUNNING THIS TEST. - * - * There is no portable way to get the number of CPUs but the test should work - * for most of UNIX system (including but not limited to: Linux, Solaris, AIX, - * HPUX, *BSD). - * This test used shared memory. - * Steps: - * 1. Create a share memory segment. - * 2. Change the policy to SCHED_FIFO and set minimum priority. - * 3. Create NB_CPU-1 children processes which set their own priority to the - * higher value and use all but one processor. - * 4. Create a child with the same priority. - * 4. Call sched_setparam with an mean priority and the pid value of the - * last children. - * 5. Check if the shared value has been changed by the child process. If - * not, the test fail. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#ifdef BSD -# include -# include -# include -#endif - -#ifdef HPUX -# include -# include -#endif - -/* Max number of loop for child_process */ -#define NB_LOOP 100000 - -int nb_cpu; -int *shmptr; /* shared memory */ - -/* Get the number of CPUs */ -int get_ncpu() { - int ncpu = -1; - - /* This syscall is not POSIX but it should work on many system */ -#ifdef _SC_NPROCESSORS_ONLN - ncpu = sysconf(_SC_NPROCESSORS_ONLN); -#else -# ifdef BSD - int mib[2]; - size_t len = sizeof(ncpu); - mib[0] = CTL_HW; - mib[1] = HW_NCPU; - sysctl(mib, 2, &ncpu, &len, NULL, 0); -# else -# ifdef HPUX - struct pst_dynamic psd; - pstat_getdynamic(&psd, sizeof(psd), 1, 0); - ncpu = (int)psd.psd_proc_cnt; -# endif /* HPUX */ -# endif /* BSD */ -#endif /* _SC_NPROCESSORS_ONLN */ - - return ncpu; -} - -void child_process(){ - struct sched_param param; - - param.sched_priority = sched_get_priority_max(SCHED_FIFO); - if(sched_setparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_setparam()"); - return; - } - - /* to avoid blocking */ - alarm(2); - while(1); - -} - -void test_process(){ - /* to avoid blocking */ - alarm(2); - - while(1) { - (*shmptr)++; - sched_yield(); - } -} - -void kill_children(int *child_pid){ - int i; - - for(i=0; i - - sched_setparam() sets the scheduling parameters to the parameters specified - in the sched_param structure pointed to by param - - - Higher numerical values for the priority represent higher priorities - - - If pid is negative, the behavior of sched_setparam() is unspecified - - - If a process specified by pid exists, and if the calling process has - permission, the scheduling parameters shall be set for the process whose - process ID is equal to pid - - - If pid is zero, the scheduling parameters shall be set for the calling - process - - - The conditions under which one process has permission to change the - scheduling parameters of another process are implementation-defined - - - Implementations may require the requesting process to have the appropriate - privilege to set its own scheduling parameters or those of another process - - - The target process, whether it is running or not running, shall be moved to - the tail of the thread list for its priority - - - If the priority of the process specified by the pid argument is set higher - than that of the lowest priority running process and if the specified - process is ready to run, the process specified by the pid argument shall - preempt a lowest priority running process - - - If the process calling sched_setparam() sets its own priority lower than - that of one or more other non-empty process lists, then the process that is - the head of the highest priority list shall preempt the calling process - - - The originating process might not receive notification of the completion of - the requested priority change until the higher priority process has - executed - - - The sched_ss_repl_period and sched_ss_init_budget members of the param - argument shall represent the time parameters to be used by the sporadic - server scheduling policy for the target process - - - The sched_ss_max_repl member of the param argument shall represent the - maximum number of replenishments that are allowed to be pending - simultaneously for the process scheduled under the SCHED_SPORADIC policy - - - If the scheduling policy of the target process is either SCHED_FIFO or - SCHED_RR, the sched_ss_low_priority, sched_ss_repl_period, and - sched_ss_init_budget members of the param argument shall have no effect on - the scheduling behavior - - - If the scheduling policy of the target process is not SCHED_FIFO, SCHED_RR, - or SCHED_SPORADIC, the effects of the sched_ss_low_priority, - sched_ss_repl_period, and sched_ss_init_budget members are - implementation-defined (this case includes the SCHED_OTHER policy) - - - If the current scheduling policy for the process specified by pid is not - SCHED_FIFO, SCHED_RR or SCHED_SPORADIC, the result is - implementation-defined; this case includes the SCHED_OTHER policy - - - For threads with system scheduling contention scope, this function shall have no effect on their scheduling - - - For threads with process scheduling contention scope, the threads' scheduling policy and associated parameters shall not be affected - - - The underlying kernel-scheduled entities for the system contention scope threads shall not be affected by this function - - - The underlying kernel-scheduled entities for the process contention scope - threads shall have their scheduling parameters changed to the value - specified in param - - - Kernel-scheduled entities for use by process contention scope threads that - are created after this call completes shall inherit their scheduling policy - and associated scheduling parameters from the process - - - If successful, the sched_setparam() function shall return zero - - - If the call to sched_setparam() is unsuccessful, the priority shall remain - unchanged - - - If the call to sched_setparam() is unsuccessful, the function shall return a - value of -1 - - - sched_setparam() sets errno == EINVAL when one or more of the requested - scheduling parameters is outside the range defined for the scheduling policy - of the specified pid - - - sched_setparam() sets errno == EPERM when the requesting process does not - have permission to set the scheduling parameters for the specified process, - or does not have the appropriate privilege to invoke schedparam() - - - sched_setparam() sets errno == ESRCH when no process can be found - corresponding to that specified by pid - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/coverage.txt deleted file mode 100644 index a52f24b4c8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setparam/coverage.txt +++ /dev/null @@ -1,33 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES -3 YES Behavior unspecified -4 YES -5 YES -6 YES Implementation-defined -7 YES may assertion -8 YES Only a stub. -9 YES -10 YES -11 YES -12 YES -13 YES -14 YES -15 YES Implementation-defined -16 YES Implementation-defined -17 YES Only a stub. -18 YES Only a stub. -19 YES Only a stub. -20 YES -21 YES -22 YES May need to be launch by root -23 YES -24 YES -25 YES -26 YES -27 YES Assume a pid is not immediatly reatributed diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/1-1.c deleted file mode 100644 index 073db7044f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/1-1.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setscheduler() sets the scheduling policy and scheduling - * parameters of the process specified by pid to policy and the parameters - * specified in the sched_param structure pointed to by param, respectively. - * - * For all policy describe in the spec, the test will check the policy and the - * param of the process after the call of sched_setscheduler. - */ -#include -#include -#include -#include -#include "posixtest.h" - -struct unique { - int value; - char *name; -} sym[] = { - - { - SCHED_FIFO, "SCHED_FIFO" - }, - { - SCHED_RR, "SCHED_RR" - }, -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) || defined(_POSIX_THREAD_SPORADIC_SERVER)&&(_POSIX_THREAD_SPORADIC_SERVER != -1) - { - SCHED_SPORADIC,"SCHED_SPORADIC" - }, -#endif - { - SCHED_OTHER, "SCHED_OTHER" - }, - { - 0, 0 - } -}; - -int main(int argc, char **argv) -{ - int tmp, policy, priority, result = PTS_PASS; - struct sched_param param; - struct unique *tst; - - tst = sym; - while (tst->name) { - fflush(stderr); - printf("Policy: %s\n", tst->name); - fflush(stdout); - - policy = tst->value; - priority = ( sched_get_priority_min(policy) + - sched_get_priority_max(policy) ) / 2; - param.sched_priority = priority; - - tmp = sched_setscheduler(getpid(), policy, ¶m); - - if(tmp == -1 || errno != 0) { - if(errno == EPERM){ - printf(" The process do not have permission to change its own scheduler\n Try to run this test as root.\n"); - } else { - printf(" Error calling sched_setscheduler() for %s policy\n", tst->name); - } - if(result != PTS_FAIL) result = PTS_UNRESOLVED; - tst++; - continue; - } - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("Error calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - if(policy != sched_getscheduler(getpid())){ - printf(" sched_setscheduler() does not set the policy to %s.\n", tst->name); - result = PTS_FAIL; - } - if(priority != param.sched_priority) { - printf(" sched_setscheduler() does not set the right param for %s policy.\n", tst->name); - result = PTS_FAIL; - } - - tst++; - } - - if(result == PTS_PASS) - printf("Test PASSED\n"); - return result; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/10-1.c deleted file mode 100644 index 9e86025b56..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/10-1.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the sched_ss_max_repl member of the param argument represent the - * maximum number of replenishments that are allowed to be pending - * simultaneously for the process scheduled under the SCHED_SPORADIC policy. - * - * @pt:SS - */ - -#include -#include -#include "posixtest.h" - -#ifdef _POSIX_SPORADIC_SERVER -int main() { - printf("Not yet tested.\n"); - return PTS_UNTESTED; -} - -#else -int main() { - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/11-1.c deleted file mode 100644 index 17ffcf954f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/11-1.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the sched_ss_low_priority, sched_ss_repl_period, and - * sched_ss_init_budget members of the param argument have no effect on the - * scheduling behavior if the scheduling policy of the target process is either - * SCHED_FIFO or SCHED_RR. - - * - * @pt:SS - */ - -#include -#include -#include "posixtest.h" - -#ifdef _POSIX_SPORADIC_SERVER -int main() { - printf("Not yet tested.\n"); - return PTS_UNTESTED; -} - -#else -int main() { - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/12-1.c deleted file mode 100644 index d7b3727278..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/12-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test that sched_setscheduler have no effect on the scheduling of - * threads with system scheduling contention scope. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that sched_setscheduler have no effect on the scheduling of\n threads with system scheduling contention scope.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/13-1.c deleted file mode 100644 index 9a4920299e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/13-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test that the threads scheduling policy and associated parameters - * are not affected. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that the threads scheduling policy and associated parameters\nare not affected.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/14-1.c deleted file mode 100644 index 414355c0d2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/14-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test that the underlying kernel-scheduled entities for the system - * contention scope threads are not be affected by this function. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that the underlying kernel-scheduled entities for the system\ncontention scope threads are not be affected by sched_setscheduler().\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/15-1.c deleted file mode 100644 index 660439735b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/15-1.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the underlying kernel-scheduled entities for the process - * contention scope threads have their scheduling policy changed to the - * value specified in param. - */ - - -#include -#include -#include -#include -#include -#include "posixtest.h" - - -void * runner(void * arg) { - - while(1) sleep(1); - return NULL; -} - -int main() { - int new_policy, policy, result; - struct sched_param param; - pthread_t tid; - pthread_attr_t attr; - - /* Make sure new policy != old policy */ - new_policy = (sched_getscheduler(getpid()) == SCHED_FIFO) ? - SCHED_RR : - SCHED_FIFO; - - if(pthread_attr_init(&attr) != 0) { - printf("An error occurs when calling pthread_attr_init()"); - return PTS_UNRESOLVED; - } - result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS); - if(result == ENOTSUP) { - printf("Process contention scope threads are not supported.\n"); - return PTS_UNSUPPORTED; - } else if(result != 0) { - printf("An error occurs when calling pthread_attr_setscope()"); - return PTS_UNRESOLVED; - } - if(pthread_create(&tid, &attr, runner, NULL) != 0) { - printf("An error occurs when calling pthread_create()"); - return PTS_UNRESOLVED; - } - - - param.sched_priority = sched_get_priority_min(new_policy); - if(sched_setscheduler(getpid(), new_policy, ¶m) != 0){ - if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling policy.\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } - perror("An error occurs when calling sched_setscheduler()"); - return PTS_UNRESOLVED; - } - - if(pthread_getschedparam(tid , &policy, ¶m) != 0) { - printf("An error occurs when calling pthread_getschedparam()"); - return PTS_UNRESOLVED; - } - - pthread_cancel(tid); - - if(policy == new_policy){ - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("sched_setscheduler() does not set the right policy.\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/15-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/15-2.c deleted file mode 100644 index 084d4606a2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/15-2.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the underlying kernel-scheduled entities for the process - * contention scope threads have their scheduling parameters changed to the - * value specified in param. - */ - - -#include -#include -#include -#include -#include -#include "posixtest.h" - - -void * runner(void * arg) { - - while(1) sleep(1); - return NULL; -} - -int main() { - int new_priority, max_priority, policy, result; - struct sched_param param; - pthread_t tid; - pthread_attr_t attr; - - if(sched_getparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - pthread_exit((void*)-1); - } - - /* Make sure new_priority != old priority */ - max_priority = sched_get_priority_max(SCHED_FIFO); - new_priority = (param.sched_priority == max_priority) ? - sched_get_priority_min(SCHED_FIFO) : - max_priority; - - if(pthread_attr_init(&attr) != 0) { - printf("An error occurs when calling pthread_attr_init()"); - return PTS_UNRESOLVED; - } - result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS); - if(result == ENOTSUP) { - printf("Process contention scope threads are not supported.\n"); - return PTS_UNSUPPORTED; - } else if(result != 0) { - printf("An error occurs when calling pthread_attr_setscope()"); - return PTS_UNRESOLVED; - } - if(pthread_create(&tid, &attr, runner, NULL) != 0) { - printf("An error occurs when calling pthread_create()"); - return PTS_UNRESOLVED; - } - - - param.sched_priority = new_priority; - if(sched_setscheduler(getpid(), SCHED_FIFO, ¶m) != 0){ - if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling policy.\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } - perror("An error occurs when calling sched_setscheduler()"); - return PTS_UNRESOLVED; - } - - if(pthread_getschedparam(tid , &policy, ¶m) != 0) { - printf("An error occurs when calling pthread_getschedparam()"); - return PTS_UNRESOLVED; - } - - pthread_cancel(tid); - - if(param.sched_priority == new_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("sched_setscheduler() does not set the right param.\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/16-1.c deleted file mode 100644 index 237e3ecf32..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/16-1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the function return the former scheduling policy of the specified - * process upon successful completion. - * - * Steps: - * 1. Get the old policy. - * 2. Set a new policy. - * 3. Check that sched_setscheduler return the old policy. - */ -#include -#include -#include -#include -#include "posixtest.h" - -int main(){ - int result, old_policy, new_policy; - struct sched_param param; - - old_policy = sched_getscheduler(getpid()); - if(old_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - /* Make sure new_policy != old_policy */ - new_policy = (old_policy == SCHED_FIFO) ? SCHED_RR : SCHED_FIFO; - - param.sched_priority = sched_get_priority_max(new_policy); - result = sched_setscheduler(0, new_policy, ¶m); - - if(result == old_policy){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result == -1 && errno == EPERM) { - printf("The process have not permission to change its own policy.\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } - - printf("Returned code == %i.\n", result); - perror("Unknow error"); - return PTS_FAIL; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-1.c deleted file mode 100644 index 73393bd5ae..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-1.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the policy and scheduling parameters remain unchanged when the - * sched_priority member is not within the inclusive priority range for the - * scheduling policy. - * - * Test is done for all policy defined in the spec into a loop. - * Steps (into loop): - * 1. Get the old policy and priority. - * 2. Call sched_setscheduler with invalid args. - * 3. Check that the policy and priority have not changed. - */ -#include -#include -#include -#include -#include "posixtest.h" - -struct unique { - int value; - char *name; -} sym[] = { - - { - SCHED_FIFO, "SCHED_FIFO" - }, - { - SCHED_RR, "SCHED_RR" - }, -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) || defined(_POSIX_THREAD_SPORADIC_SERVER)&&(_POSIX_THREAD_SPORADIC_SERVER != -1) - { - SCHED_SPORADIC,"SCHED_SPORADIC" - }, -#endif - { - SCHED_OTHER, "SCHED_OTHER" - }, - { - 0, 0 - } -}; - -int main(){ - int policy, invalid_priority, result = PTS_PASS; - int old_priority, old_policy, new_policy; - struct sched_param param; - - - struct unique *tst; - - tst = sym; - while (tst->name) { - policy = tst->value; - fflush(stderr); - printf("Policy: %s\n", tst->name); - fflush(stdout); - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - old_policy = sched_getscheduler(getpid()); - if(old_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - - invalid_priority = sched_get_priority_max(policy); - if(invalid_priority == -1){ - perror("An error occurs when calling sched_get_priority_max()"); - return PTS_UNRESOLVED; - } - - /* set an invalid priority */ - invalid_priority++; - param.sched_priority = invalid_priority; - - sched_setscheduler(0, policy, ¶m); - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - new_policy = sched_getscheduler(getpid()); - if(new_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - - if(old_policy == new_policy && - old_priority == param.sched_priority) { - printf(" OK\n"); - } else { - if(param.sched_priority != old_priority) { - printf(" The param has changed\n"); - } - if(new_policy != old_policy) { - printf(" The policy has changed\n"); - } - result = PTS_FAIL; - } - - tst++; - } - - if(result == PTS_PASS) { - printf("Test PASSED\n"); - } - return result; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-2.c deleted file mode 100644 index ae3c230198..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-2.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the policy and scheduling parameters remain unchanged when the - * sched_ss_low_priority member is not within the inclusive priority range for - * the sporadic server policy. - * - * Steps: - * 1. Get the old policy and priority. - * 2. Call sched_setscheduler with invalid args. - * 3. Check that the policy and priority have not changed. - * - * @pt:SS - */ -#include -#include -#include -#include -#include "posixtest.h" - - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int invalid_priority; - int old_priority, old_policy, new_policy; - struct sched_param param; - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - old_policy = sched_getscheduler(getpid()); - if(old_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - invalid_priority = sched_get_priority_max(SCHED_SPORADIC); - if(invalid_priority == -1){ - perror("An error occurs when calling sched_get_priority_max()"); - return PTS_UNRESOLVED; - } - - /* set an invalid priority */ - invalid_priority++; - param.sched_ss_low_priority = invalid_priority; - - sched_setscheduler(0, SCHED_SPORADIC, ¶m); - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - new_policy = sched_getscheduler(getpid()); - if(new_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - - if(old_policy == new_policy && - old_priority == param.sched_priority) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(param.sched_priority != old_priority) { - printf("The param has changed\n"); - } - if(new_policy != old_policy) { - printf("The policy has changed\n"); - } - return PTS_FAIL; - -} -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-3.c deleted file mode 100644 index 9198bec1a6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-3.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the policy and scheduling parameters remain unchanged when the - * sched_ss_repl_period is not greater than or equal to the - * sched_ss_init_budget member. - * - * Steps: - * 1. Get the old policy and priority. - * 2. Call sched_setscheduler with invalid args. - * 3. Check that the policy and priority have not changed. - * - * @pt:SS - */ -#include -#include -#include -#include -#include "posixtest.h" - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int policy, result; - int old_priority, old_policy, new_policy; - struct sched_param param; - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - old_policy = sched_getscheduler(getpid()); - if(old_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - /* set a sched_ss_repl_period lower than the sched_ss_init_budget */ - param.sched_ss_repl_period.tv_sec = 1; - param.sched_ss_repl_period.tv_nsec = 0; - - param.sched_ss_init_budget.tv_sec = 2; - param.sched_ss_init_budget.tv_nsec = 0; - - param.sched_priority = sched_get_priority_max(SCHED_SPORADIC); - - result = sched_setscheduler(0, SCHED_SPORADIC, ¶m); - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - new_policy = sched_getscheduler(getpid()); - if(new_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - - if(old_policy == new_policy && - old_priority == param.sched_priority) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(param.sched_priority != old_priority) { - printf("The param has changed\n"); - } - if(new_policy != old_policy) { - printf("The policy has changed\n"); - } - return PTS_FAIL; - - -} -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-4.c deleted file mode 100644 index d36b05b193..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-4.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the policy and scheduling parameters remain unchanged when - * the sched_ss_max_repl is not within the inclusive range [1,SS_REPL_MAX] - * - * Test with a sched_ss_max_repl value of 0. - * Steps: - * 1. Get the old policy and priority. - * 2. Call sched_setscheduler with invalid args. - * 3. Check that the policy and priority have not changed. - * - * @pt:SS - */ -#include -#include -#include -#include -#include "posixtest.h" - - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int max_priority, old_priority, old_policy, new_policy; - struct sched_param param; - - if(sched_getparam(getpid(), ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - old_policy = sched_getscheduler(getpid()); - if(old_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - /* Make sure that param.sched_priority != old_priority */ - max_priority = sched_get_priority_max(SCHED_SPORADIC); - param.sched_priority = (old_priority == max_priority) ? - sched_get_priority_min(SCHED_SPORADIC) : - max_priority; - - param.sched_ss_max_repl = 0; - - sched_setscheduler(0, SCHED_SPORADIC, ¶m); - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - new_policy = sched_getscheduler(getpid()); - if(new_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - if(old_policy == new_policy && - old_priority == param.sched_priority) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(param.sched_priority != old_priority) { - printf("The param has changed\n"); - return PTS_FAIL; - } - if(new_policy != old_policy) { - printf("The policy has changed\n"); - return PTS_FAIL; - } - -} -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-5.c deleted file mode 100644 index 870571bf4e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-5.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the policy and scheduling parameters remain unchanged when the - * policy value is not defined in the sched.h header. - * - * The test attempt to set the policy to a very improbable value. - * Steps: - * 1. Get the old policy and priority. - * 2. Call sched_setscheduler with invalid args. - * 3. Check that the policy and priority have not changed. - */ -#include -#include -#include -#include -#include "posixtest.h" - -int main(){ - int old_priority, old_policy, new_policy; - struct sched_param param; - int invalid_policy; - - invalid_policy = 0; - /* Linux does not treat minus value as invalid for policy */ - while(invalid_policy == SCHED_OTHER || - invalid_policy == SCHED_FIFO || - invalid_policy == SCHED_RR) - invalid_policy++; - - if(sched_getparam(getpid(), ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - old_policy = sched_getscheduler(getpid()); - if(old_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - sched_setscheduler(0, invalid_policy, ¶m); - - if(errno == 0) { - printf("No error occurs, could %i be a valid value for the scheduling policy ???\n", invalid_policy); - return PTS_UNRESOLVED; - } - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - new_policy = sched_getscheduler(getpid()); - if(new_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - - if(old_policy == new_policy && - old_priority == param.sched_priority) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(param.sched_priority != old_priority) { - printf("The param has changed\n"); - } - if(new_policy != old_policy) { - printf("The policy has changed\n"); - } - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-6.c deleted file mode 100644 index 6813f28ca8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-6.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the policy and scheduling parameters remain unchanged when the - * requesting process does not have permission to set the scheduling parameters - * for the specified process, or does not have the appropriate privilege to - * invoke sched_setscheduler(). - * - * Atempt to change the policy of the process whose ID is 1 which is generally - * belongs to root. This test can not be run by root. - * Steps: - * 1. Get the old policy and priority. - * 2. Call sched_setscheduler with pid arg == 1. - * 3. Check that the policy and priority have not changed. - */ -#include -#include -#include -#include -#include "posixtest.h" - - - -int main(){ - int max_priority, old_priority, old_policy, new_policy, policy; - struct sched_param param; - - /* We assume process Number 1 is created by root */ - /* and can only be accessed by root */ - /* This test should be run under standard user permissions */ - if (getuid() == 0) { - puts("Run this test case as a Regular User, but not ROOT"); - return PTS_UNTESTED; - } - - if(sched_getparam(getpid(), ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - old_policy = sched_getscheduler(getpid()); - if(old_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - /* Make sure that policy != old_policy */ - policy = old_policy == SCHED_FIFO ? SCHED_RR : SCHED_FIFO; - - /* Make sure that param.sched_priority != old_priority */ - max_priority = sched_get_priority_max(policy); - param.sched_priority = (old_priority == max_priority) ? - sched_get_priority_min(policy) : - max_priority; - - - sched_setscheduler(1, policy, ¶m); - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - new_policy = sched_getscheduler(getpid()); - if(new_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - - if(old_policy == new_policy && - old_priority == param.sched_priority) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(param.sched_priority != old_priority) { - printf("The param has changed\n"); - } - if(new_policy != old_policy) { - printf("The policy has changed\n"); - } - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-7.c deleted file mode 100644 index 6182ac178d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/17-7.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the policy and scheduling parameters remain unchanged when no - * process can be found corresponding to that specified by pid. - * - * The test create a child process which exit immediately and call - * sched_setscheduler with the pid of defunct child. - * Steps: - * 1. Get the old policy and priority. - * 2. Create a child process which exit immediately. - * 3. Wait for child to exit. - * 4. Call sched_setscheduler with the pid of defunct child. - * 5. Check that the policy and priority have not changed. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main(){ - int max_priority, old_priority, old_policy, new_policy, policy; - int child_pid, stat_loc; - struct sched_param param; - - if(sched_getparam(getpid(), ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - old_priority = param.sched_priority; - - old_policy = sched_getscheduler(getpid()); - if(old_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - /* Make sure that policy != old_policy */ - policy = old_policy == SCHED_FIFO ? SCHED_RR : SCHED_FIFO; - - /* Make sure that param.sched_priority != old_priority */ - max_priority = sched_get_priority_max(policy); - param.sched_priority = (old_priority == max_priority) ? - sched_get_priority_min(policy) : - max_priority; - - /* Create a child process which exit immediately */ - child_pid = fork(); - if(child_pid == -1){ - perror("An error occurs when calling fork()"); - return PTS_UNRESOLVED; - } else if (child_pid == 0){ - exit(0); - } - - /* Wait for the child process to exit */ - if(wait(&stat_loc) == -1){ - perror("An error occurs when calling wait()"); - return PTS_UNRESOLVED; - } - - /* Assume the pid is not yet reatributed to an other process */ - sched_setscheduler(child_pid, policy, ¶m); - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - new_policy = sched_getscheduler(getpid()); - if(new_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - - if(old_policy == new_policy && - old_priority == param.sched_priority) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(param.sched_priority != old_priority) { - printf("The param has changed\n"); - } - if(new_policy != old_policy) { - printf("The policy has changed\n"); - } - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/18-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/18-1.sh deleted file mode 100755 index dec7793122..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/18-1.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -# -# Test that sched_setscheduler() function return a value of -1 when it fails to -# complete successfully. -# -# This is tested implicitly via assertions 19, 20 and 21. - -echo "Tested implicitly via assertions 19, 20 and 21." -exit 0 \ No newline at end of file diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-1.c deleted file mode 100644 index 1d247a794b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-1.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setscheduler() sets errno == EINVAL when the sched_priority - * member is not within the inclusive priority range for the scheduling policy. - * - * Test is done for all policy defined in the spec into a loop. - */ -#include -#include -#include -#include -#include "posixtest.h" - -struct unique { - int value; - char *name; -} sym[] = { - - { - SCHED_FIFO, "SCHED_FIFO" - }, - { - SCHED_RR, "SCHED_RR" - }, -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) || defined(_POSIX_THREAD_SPORADIC_SERVER)&&(_POSIX_THREAD_SPORADIC_SERVER != -1) - { - SCHED_SPORADIC,"SCHED_SPORADIC" - }, -#endif - { - SCHED_OTHER, "SCHED_OTHER" - }, - { - 0, 0 - } -}; - -int main(){ - int policy, invalid_priority, tmp, result = PTS_PASS; - struct sched_param param; - - - struct unique *tst; - - tst = sym; - while (tst->name) { - policy = tst->value; - fflush(stderr); - printf("Policy: %s\n", tst->name); - fflush(stdout); - - invalid_priority = sched_get_priority_max(policy); - if(invalid_priority == -1){ - perror("An error occurs when calling sched_get_priority_max()"); - return PTS_UNRESOLVED; - } - - /* set an invalid priority */ - invalid_priority++; - param.sched_priority = invalid_priority; - - tmp = sched_setscheduler(0, policy, ¶m); - - if(tmp == -1 && errno == EINVAL) { - printf(" OK\n"); - } else if(tmp != -1) { - printf(" The returned code is not -1.\n"); - result = PTS_FAIL; - } else if(errno == EPERM) { - printf(" This process does not have the permission to set its own scheduling policy.\n Try to launch this test as root.\n"); - if(result != PTS_FAIL) { - result = PTS_UNRESOLVED; - } - } else { - perror(" Unknow error"); - result = PTS_FAIL; - } - - tst++; - } - - if(result == PTS_PASS) { - printf("Test PASSED\n"); - } - return result; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-2.c deleted file mode 100644 index 04f5caa172..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-2.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setscheduler() sets errno == EINVAL when the - * sched_ss_low_priority member is not within the inclusive priority range for - * the sporadic server policy. - * - * @pt:SS - */ - - -#include -#include -#include -#include "posixtest.h" - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int invalid_priority, result; - struct sched_param param; - - invalid_priority = sched_get_priority_max(SCHED_SPORADIC); - if(invalid_priority == -1){ - perror("An error occurs when calling sched_get_priority_max()"); - return PTS_UNRESOLVED; - } - - /* set an invalid priority */ - invalid_priority++; - param.sched_ss_low_priority = invalid_priority; - - result = sched_setscheduler(0, SCHED_SPORADIC, ¶m); - - if(result == -1 && errno == EINVAL){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != -1) { - printf("The returned code is not -1.\n"); - return PTS_FAIL; - } else if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling policy.\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } else { - perror("Unknow error"); - return PTS_FAIL; - } -} -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-3.c deleted file mode 100644 index 3a46ce39ca..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-3.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setscheduler() sets errno == EINVAL when the - * sched_ss_repl_period is not greater than or equal to the - * sched_ss_init_budget member. - * - * @pt:SS - */ -#include -#include -#include -#include -#include "posixtest.h" - - - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int policy, result; - struct sched_param param; - - if(sched_getparam(0, ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - /* set a sched_ss_repl_period lower than the sched_ss_init_budget */ - param.sched_ss_repl_period.tv_sec = 1; - param.sched_ss_repl_period.tv_nsec = 0; - - param.sched_ss_init_budget.tv_sec = 2; - param.sched_ss_init_budget.tv_nsec = 0; - - param.sched_priority = sched_get_priority_max(SCHED_SPORADIC); - - result = sched_setscheduler(0, SCHED_SPORADIC, ¶m); - - if(result == -1 && errno == EINVAL){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != -1) { - printf("The returned code is not -1.\n"); - return PTS_FAIL; - } else if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling policy.\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } - perror("Unknow error"); - return PTS_FAIL; -} -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-4.c deleted file mode 100644 index 9f92b2c70b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-4.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setscheduler() sets errno == EINVAL when - * the sched_ss_max_repl is not within the inclusive range [1,SS_REPL_MAX] - * - * Test the values 0 and SS_REPL_MAX+1. - * - * @pt:SS - */ -#include -#include -#include -#include -#include "posixtest.h" - - -#if defined(_POSIX_SPORADIC_SERVER)&&(_POSIX_SPORADIC_SERVER != -1) - -int main(){ - int policy, result; - int result_code = PTS_PASS; - struct sched_param param; - - if(sched_getparam(0, ¶m) == -1) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - param.sched_priority = sched_get_priority_max(SCHED_SPORADIC); - - /* test when sched_ss_max_repl < 1 */ - param.sched_ss_max_repl = 0; - result = sched_setscheduler(0, SCHED_SPORADIC, ¶m); - - if(result != -1) { - printf("The returned code is not -1 when sched_ss_max_repl < 1.\n"); - result_code = PTS_FAIL; - } else if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling policy.\nTry to launch this test as root.\n"); - result_code = PTS_UNRESOLVED; - } else if(errno != EINVAL) { - perror("Unknow error when testing sched_ss_max_repl < 1"); - result_code = PTS_FAIL; - } - - /* test when sched_ss_max_repl > SS_REPL_MAX */ - param.sched_ss_max_repl = SS_REPL_MAX+1; - result = sched_setscheduler(0, SCHED_SPORADIC, ¶m); - - if(result == -1 && errno == EINVAL) { - if(result_code == PTS_PASS){ - printf("Test PASSED\n"); - } - return result_code; - } else if(result != -1) { - printf("The returned code is not -1 when sched_ss_max_repl > SS_REPL_MAX.\n"); - return PTS_FAIL; - } else if(errno == EPERM) { - if(result_code == PTS_FAIL){ - printf("This process does not have the permission to set its own scheduling parameter.\nTry to launch this test as root.\n"); - return PTS_FAIL; - } - return PTS_UNRESOLVED; - } else { - perror("Unknow error when testing sched_ss_max_repl > SS_REPL_MAX"); - return PTS_FAIL; - } - - -} -#else -int main() -{ - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-5.c deleted file mode 100644 index 501ffb7eb1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/19-5.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setscheduler() sets errno == EINVAL when the policy value is - * not defined in the sched.h header. - * - * Assume that the header does not defined a scheduling policy with a value - * of -1. (It is more coherent with the specificationS of sched_getscheduler - * and sched_setscheduler for which the result code -1 indicate an error.) - * If no error occurs whith -1, the test will run sched_setscheduler with the - * very improbable policy value INVALID_POLICY. - */ -#include -#include -#include -#include -#include "posixtest.h" - - -/* There is no chance that a scheduling policy has such a value */ -#define INVALID_POLICY -27367 - -int main(){ - int result; - struct sched_param param; - - param.sched_priority = 0; - - result = sched_setscheduler(0, -1, ¶m); - - if(result == -1 && errno == EINVAL){ - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno == EPERM){ - printf("This process does not have the permission to set its own scheduling policy.\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } else if(errno == 0) { - printf("No error occurs, check if -1 a valid value for the scheduling policy.\n"); - } else { - perror("Unknow error"); - return PTS_FAIL; - } - - printf("Testing with very improbable policy value %i:\n", - INVALID_POLICY); - - result = sched_setscheduler(0, INVALID_POLICY, ¶m); - - if(result == -1 && errno == EINVAL){ - printf("Test PASSED with policy value %i\n", INVALID_POLICY); - return PTS_PASS; - } else if(errno == 0) { - printf("No error occurs, could %i be a valid value for the scheduling policy ???\n", INVALID_POLICY); - return PTS_UNRESOLVED; - } else { - perror("Unknow error"); - return PTS_FAIL; - } - - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/2-1.c deleted file mode 100644 index b49a126fb8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/2-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the behavior of sched_setscheduler() when pid is negative - * because it is unspecified. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the behavior of sched_setscheduler() when pid is negative\n because it is unspecified.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/20-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/20-1.c deleted file mode 100644 index a91d73635b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/20-1.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setscheduler() sets errno == EPERM when the requesting - * process does not have permission to set the scheduling parameters for the - * specified process, or does not have the appropriate privilege to invoke - * sched_setscheduler(). - * - * Atempt to change the policy of the process whose ID is 1 which is generally - * belongs to root. This test can not be run by root. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -/** Set the euid of this process to a non-root uid */ -int set_nonroot() -{ - struct passwd *pw; - setpwent(); - /* search for the first user which is non root */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root")) - break; - endpwent(); - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return 1; - } - - if(setuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\n"); - return 1; - } - perror("An error occurs when calling seteuid()"); - return 1; - } - - printf("Testing with user '%s' (euid: %d)(uid: %d)\n", - pw->pw_name, (int)geteuid(), (int)getuid()); - return 0; -} - - -int main(){ - int result; - struct sched_param param; - - /* We assume process Number 1 is created by root */ - /* and can only be accessed by root */ - /* This test should be run under standard user permissions */ - if (getuid() == 0) { - if (set_nonroot() != 0) { - printf("Cannot run this test as non-root user\n"); - return PTS_UNTESTED; - } - } - - param.sched_priority = sched_get_priority_max(SCHED_FIFO); - - result = sched_setscheduler(1, SCHED_FIFO, ¶m); - - if(result == -1 && errno == EPERM) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(errno != EPERM) { - perror("errno is not EPERM"); - return PTS_FAIL; - } else { - printf("The returned code is not -1.\n"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/21-1.c deleted file mode 100644 index 3e198d6dd3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/21-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that sched_setscheduler() sets errno == ESRCH when no process can be - * found corresponding to that specified by pid. - * - * The test create a child process which exit immediately and call - * sched_setscheduler with the pid of defunct child. - */ -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main(){ - int result, child_pid, stat_loc; - struct sched_param param; - - param.sched_priority = sched_get_priority_max(SCHED_FIFO); - - /* Create a child process which exit immediately */ - child_pid = fork(); - if(child_pid == -1){ - perror("An error occurs when calling fork()"); - return PTS_UNRESOLVED; - } else if (child_pid == 0){ - exit(0); - } - - /* Wait for the child process to exit */ - if(wait(&stat_loc) == -1){ - perror("An error occurs when calling wait()"); - return PTS_UNRESOLVED; - } - - /* Assume the pid is not yet reatributed to an other process */ - result = sched_setscheduler(child_pid, SCHED_FIFO, ¶m); - - if(result == -1 && errno == ESRCH) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != -1) { - printf("The returned code is not -1.\n"); - return PTS_FAIL; - } else if (errno == EPERM) { - printf("This process does not have the permission to invoke sched_setscheduler().\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } else { - perror("errno is not ESRCH"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/22-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/22-1.c deleted file mode 100644 index 37f577825e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/22-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the underlying kernel-scheduled entities for the process - * contention scope threads that are created after this call completes inherit - * their scheduling policy from the process. - */ - - -#include -#include -#include -#include -#include -#include "posixtest.h" - - -void * runner(void * arg) { - - while(1) sleep(1); - return NULL; -} - -int main() { - int new_policy, policy, result; - struct sched_param param; - pthread_t tid; - pthread_attr_t attr; - - if(sched_getparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - pthread_exit((void*)-1); - } - - /* Make sure new policy != old policy */ - new_policy = (sched_getscheduler(getpid()) == SCHED_FIFO) ? - SCHED_RR : - SCHED_FIFO; - - param.sched_priority = sched_get_priority_min(new_policy); - if(sched_setscheduler(getpid(), new_policy, ¶m) != 0){ - if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling policy.\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } - perror("An error occurs when calling sched_setscheduler()"); - return PTS_UNRESOLVED; - } - - if(pthread_attr_init(&attr) != 0) { - printf("An error occurs when calling pthread_attr_init()"); - return PTS_UNRESOLVED; - } - result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS); - if(result == ENOTSUP) { - printf("Process contention scope threads are not supported.\n"); - return PTS_UNSUPPORTED; - } else if(result != 0) { - printf("An error occurs when calling pthread_attr_setscope()"); - return PTS_UNRESOLVED; - } - if(pthread_create(&tid, &attr, runner, NULL) != 0) { - printf("An error occurs when calling pthread_create()"); - return PTS_UNRESOLVED; - } - - - if(pthread_getschedparam(tid , &policy, ¶m) != 0) { - printf("An error occurs when calling pthread_getschedparam()"); - return PTS_UNRESOLVED; - } - - pthread_cancel(tid); - - if(policy == new_policy){ - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("The thread does not inherit the right policy.\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/22-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/22-2.c deleted file mode 100644 index bbf22f3853..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/22-2.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the underlying kernel-scheduled entities for the process - * contention scope threads that are created after this call completes inherit - * their scheduling parameters from the process. - */ - - -#include -#include -#include -#include -#include -#include "posixtest.h" - - -void * runner(void * arg) { - - while(1) sleep(1); - return NULL; -} - -int main() { - int new_priority, max_priority, policy, result; - struct sched_param param; - pthread_t tid; - pthread_attr_t attr; - - if(sched_getparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - pthread_exit((void*)-1); - } - /* Make sure new_priority != old_priority */ - max_priority = sched_get_priority_max(SCHED_FIFO); - new_priority = (param.sched_priority == max_priority) ? - sched_get_priority_min(SCHED_FIFO) : - max_priority; - param.sched_priority = new_priority; - if(sched_setscheduler(getpid(), SCHED_FIFO, ¶m) != 0){ - if(errno == EPERM) { - printf("This process does not have the permission to set its own scheduling policy.\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } - perror("An error occurs when calling sched_setscheduler()"); - return PTS_UNRESOLVED; - } - - - if(pthread_attr_init(&attr) != 0) { - printf("An error occurs when calling pthread_attr_init()"); - return PTS_UNRESOLVED; - } - result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS); - if(result == ENOTSUP) { - printf("Process contention scope threads are not supported.\n"); - return PTS_UNSUPPORTED; - } else if(result != 0) { - printf("An error occurs when calling pthread_attr_setscope()"); - return PTS_UNRESOLVED; - } - if(pthread_create(&tid, &attr, runner, NULL) != 0) { - printf("An error occurs when calling pthread_create()"); - return PTS_UNRESOLVED; - } - - - if(pthread_getschedparam(tid , &policy, ¶m) != 0) { - printf("An error occurs when calling pthread_getschedparam()"); - return PTS_UNRESOLVED; - } - - pthread_cancel(tid); - - if(param.sched_priority == new_priority){ - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("The thread does not inherit the right param.\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/3-1.sh deleted file mode 100755 index f8533b850f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/3-1.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Test that the scheduling policy and scheduling parameters are set for the -# process whose process ID is equal to pid when such a process exists and the -# the calling process has permission. -# -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1." -exit 0 \ No newline at end of file diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/4-1.c deleted file mode 100644 index 7eebac496b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/4-1.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the scheduling policy and scheduling parameters are set for - * the calling process when pid == 0. - */ -#include -#include -#include -#include -#include "posixtest.h" - -int main(){ - int result, new_priority, old_priority, max_prio; - int old_policy, new_policy, test_policy; - struct sched_param param; - - if(sched_getparam(getpid(), ¶m) != 0) { - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - old_policy = sched_getscheduler(getpid()); - if(old_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - /* Make sure new_policy != old_policy */ - new_policy = (old_policy == SCHED_FIFO) ? SCHED_RR : SCHED_FIFO; - - /* Make sure new_priority != old_priority */ - max_prio = sched_get_priority_max(new_policy); - old_priority = param.sched_priority; - new_priority = (old_priority == max_prio) ? - (param.sched_priority = sched_get_priority_min(new_policy)) : - (param.sched_priority = max_prio); - - result = sched_setscheduler(0, new_policy, ¶m); - - if(sched_getparam(getpid(), ¶m) != 0){ - perror("An error occurs when calling sched_getparam()"); - return PTS_UNRESOLVED; - } - - test_policy = sched_getscheduler(getpid()); - if(test_policy == -1) { - perror("An error occurs when calling sched_getscheduler()"); - return PTS_UNRESOLVED; - } - - if(result != -1 && param.sched_priority == new_priority && - test_policy == new_policy) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(result != -1 && - (param.sched_priority == old_priority || - test_policy == old_policy)) { - if(param.sched_priority == old_priority) { - printf("The param does not change\n"); - } - if(test_policy == old_policy) { - printf("The policy does not change\n"); - } - return PTS_FAIL; - } else if(result == -1 && errno == EPERM) { - printf("The process have not permission to change its own policy.\nTry to launch this test as root.\n"); - return PTS_UNRESOLVED; - } - - perror("Unknow error"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/5-1.c deleted file mode 100644 index 13704bfeb0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/5-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the condition under which one process has the appropriate - * privilege to change the scheduling parameters of another process because - * they are implementation-defined. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the condition under which one process has the appropriate\nprivilege to change the scheduling parameters of another process because \nthey are implementation-defined.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/6-1.c deleted file mode 100644 index 022fd74e93..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/6-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test that implementations may require that the requesting process - * have permission to set its own scheduling parameters or those of another - * process. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that implementations may require that the requesting process\nhave permission to set its own scheduling parameters or those of another\nprocess.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/7-1.c deleted file mode 100644 index bd6412b0cf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/7-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test if implementation-defined restrictions apply as to the - * appropriate privileges required to set a process' own scheduling policy, or - * another process' scheduling policy, to a particular value. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test if implementation-defined restrictions apply as to the\nappropriate privileges required to set a process' own scheduling policy, or\nanother process' scheduling policy, to a particular value.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/8-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/8-1.sh deleted file mode 100755 index 5100883884..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/8-1.sh +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh -# -# Test that the sched_setscheduler() function is considered successful when it -# succeeds in setting the scheduling policy and scheduling parameters of the -# process specified by pid to the values specified by policy and the structure -# pointed to by param, respectively. -# -# This is tested implicitly via assertions 1 and 4. - -echo "Tested implicitly via assertions 1 and 4." -exit 0 \ No newline at end of file diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/9-1.c deleted file mode 100644 index 06e3fa0871..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/9-1.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the sched_ss_repl_period and sched_ss_init_budget members of the - * param argument represent the time parameters to be used by the sporadic - * server scheduling policy for the target process. - * - * @pt:SS - */ - -#include -#include -#include "posixtest.h" - -#ifdef _POSIX_SPORADIC_SERVER -int main() { - printf("Not yet tested.\n"); - return PTS_UNTESTED; -} - -#else -int main() { - printf("Does not support SS (SPORADIC SERVER)\n"); - return PTS_UNSUPPORTED; -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/assertions.xml deleted file mode 100644 index 6434130643..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/assertions.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - sched_setscheduler() sets the scheduling policy and scheduling parameters of - the process specified by pid to policy and the parameters specified in the - sched_param structure pointed to by param, respectively - - - If pid is negative, the behavior of sched_setscheduler() is unspecified - - - If a process specified by pid exists, and if the calling process has - permission, the scheduling policy and scheduling parameters shall be set for - the process whose process ID is equal to pid - - - If pid is zero, the scheduling policy and scheduling parameters shall be set - for the calling process - - - The condition under which one process has the appropriate privilege to - change the scheduling parameters of another process are - implementation-defined - - - Implementations may require that the requesting process have permission to - set its own scheduling parameters or those of another process - - - Implementation-defined restrictions may apply as to the appropriate - privileges required to set a process' own scheduling policy, or another - process' scheduling policy, to a particular value - - - The sched_setscheduler() function shall be considered successful if it - succeeds in setting the scheduling policy and scheduling parameters of the - process specified by pid to the values specified by policy and the structure - pointed to by param, respectively - - - The sched_ss_repl_period and sched_ss_init_budget members of the param - argument shall represent the time parameters used by the sporadic server - scheduling policy for the target process - - - The sched_ss_max_repl member of the param argument shall represent the - maximum number of replenishments that are allowed to be pending - simultaneously for the process scheduled under this scheduling policy - - - If the scheduling policy specified by policy is either SCHED_FIFO or - SCHED_RR, the sched_ss_low_priority, sched_ss_repl_period, and - sched_ss_init_budget members of the param argument shall have no effect on - the scheduling behavior - - - For threads with system scheduling contention scope, this function shall - have no effect on their scheduling - - - For threads with process scheduling contention scope, the threads' - scheduling policy and associated parameters shall not be affected - - - The underlying kernel-scheduled entities for the system contention scope - threads shall not be affected by this function - - - The underlying kernel-scheduled entities for the process contention scope - threads shall have their scheduling policy and associated scheduling - parameters changed to the values specified in policy and param, - respectively - - - Upon successful completion, the function shall return the former scheduling policy of the specified process - - - If the sched_setscheduler() function fails to complete successfully, the - policy and scheduling parameters shall remain unchanged - - - If the sched_setscheduler() function fails to complete successfully, the - function shall return a value of -1 - - - The sched_setscheduler() function shall return EINVAL if the value of the - policy parameter is invalid, or one or more of the parameters contained in - param is outside the valid range for the specified scheduling policy - - - The sched_setscheduler() function shall return EPERM if the requesting - process does not have permission to set either or both of the scheduling - parameters or the scheduling policy of the specified process - - - The sched_setscheduler() function shall return ESRCH if no process can be - found corresponding to that specified by pid - - - - Kernel-scheduled entities for use by process contention scope threads that - are created after this call completes shall inherit their scheduling policy - and associated scheduling parameters from the process - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/coverage.txt deleted file mode 100644 index 3ebd709096..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_setscheduler/coverage.txt +++ /dev/null @@ -1,28 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES Behavior unspecified -3 YES -4 YES -5 YES Implementation-defined -6 YES may assertion -7 YES Implementation-defined -8 YES -9 YES -10 YES -11 YES -12 YES -13 YES -14 YES -15 YES -16 YES -17 YES -18 YES -19 YES -20 YES -21 YES -22 YES \ No newline at end of file diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/1-1.c deleted file mode 100644 index 7437e0aa96..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/1-1.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * Test that the running thread relinquish the processor until it again becomes - * the head of its thread list. - * - * Steps: - * 1. Set the policy to SCHED_FIFO. - * 2. Launch as many processes as number CPU minus 1. These processses set - * their priority to the max and block all but 1 processor. - * 3. Launch a thread which increase a counter in a infinite loop. - * 4. Launch a thread which call sched_yield() and check that the counter has - * changed since the call. - */ -#define LINUX - -#ifdef LINUX -#define _GNU_SOURCE -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#ifdef BSD -# include -# include -# include -#endif - -#ifdef HPUX -# include -# include -#endif - - -#define LOOP 1000 /* Shall be >= 1 */ - - -volatile int nb_call = 0; - -/* Get the number of CPUs */ -int get_ncpu() { - int ncpu = -1; - - /* This syscall is not POSIX but it should work on many system */ -#ifdef _SC_NPROCESSORS_ONLN - ncpu = sysconf(_SC_NPROCESSORS_ONLN); -#else -# ifdef BSD - int mib[2]; - size_t len = sizeof(ncpu); - mib[0] = CTL_HW; - mib[1] = HW_NCPU; - sysctl(mib, 2, &ncpu, &len, NULL, 0); -# else -# ifdef HPUX - struct pst_dynamic psd; - pstat_getdynamic(&psd, sizeof(psd), 1, 0); - ncpu = (int)psd.psd_proc_cnt; -# endif /* HPUX */ -# endif /* BSD */ -#endif /* _SC_NPROCESSORS_ONLN */ - - return ncpu; -} - -#ifdef LINUX -int set_process_affinity(int cpu) -{ - int retval = -1; - cpu_set_t cpu_mask; - - CPU_ZERO(&cpu_mask); - if (cpu >= 0 && cpu <= CPU_SETSIZE) { - CPU_SET(cpu, &cpu_mask); - } else { - fprintf (stderr, "Wrong cpu id: %d\n", cpu); - return -1; - } - -//#ifndef P2_SCHED_SETAFFINITY - retval = sched_setaffinity(0, sizeof(cpu_mask), &cpu_mask); -//#else -// retval = sched_setaffinity(0, &cpu_mask); -//#endif - if (retval == -1) - perror("Error at sched_setaffinity()"); - - return retval; -} - -int set_thread_affinity(int cpu) -{ - int retval = -1; - cpu_set_t cpu_mask; - - CPU_ZERO(&cpu_mask); - if (cpu >= 0 && cpu <= CPU_SETSIZE) { - CPU_SET(cpu, &cpu_mask); - } else { - fprintf (stderr, "Wrong cpu id: %d\n", cpu); - return -1; - } -//#ifndef P2_PTHREAD_SETAFFINITY - retval = pthread_setaffinity_np(pthread_self(), - sizeof(cpu_mask), &cpu_mask); -//#else -// retval = pthread_setaffinity_np(pthread_self(), &cpu_mask); -//#endif - if (retval != 0) - fprintf (stderr, "Error at pthread_setaffinity_np():\n"); - return retval; -} - -#endif - -void * runner(void * arg) { - int i=0, nc; - long result = 0; -#ifdef LINUX - set_thread_affinity(*(int *)arg); - fprintf(stderr, "%ld bind to cpu: %d\n", pthread_self(), *(int*)arg); -#endif - - for(;i -#include -#include "posixtest.h" - -int main() { - if(sched_yield() == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("sched_yield() does not return 0.\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/3-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/3-1.sh deleted file mode 100755 index 929202702e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/3-1.sh +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/sh -# Test that sched_yield() returns -1 on failure. -# -# The function shall always succeed, so nothing can be done for this test. - -echo "Nothing to do for this test, the function shall always succeed." -exit 0 \ No newline at end of file diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/assertions.xml deleted file mode 100644 index b773ccee72..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/assertions.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - The sched_yield() function shall force the running thread to relinquish the - processor until it again becomes the head of its thread list. - - - sched_yield() returns 0 on success - - - sched_yield() returns -1 on failure - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/coverage.txt deleted file mode 100644 index 71297cc2f9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sched_yield/coverage.txt +++ /dev/null @@ -1,9 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES -3 YES The function shall always succeed. \ No newline at end of file diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/1-1.c deleted file mode 100644 index ef82c6c947..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/1-1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (c) 2002, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - sem_close test case that attempts to close an open semaphore, - close the semaphore and verify that close_sem returns 0. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "sem_close" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0700, 1) ; - if (mysemp == SEM_FAILED) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if ((sem_close(mysemp)) == 0) { - puts("TEST PASSED"); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/2-1.c deleted file mode 100644 index 4d40cfdcfc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/2-1.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (c) 2002, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - This case verifies that sem_close deallocate resources, and then the - semaphore is available for reuse. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "sem_close" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() -{ - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 1); - - if (mysemp == SEM_FAILED ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - /* Deallocate mysemp */ - if ((sem_close(mysemp)) == -1) { - return PTS_UNRESOLVED; - } - - /* Make mysemp available for reuse */ - mysemp = sem_open(semname, O_CREAT, 0777, 1); - - if (mysemp == SEM_FAILED ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - - if ((sem_close(mysemp)) == 0) { - puts("TEST PASSED"); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/3-1.c deleted file mode 100644 index 3991291858..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/3-1.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (c) 2002, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - sem_close will have no effect on the state of the semaphore if - sem_unlink has been unsuccessful. -*/ - - - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-1" -#define FUNCTION "sem_close" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0444, 1) ; - if (mysemp == SEM_FAILED) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if ((sem_unlink(semname)) == 0) { - if ( sem_close(mysemp) == -1) { - perror(ERROR_PREFIX "sem_close"); - return PTS_UNRESOLVED; - } - puts("TEST PASSED"); - return PTS_PASS; - } else { - - puts("TEST FAILED"); - return PTS_FAIL; - } -} - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/3-2.c deleted file mode 100644 index 820401ba21..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/3-2.c +++ /dev/null @@ -1,181 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* If sem_unlink has not been called after sem_open for this semaphore, -* the function has no effect on the semaphore. - - -* The steps are: -* -> open a semaphore with a value of 2. -* -> wait the semaphore (now value = 1) -* -> close the semaphore. -* -> open the semaphore again (with dummy value = 3) -* -> check the value is 1. -* -> close the semaphore. -* -> unlink the semaphore. - -* The test fails if the semaphore value is not 1 after semaphore is reopened. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SEM_NAME "/sem_close_3_2" - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, value; - - sem_t * sem; - - /* Initialize output */ - output_init(); - - /* Create the semaphore */ - sem = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 2 ); - - if ( ( sem == SEM_FAILED ) && ( errno == EEXIST ) ) - { - sem_unlink( SEM_NAME ); - sem = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 2 ); - } - - if ( sem == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to create the semaphore" ); - } - - /* Use the semaphore to change its value. */ - do - { - ret = sem_wait( sem ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to wait for the semaphore" ); - } - - /* Here, count is 1. Now, close the semaphore */ - ret = sem_close( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close the semaphore" ); - } - - /* Open the semaphore again */ - sem = sem_open( SEM_NAME, O_CREAT, 0777, 3 ); - - if ( sem == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to re-open the semaphore" ); - } - - /* Check current semaphore count */ - ret = sem_getvalue( sem, &value ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to get semaphore value" ); - } - - if ( value != 1 ) - { - output( "Got value: %d\n", value ); - FAILED( "The semaphore count has changed after sem_close" ); - } - - /* Now, we can destroy all */ - ret = sem_close( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close the semaphore" ); - } - - ret = sem_unlink( SEM_NAME ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink the semaphore" ); - } - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/assertions.xml deleted file mode 100644 index 9e0881ad40..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/assertions.xml +++ /dev/null @@ -1,17 +0,0 @@ - - -sem_close will return zero after successful completion. - - -sem_close will deallocate system resources allocated by sem_open for the -same semaphore. - - -sem_close will have no effect on the state of the semaphore if sem_unlink -has not been called on this semaphore. - - -Calling sem_close with an invalid semaphore descriptor may result in a -sem_close returning -1 and errno being set to EINVAL. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/cln.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/cln.sh deleted file mode 100755 index 7d9df9e06f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/cln.sh +++ /dev/null @@ -1,8 +0,0 @@ - -rm -f /tmp/sem_* >/dev/null 2>&1 -rm -f a.out >/dev/null 2>&1 - -for sem_id in `ipcs -s | awk '{print $2}'` ; do - ipcrm sem $sem_id > /dev/null 2>&1 -done - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/coverage.txt deleted file mode 100644 index 8ea2e6ba92..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/coverage.txt +++ /dev/null @@ -1,6 +0,0 @@ - -assertion 4: -TEST WAS REMOVED: based on the Austin Group mailing list traffic "That -implemntation is not required to detect invalid parameters". May be some one -else could figure out a way to write a test case for it. - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_close/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/3-1.c deleted file mode 100644 index 74f8f25f8b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/3-1.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Test case vrifies sem_destroy shall destroy on intialized semaphore - * upon which no threads are currently blocked. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-1" -#define FUNCTION "sem_destroy" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -sem_t psem, csem; -int n; - -int main() -{ - pthread_t prod, cons; - void *producer(void *); - void *consumer(void *); - long cnt = 3; - - n = 0; - if (sem_init(&csem, 0, 0) < 0) { - perror("sem_init"); - return PTS_UNRESOLVED; - } - if (sem_init(&psem, 0, 1) < 0) { - perror("sem_init"); - return PTS_UNRESOLVED; - } - if (pthread_create(&prod, NULL, producer, (void *)cnt) != 0) { - perror("pthread_create"); - return PTS_UNRESOLVED; - } - if (pthread_create(&cons, NULL, consumer, (void *)cnt) != 0) { - perror("pthread_create"); - return PTS_UNRESOLVED; - } - - if (( pthread_join(prod, NULL) == 0) && ( pthread_join(cons, NULL) == 0)) { - puts("TEST PASS"); - pthread_exit(NULL); - if (( sem_destroy(&psem) == 0) &&( sem_destroy (&csem)) == 0 ) - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - - -void * producer(void *arg) -{ - int i, cnt; - cnt = (long)arg; - for (i=0; i -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "sem_destroy" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main () -{ - sem_t mysemp; - - if ( sem_init(&mysemp, 0, 0) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - - if (sem_destroy(&mysemp) == 0 ) { - puts("TEST PASSED"); - return PTS_PASS; - } else { - puts("TEST FAILED: couldn't destroy sempahore."); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/assertions.xml deleted file mode 100644 index 77acfefe27..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/assertions.xml +++ /dev/null @@ -1,26 +0,0 @@ - - -sem_destroy shall destroy the unamed semaphore indicated by sem. - - -sem_destroy shall destroy an initialized semaphore upon which no threads -are currently blocked. - - -sem_destroy return 0 on successful completion, otherwise, -1 returned -with errno set. - - -EINVAL: the sem argument is not valid semaphore. - - -EBUSY: there are currently processes blocked on the semaphore. - - -The effect of calling sem_destroy on named semaphore is undefined. - - -The effect of destroying a semaphore upon which other threads are -currently blocked is undefined. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/cln.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/cln.sh deleted file mode 100755 index 880838525b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/cln.sh +++ /dev/null @@ -1,9 +0,0 @@ - -rm -f /tmp/mysem >/dev/null 2>&1 -rm -f /tmp/sem_* >/dev/null 2>&1 -rm -f a.out - -for sem_id in `ipcs -s | awk '{print $2}'` ; do - ipcrm sem $sem_id > /dev/null 2>&1 -done - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/coverage.txt deleted file mode 100644 index 87c6a48baa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_destroy/coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ --- assertion 5: not tested. - --- assertion 6: ERROR EBUSY: is not tested. Please contribute -your help for this test case. - --- assertion 7: Won't be tested. (Undefined). - --- assertion 8: Won't be tested. (Undefined). diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/1-1.c deleted file mode 100644 index 1fb3702320..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/1-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * This test case will call sem_getvalue to update the location referenced - * by the semaphpre without effecting the state of the semaphore. The - * updated value represents the actual semaphore value when it was called. -*/ - - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "sem_getvalue" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() { - - char semname[50]; - sem_t *mysemp; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 1); - - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if( sem_getvalue(mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - /* - printf("Current value is: %d\n", val); - */ - if (val == 1 ) { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/2-1.c deleted file mode 100644 index 61aa02642f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/2-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * When semaphore is locked, then the value returned by sem_getvalue is zero. -*/ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "sem_getvalue" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() { - - char semname[50]; - sem_t *mysemp; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 1); - - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - /* Lock Semaphore */ - if (sem_trywait(mysemp) == -1 ) { - perror(ERROR_PREFIX "trywait"); - return PTS_UNRESOLVED; - } - - if( sem_getvalue(mysemp, &val) < 0 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - /* - printf("Current value is: %d\n", val); - */ - - if (val <= 0 ) { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/2-2.c deleted file mode 100644 index 5918cebe60..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/2-2.c +++ /dev/null @@ -1,183 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* If the semaphore is locked, the sval value is set to 0 or to a negative -* value representing the number of waiters for the semaphore. - - -* The steps are: -* -> init a semaphore (value = 0) -* -> create a thread which waits for the semaphore -* -> call sem_getvalue and check value of the semaphore -* -> sem_post and destroy everything - -* The test fails if value is not as expected. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -void * threaded ( void * arg ) -{ - int ret; - - do - { - ret = sem_wait( arg ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to wait for the semaphore" ); - } - - return NULL; -} - - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, val; - sem_t sem; - pthread_t th; - - /* Initialize output */ - output_init(); - - /* Initialize semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to init semaphore" ); - } - - /* Create the thread */ - ret = pthread_create( &th, NULL, threaded, &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create the thread" ); - } - - /* Sleep 1 sec so the thread enters the sem_wait call */ - sleep( 1 ); - - /* Check value */ - ret = sem_getvalue( &sem, &val ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to get semaphore value" ); - } - - if ( ( val != 0 ) && ( val != -1 ) ) - { - output( "Val: %d\n", val ); - FAILED( "Semaphore count is neither 0 nor # of waiting processes" ); - } - - /* Post the semaphore */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - /* Join the thread */ - ret = pthread_join( th, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - - /* Destroy the semaphore */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to sem_destroy" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/4-1.c deleted file mode 100644 index fcd2f0662a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/4-1.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * Upon successful completion of calling sem_getvalue, it shall return a value - * of zero. -*/ - - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "sem_getvalue" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() { - - char semname[50]; - sem_t *mysemp; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 1); - - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if( sem_getvalue(mysemp, &val) != 0 ) { - puts("TEST FAILED"); - return PTS_FAIL; - } else { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/5-1.c deleted file mode 100644 index e03b923437..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/5-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * This test case verifies that calling sem_getvalue doesn't change the - * state of the semaphore. -*/ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-1" -#define FUNCTION "sem_getvalue" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() { - - char semname[50]; - sem_t *mysemp; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 4); - - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - - if( sem_getvalue(mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - if ( sem_trywait(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_trywait"); - return PTS_UNRESOLVED; - } - - if( sem_getvalue(mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - /* - printf("Current value is: %d\n", val); - */ - - if (val == 3 ) { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/assertions.xml deleted file mode 100644 index af34745232..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/assertions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - -sem_getvalue will update the location referenced by sval to have the value -of the semaphore referenced by sem without effecting the state of the -semaphore. The updated value represents an actual semaphore value that -occured at some unspecifed time during the call. - - -When semaphore is locked, then the value returned by sem_getvalue is zero or -the number of blocked threads/processes. - - -sem_getvalue return EINVAL ERROR on invalid reference to a semaphore. - - -Upon successful completion of calling sem_getvalue, it shall return a value -of zero. - - -Ensure when calling sem_getvalue, doesn't change the state of the semaphore. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/cln.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/cln.sh deleted file mode 100755 index 880838525b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/cln.sh +++ /dev/null @@ -1,9 +0,0 @@ - -rm -f /tmp/mysem >/dev/null 2>&1 -rm -f /tmp/sem_* >/dev/null 2>&1 -rm -f a.out - -for sem_id in `ipcs -s | awk '{print $2}'` ; do - ipcrm sem $sem_id > /dev/null 2>&1 -done - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/coverage.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/coverage.c deleted file mode 100644 index cc93c8de30..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/coverage.c +++ /dev/null @@ -1,2 +0,0 @@ - --- assertion 3: not tested. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_getvalue/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/1-1.c deleted file mode 100644 index 75f9c2dd35..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/1-1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* -The following test case initializes an unnamed semaphore with a value of 1, -and then check the value of the semaphore. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "sem_init" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main () -{ - sem_t mysemp; - int sts; - int val; - - sts = sem_init(&mysemp, 0, 1); - - - if( sem_getvalue(&mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - if (( sts == -1 ) && ( val != 1)) { - puts("TEST FAILED"); - return PTS_FAIL; - } else { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/2-1.c deleted file mode 100644 index 84b99ae22a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/2-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * unamed semaphore is used in subsequent of sem_wait. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "sem_init" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main () -{ - sem_t mysemp; - int val; - - if ( sem_init (&mysemp, 0, 1) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - - if (sem_trywait(&mysemp) == -1 ) { - perror(ERROR_PREFIX "trywait"); - return PTS_UNRESOLVED; - } - - if( sem_getvalue(&mysemp, &val) < 0 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - if (val <= 0 ) { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/2-2.c deleted file mode 100644 index c8a49595ac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/2-2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * unamed semaphore is used in subsequent of sem_post. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "sem_init" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main () -{ - sem_t mysemp; - int val; - - if ( sem_init (&mysemp, 0, 0) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - - if (sem_post(&mysemp) == -1 ) { - perror(ERROR_PREFIX "trywait"); - return PTS_UNRESOLVED; - } - - if( sem_getvalue(&mysemp, &val) < 0 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - if (val == 1 ) { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/3-1.c deleted file mode 100644 index 536c4a8615..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/3-1.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * This test case illustrate the semaphore is shared between processes when - * pshared value is non-zero. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "3-1" -#define FUNCTION "sem_init" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -sem_t psem, csem; -int n; - -int main() -{ - pthread_t prod, cons; - void *producer(void *); - void *consumer(void *); - long cnt = 3; - - n = 0; - if (sem_init(&csem, 0, 0) < 0) { - perror("sem_init"); - return PTS_UNRESOLVED; - } - if (sem_init(&psem, 0, 1) < 0) { - perror("sem_init"); - return PTS_UNRESOLVED; - } - if (pthread_create(&prod, NULL, producer, (void *)cnt) != 0) { - perror("pthread_create"); - return PTS_UNRESOLVED; - } - if (pthread_create(&cons, NULL, consumer, (void *)cnt) != 0) { - perror("pthread_create"); - return PTS_UNRESOLVED; - } - - if (( pthread_join(prod, NULL) == 0) && ( pthread_join(cons, NULL) == 0)) { - puts("TEST PASS"); - pthread_exit(NULL); - sem_destroy(&psem); - sem_destroy(&csem); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - - -void * producer(void *arg) -{ - int i, cnt; - cnt = (long)arg; - for (i=0; i Create a shared memory segment and mmap it. -* -> sem_init a semaphore placed in this segment, with pshared != 0 and val=0 -* -> fork. -* -> child process post the semaphore then exit -* -> parent process waits for the semaphore. - -* The test fails if it hangs - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - int fd; - void *buf; - sem_t * sem; - - /* Initialize output */ - output_init(); - - /* Create the shared memory segment */ - fd = shm_open( "/sem_init_3-2", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR ); - - if ( fd == -1 ) - { - UNRESOLVED( errno, "Failed to open shared memory segment" ); - } - - /* Size the memory segment to 1 page size. */ - ret = ftruncate( fd, sysconf( _SC_PAGESIZE ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to size the shared memory segment" ); - } - - /* Map these sengments in the process memory space */ - buf = mmap( NULL, sysconf( _SC_PAGESIZE ), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 ); - - if ( buf == MAP_FAILED ) - { - UNRESOLVED( errno, "Failed to mmap the shared memory segment" ); - } - - sem = ( sem_t * ) buf; - - /* Initialize the semaphore */ - ret = sem_init( sem, 1, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to init the semaphore" ); - } - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - /* Post the sempahore */ - ret = sem_post( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Wait the sempahore */ - do - { - ret = sem_wait( sem ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to wait for the semaphore" ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* Clean things */ - ret = sem_destroy( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to destroy the semaphore" ); - } - - ret = shm_unlink( "/sem_init_3-2" ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink shared memory" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/3-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/3-3.c deleted file mode 100644 index 88fd5c91ca..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/3-3.c +++ /dev/null @@ -1,211 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* If pshared is non-zero, any process that can access the semaphore can use it. - - -* The steps are: -* -> Create a shared memory segment and mmap it. -* -> sem_init a semaphore placed in this segment, with pshared != 0 and val=0 -* -> fork. -* -> child process post the semaphore then exit -* -> parent process waits for the child then check the semaphore has been increased - -* The test fails if the semaphore count did not change. - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - int fd; - void *buf; - sem_t * sem; - - /* Initialize output */ - output_init(); - - /* Create the shared memory segment */ - fd = shm_open( "/sem_init_3-2", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR ); - - if ( fd == -1 ) - { - UNRESOLVED( errno, "Failed to open shared memory segment" ); - } - - /* Size the memory segment to 1 page size. */ - ret = ftruncate( fd, sysconf( _SC_PAGESIZE ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to size the shared memory segment" ); - } - - /* Map these sengments in the process memory space */ - buf = mmap( NULL, sysconf( _SC_PAGESIZE ), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 ); - - if ( buf == MAP_FAILED ) - { - UNRESOLVED( errno, "Failed to mmap the shared memory segment" ); - } - - sem = ( sem_t * ) buf; - - /* Initialize the semaphore */ - ret = sem_init( sem, 1, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to init the semaphore" ); - } - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - /* Post the sempahore */ - ret = sem_post( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - /* Check semaphore count */ - ret = sem_getvalue( sem , &status ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to get semaphore count" ); - } - - if ( status != 1 ) - { - FAILED( "The semaphore count was not increased in other process" ); - } - - - /* Clean things */ - ret = sem_destroy( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to destroy the semaphore" ); - } - - ret = shm_unlink( "/sem_init_3-2" ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink shared memory" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/5-1.c deleted file mode 100644 index 9ad269c8a2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/5-1.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * un-successful unamed semaphore initialization return -1, otherwise zero - * on successful completion. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-1" -#define FUNCTION "sem_init" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main () -{ - sem_t mysemp; - - if ( sem_init (&mysemp, 0, 1) == -1 ) { - puts("TEST FAILED"); - return PTS_FAIL; - } else { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/5-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/5-2.c deleted file mode 100644 index 6d91db749f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/5-2.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * successful unamed semaphore initialization return zero - * on successful completion. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-2" -#define FUNCTION "sem_init" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main () -{ - sem_t mysemp; - - if ( sem_init (&mysemp, 0, 1) == 0 ) { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/6-1.c deleted file mode 100644 index 294368762b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/6-1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ -/* sem_init shall fail if the valueargument exceeds SEM_VALUE_MAX. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" -#include - -#define TEST "6-1" -#define FUNCTION "sem_init" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t mysemp; -#ifdef _SC_SEM_VALUE_MAX - int counter = sysconf(_SC_SEM_VALUE_MAX); -#else - int counter = SEM_VALUE_MAX; -#endif - - if (counter >= INT_MAX) - { - puts("Test skipped"); - return PTS_PASS; - } - - ++counter; - sem_init (&mysemp, 0, counter); - - - if ( errno == EINVAL ) { - puts("TEST PASSED"); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/7-1.c deleted file mode 100644 index 645a8bd4e1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/7-1.c +++ /dev/null @@ -1,160 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* sem_init returns -1 and sets errno to ENOSPC if the system lacks a resource -* or SEM_NSEMS_MAX has been reached. - - -* The steps are: -* -> Try and sem_init SEM_NSEMS_MAX semaphores. -* -> Try and sem_init an additional semaphore. - -* The test fails if the last creation does not return an error. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, i; - sem_t *sems; - sem_t sem_last; - - long max; - - /* Initialize output */ - output_init(); - - max = sysconf( _SC_SEM_NSEMS_MAX ); - - if ( max <= 0 ) - { - output( "sysconf( _SC_SEM_NSEMS_MAX ) = %ld\n", max ); - UNTESTED( "There is no constraint on SEM_NSEMS_MAX" ); - } - - sems = ( sem_t * ) calloc( max, sizeof( sem_t ) ); - - if ( sems == NULL ) - { - UNRESOLVED( errno, "Failed to alloc space" ); - } - - - for ( i = 0; i < max; i++ ) - { - ret = sem_init( &sems[ i ], 0, 0 ); - - if ( ret != 0 ) - { - output( "sem_init failed to initialize the %d nth semaphore.\n", i ); - output( "Tryed to initialize %ld.\n", max ); - output( "Error is %d: %s\n", errno, strerror( errno ) ); - - for ( ; i > 0; i-- ) - sem_destroy( &sems[ i - 1 ] ); - - free( sems ); - - PASSED; - } - } - - ret = sem_init( &sem_last, 0, 1 ); - - if ( ret == 0 ) - { - FAILED( "We were able to sem_init more than SEM_NSEMS_MAX semaphores" ); - } - - if ( errno != ENOSPC ) - { - output( "Error is %d: %s\n", errno, strerror( errno ) ); - } - - for ( i = 0; i < max; i++ ) - sem_destroy( &sems[ i ] ); - - free( sems ); - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/assertions.xml deleted file mode 100644 index 04f457bf8e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/assertions.xml +++ /dev/null @@ -1,46 +0,0 @@ - - -sem_init test case make sure that it establish initialize the unnamed -semaphore referred by sem. - - -sem_init is used in subsequence of sem_wait, sem_trywait, sem_post, -sem_destroy, and the semaphore should be usable until the its destroyed. - - -The semaphore is shared between processes when the pshared value is non-zero. - - -The semaphore is shared between threads of process when the pshared value -is zero. any thread in this process can us sem for performing sem_wait, -sem_trywait, ... - - -sem_init should initialize the semaphore in sem, otherwise it shall return -1 -and set to errno. - - -EINVAL: the value argument exceeds SEM_VALUE_MAX - - -ENOSPC: a resouce required to initialize the semaphroe has been exhausted, or -number of sems {SEM_NSEMS_MAX} has been reached. - - -EPERM: the process lacks the appropriate privilage to initialize the semaphore. - - -Only sem can be used for performing synchronization. The result -of referring to copies of sem in calls to sem_wait, sem_post, sem_trywait -and sem_destroy is undefined. - - -When teh pshared argument is zero, then the semaphore is shared between -the threads of the process, and not by the threads other than those created -in the same process. (Undefined). - - -Attempting to initialize an already initialized semaphore results in -undefined behavior. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/coverage.txt deleted file mode 100644 index 51e1e6b15a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/coverage.txt +++ /dev/null @@ -1,17 +0,0 @@ - - --- assertion 4: Not tested. Help needed! - --- assertion 7: Not tested. I couldn't find a way to exhaust -the system in order to satisfy this test case. - --- assertion 8: Not tested. I couldn't figure out how to make -this test case to happen. In NPTL, the semaphore creator has to -be root, and the semaphore is created in /dev/shm file system. -Any other user can't create under that file system. - --- assertion 9: Won't test. Undefined. - --- assertion 10: Won't test. Undefined. - --- assertion 11: Won't test. Undefined. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_init/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-1.c deleted file mode 100644 index 7179276b04..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - sem_open test case that attempts to open a new semaphoree, - close the semaphore and verify that open_sem returns 0. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-1" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 1); - - if (( mysemp == SEM_FAILED ) || (mysemp == NULL )) - { - puts("TEST FAILED"); - return PTS_FAIL; - } else { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-2.c deleted file mode 100644 index 0aa01f0542..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-2.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - sem_open test case that attempts to open a new semaphoree, and the - return value is not NULL - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-2" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 1); - - /* Checking if mysemp has a value returned. From sem_open */ - - if ( &mysemp != NULL) - { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } - else - { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-3.c deleted file mode 100644 index eacddb5e06..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-3.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - sem_open test case that attempts to open a new semaphoree, and then - lock it with sem_wait. Making sure the semaphore is locked. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-3" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - int lock_status; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 1); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - lock_status = sem_wait(mysemp); - - /* Checking if sem_wait has a value returned. From sem_open */ - if (lock_status == 0) - { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } - else - { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-4.c deleted file mode 100644 index c04ea15367..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/1-4.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - sem_open test case that attempts to open a new semaphoree, and then - try to un-lock it with sem_post. Making sure the semaphore is not locked. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "1-4" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 1); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - - /* Checking if mysemp has a value returned. From sem_open */ - if ( sem_post(mysemp) == 0 ) { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/10-1.c deleted file mode 100644 index e0f5af9aa4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/10-1.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - sem_open test case that attempts to open a new semaphore, - call sem_wait, then try to re-create the same semaphore, which - have no effect when you try to open a semaphore that already exist. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "10-1" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 5); - if ( mysemp == SEM_FAILED ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if (sem_wait(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_close"); - return PTS_UNRESOLVED; - } - - mysemp = sem_open(semname, O_CREAT, 0777, 1); - if ( mysemp == SEM_FAILED ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if( sem_getvalue(mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - if (val != 4 ) { - puts("TEST FAILED: second call of sem_open took place"); - sem_unlink(semname); - return PTS_FAIL; - } else { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/15-1.c deleted file mode 100644 index 035d3e7fb9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/15-1.c +++ /dev/null @@ -1,173 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* If a process calls sem_open several times with the same name, -* the same adress must be returned as long as the semaphore -* has not been unlinked or closed as many times as opened. - - -* The steps are: -* -> Create a semaphore with sem_open -* -> call sem_open several times with the same name. -* -> Check that the same address is returned for the semaphore. - -* The test fails if a different address is returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, i; - char * name = "/sem_open_15_1"; - - sem_t * sems[ 4 ]; - - /* Initialize output */ - output_init(); - - /* Initialize all semaphores */ - - for ( i = 0; i < 4; i++ ) - { - sems[ i ] = sem_open( name, O_CREAT, 0777, 1 ); - - if ( sems[ i ] == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to sem_open" ); - } - - } - - /* Check all calls returned the same @ */ - for ( i = 0; i < 3; i++ ) - { - if ( sems[ i ] != sems[ i + 1 ] ) - { - FAILED( "sem_open returned a different address" ); - } - - /* Close some semaphores */ - ret = sem_close( sems[ i ] ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to sem_close" ); - } - } - - /* Now, reopen, we should still get the same address */ - for ( i = 0; i < 3; i++ ) - { - sems[ i ] = sem_open( name, O_CREAT, 0777, 1 ); - - if ( sems[ i ] == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to sem_open" ); - } - - } - - /* Check all calls returned the same @ */ - for ( i = 0; i < 3; i++ ) - { - if ( sems[ i ] != sems[ i + 1 ] ) - { - FAILED( "sem_open returned a different address" ); - } - } - - - /* Close all semaphores */ - for ( i = 0; i < 4; i++ ) - { - ret = sem_close( sems[ i ] ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to sem_close" ); - } - } - - sem_unlink( name ); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/2-1.c deleted file mode 100644 index aa3a87cf37..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/2-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - sem_open test case that attempts to open a new semaphore, - close the semaphore and then open and existing semaphore, which - should fail when both O_CREAT and O_EXCL name exist during the opening - of a Semaphore. Fail to open is a Pass for this test. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-1" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0777, 0); - if ( mysemp == SEM_FAILED ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if (sem_close(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_close"); - return PTS_UNRESOLVED; - } - - mysemp = sem_open(semname, O_CREAT|O_EXCL, 0777, 1); - if (( mysemp == SEM_FAILED ) && ( errno == EEXIST) ) { - puts("TEST PASSED"); - sem_unlink(semname); - return PTS_PASS; - } - else - { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/2-2.c deleted file mode 100644 index 6af639cd65..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/2-2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - - -/* - This test case checks for the existence of the semaphore and the creation - of the semaphore if it does not exist. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "2-2" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT|O_EXCL, 0777, 1); - - - if ( mysemp == SEM_FAILED || mysemp == NULL) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if (errno != EEXIST ) - { - puts("TEST PASSED"); - sem_unlink(semname); - sem_close(mysemp); - return PTS_PASS; - } - else - { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/3-1.c deleted file mode 100644 index eb8bad43e5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/3-1.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ -/* - open_sem test case that attempts to open a new semaphore with read - permissions, close it, then create the same semaphore with write - permissions which should come up with denial access. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "3-1" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -/** Set the euid of this process to a non-root uid */ -int set_nonroot() -{ - struct passwd *pw; - setpwent(); - /* search for the first user which is non root */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root")) - break; - endpwent(); - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return 1; - } - - if(seteuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\n"); - return 1; - } - perror("An error occurs when calling seteuid()"); - return 1; - } - - printf("Testing with user '%s' (uid: %d)\n", - pw->pw_name, (int)geteuid()); - return 0; -} -int main() -{ - sem_t *mysemp; - char semname[50]; - - - if (getuid() == 0) { - if (set_nonroot() != 0) { - printf("Cannot run this test as non-root user\n"); - return PTS_UNTESTED; - } - } - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /*Trying to open the first Sem with read mode */ - mysemp = sem_open(semname, O_CREAT, 0444, 1); - - /* Opening the same existance SEM with write mode */ - mysemp = sem_open(semname, O_CREAT, 0222 , 1); - - if ( mysemp != SEM_FAILED ) - { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if (errno == EACCES ) { - puts("TEST PASSED"); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/4-1.c deleted file mode 100644 index 01fd5686ec..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/4-1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ -/* - open_sem test case that attempts to open a new semaphore, - close the semaphore and then open and existing semaphore, which - should fail when both O_CREAT and O_EXCL name exist during the opening - of a Semaphore. Fail to open is a Pass for this test. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "4-1" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /*Trying to open the first Sem */ - mysemp = sem_open(semname, O_CREAT, 0444, 1); - sem_close(mysemp); - - /* Opening the same existance SEM */ - mysemp = sem_open(semname, O_CREAT|O_EXCL, 0444, 1); - - if ((mysemp == SEM_FAILED ) && ( errno == EEXIST)) { - puts("TEST PASSED"); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/5-1.c deleted file mode 100644 index 85a1aa4dd0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/5-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ -/* - open_sem test case that attempts to open a new semaphore, - with the maximum VALUE allowed. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "5-1" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; -#ifdef _SC_SEM_VALUE_MAX - int counter = sysconf(_SC_SEM_VALUE_MAX); -#else - int counter = SEM_VALUE_MAX; -#endif - - if (counter >= INT_MAX) - { - return PTS_PASS; - } - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - ++counter; - mysemp = sem_open(semname, O_CREAT, 0444, counter); - if (( mysemp == SEM_FAILED) && ( errno == EINVAL )) { - puts("TEST PASSED"); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/6-1.c deleted file mode 100644 index d356cf86ed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/6-1.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ -/* - sem_open test case attempts to create a named SEM that doesn't exist. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TEST "6-1" -#define FUNCTION "sem_open" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, 0); - - if ((mysemp == SEM_FAILED ) && ( errno == ENOENT )) { - puts("TEST PASSED"); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/assertions.xml deleted file mode 100644 index a631385eda..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/assertions.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - sem_open test cases make sure that it establish connection between the - Semaphore and the process. There are checks for return values of the - address, increament, decrement, and close. - - - sem_open attempts to open an existing semaphore, - which it should fail when both O_CREAT and O_EXCL name exist during the - opening of a Semaphore. - - - errno return EACCESS: sem_open exist and the permissions of Oflag are denied. - - - errno return EEXIST: sem_open exist and O_CREAT and O_EXCL are set. - - - errno return EINVAL: Create a semaphore with a value of SEM_VALUE_MAX. - - - errno return ENOENT: O_CREAT is not set and the semaphore doesn't exist. - - - errno return ENAMETOOLONG: This test case tries to creat a named semaphore - that is longer than max limit. - - - After sem_open() is called, the process can use the sem_t address returned - to reference teh semaphore in calls to sem_wait(), sem_trywait(), sem_post(), - and sem_close(). - - - Until sem_close(), _exit(), or exec*() is called, the semaphore can be used - in the process. - - - If O_CREAT is set and a semaphore already exists, O_CREAT has no effect. - - - If O_CREAT flag is used, sem_open has two additional args: mode_t which - sets the permission bits and unsigned value which sets the initial value - of the semaphore. - - - The initial value for the semaphore should be less than or equal to - SEM_VALUE_MAX. Any other initial value is invalid. - - - The effective user ID of the process == the user ID of the semaphore. The - system default group ID of the effective group ID of the process == the - group ID of the semaphore. - - - After sem_open has created semaphore "name", other process can use "name" - to connect to that semaphore. - - -If a process calls sem_open several times with the same name, the same adress -must be returned as long as the semaphore has not been unlinked or closed as -many times as opened. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/cln.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/cln.sh deleted file mode 100755 index d49d89a9b1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/cln.sh +++ /dev/null @@ -1,9 +0,0 @@ - -rm -f /tmp/mysem >/dev/null 2>&1 -rm -f /tmp/sem_open* >/dev/null 2>&1 -rm -f a.out - -for sem_id in `ipcs -s | awk '{print $2}'` ; do - ipcrm sem $sem_id > /dev/null 2>&1 -done - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/coverage.txt deleted file mode 100644 index 29b6163651..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/coverage.txt +++ /dev/null @@ -1,29 +0,0 @@ - - -Will not test the following error values of the semaphores because it is -unknown to me of how to return these values. - --- EMFILE: Too many semaphore descriptors or file descriptors are - currently in use by this process. --- ENFILE: Too many semaphores are currently open in the system. --- ENOSPC: Threis insufficient space for the creation of the new names - semaphore. - --- assertion 7: not tested. - --- assertion 8: is tested in the areas of sem_wait, sem_trywait, sem_post, -and sem_close. - --- assertion 9: is mainly tested in all test casses by calling sem_close. - --- assertion 11: is all covered in many area's of the semaphore suite, that -permission bits is set and checked, and the value is also set and checked. - --- assertion 12: is mainly tests in sem_open as the maximum value and the -minimum value has been tested, but not the greater than SEM_VALUE_MAX. - --- assertion 13: Not tested. - --- assertion 14: Not tested. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_open/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/1-1.c deleted file mode 100644 index 5f25734462..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/1-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * sem_post shall unlock the locked semaphore and increment the semaphore - * value by one. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "1-1" -#define FUNCTION "sem_post" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is 0 */ - mysemp = sem_open(semname, O_CREAT, 0777, 0); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - - if( sem_post(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_post"); - return PTS_UNRESOLVED; - } - - - if( sem_getvalue(mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - - /* Checking if the value of the Semaphore incremented by one */ - } else if( val == 1 ) { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/1-2.c deleted file mode 100644 index a3bac0aa03..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/1-2.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * sem_post shall increment the value of the semaphore when its unlocked - * and in positive value - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "1-2" -#define FUNCTION "sem_post" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is unlocked */ - mysemp = sem_open(semname, O_CREAT, 0777, 2); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - - if( sem_post(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_post"); - return PTS_UNRESOLVED; - } - - - if( sem_getvalue(mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - - /* Checking if the value of the Semaphore incremented by one */ - } else if( val == 3 ) { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/2-1.c deleted file mode 100644 index edf6a8c761..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/2-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * This test case verifies the semaphore value is 0, then shows a successful - * call to release the unlock from mysemp. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "2-1" -#define FUNCTION "sem_post" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is 0 */ - mysemp = sem_open(semname, O_CREAT, 0777, 1); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if( sem_wait(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_post"); - return PTS_UNRESOLVED; - } - - if(( sem_post(mysemp)) == 0 ) { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED: value of sem_post is not zero"); - return PTS_FAIL; - } - -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/4-1.c deleted file mode 100644 index c96d5044c5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/4-1.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * This test case verifies the sem_post returns 0 on successful call. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "4-1" -#define FUNCTION "sem_post" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is 0 */ - mysemp = sem_open(semname, O_CREAT, 0777, 0); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if( sem_post(mysemp) == 0 ) { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED: value of sem_post is not returning zero"); - return PTS_FAIL; - } - printf("This code should not be executed.\n"); - return PTS_UNRESOLVED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/5-1.c deleted file mode 100644 index 8368f43e8b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/5-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * sem_post() can be entered into again if interrupted by a signal - * --> This is tough to do with 100% guarantees. This test does a - * best attempt. - * - * 1) Set up a signal catching function for SIGALRM. - * 2) Set up a semaphore - * 3) Call sleep(1) and then alarm(1) - * 4) Call sempost() immediately after (thinking that alarm(1) will interrupt - * 5) If sempost() succeeds (verified if val is incremented by 1), - * test passes. Otherwise, failure. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "5-1" -#define FUNCTION "sem_post" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define SEMINITVAL 0 //initial value of semaphore = 0 - -sem_t *gsemp; - -void sighdl(int sig) -{ - return; -} - -int main() { - char semname[50]; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - gsemp = sem_open(semname, O_CREAT, 0777, SEMINITVAL); - if( gsemp == SEM_FAILED || gsemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - signal(SIGALRM, sighdl); - sleep(1); - alarm(1); - - if( sem_post(gsemp) == -1 ) { - perror(ERROR_PREFIX "sem_post"); - exit(PTS_UNRESOLVED); - } - - /* Checking if the value of the Semaphore incremented by one */ - if( sem_getvalue(gsemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - if (val != SEMINITVAL+1) { -#ifdef DEBUG - printf("semaphore value was not incremented\n"); -#endif - printf("TEST FAILED\n"); - return PTS_FAIL; - } - -#ifdef DEBUG - printf("semaphore value was %d\n", val); -#endif - - printf("TEST PASSED\n"); - sem_close(gsemp); - sem_unlink(semname); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/6-1.c deleted file mode 100644 index 88def9f573..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/6-1.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * sem_post() can be called from within a signal catching function - * - * 1) Set up a signal catching function for SIGALRM. - * 2) Set up a semaphore - * 3) Call alarm(1) - * 4) Call sempost() from within the handler for SIGALRM - * 5) If sempost() succeeds (verified if val is incremented by 1), - * test passes. Otherwise, failure. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "6-1" -#define FUNCTION "sem_post" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define SEMINITVAL 0 //initial value of semaphore = 0 - -sem_t *gsemp; - -void handler(int signo) -{ - if( sem_post(gsemp) == -1 ) { - perror(ERROR_PREFIX "sem_post"); - exit(PTS_UNRESOLVED); - } -} - -int main() { - char semname[50]; - struct sigaction act; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - gsemp = sem_open(semname, O_CREAT, 0777, SEMINITVAL); - - act.sa_handler=handler; - act.sa_flags=0; - - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - - if( gsemp == SEM_FAILED || gsemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - alarm(1); - sleep(2); - - /* Checking if the value of the Semaphore incremented by one */ - if( sem_getvalue(gsemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - if (val != SEMINITVAL+1) { -#ifdef DEBUG - printf("semaphore value was not incremented\n"); -#endif - printf("TEST FAILED\n"); - return PTS_FAIL; - } - -#ifdef DEBUG - printf("semaphore value was %d\n", val); -#endif - - printf("TEST PASSED\n"); - sem_close(gsemp); - sem_unlink(semname); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/8-1.c deleted file mode 100644 index ca3b729d7e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/8-1.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2003-2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * adam.li@intel.com 2004-03 - */ - -/* - * If the Process Scheduling option is supported, the thread to be unblocked - * shall be chosen in a manner appropriate to the scheduling policies - * and parameters in effect for the blocked threads. - * In the case of the schedulers SCHED_FIFO and SCHED_RR, the highest - * priority waiting thread shall be unblocked, and if there is - * more than one highest priority thread blocked waiting for the semaphore, - * then the highest priority thread that has been waiting the - * longest shall be unblocked. - * If the Process Scheduling option is not defined, the choice of a thread - * to unblock is unspecified. - * - * Test Steps: - * Here we test SCHED_FIFO - * 1. Parent locks a semaphore, it has highest priority P0. - * 2. It forks 2 child processes 1, 2, as for priority P1, P2, P0 > P2 > P1 - * 3. The children lock the semaphore. - * Make sure the two children are waiting. - * 4. Parent forks another child 3, with priority P3, P3 = P2, it locks - * the semaphore too. - * 5. Parent unlocks the semaphore, make sure the children - * wake up in the order of 2 -> 3 -> 1 - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" -#include -#include -#include -#include - -#define TEST "8-1" -#define FUNCTION "sem_wait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -static char semname[20]; -static char semname_1[20]; /* Used to record state */ - -/* set my schedule priority to @priority */ -int set_my_prio(int priority) -{ - struct sched_param sp; - sp.sched_priority = priority; - - /* Set priority */ - if (sched_setscheduler(0, SCHED_FIFO, &sp) == -1) - { - perror("Error at sched_setscheduler()\n"); - return -1; - } - return 0; -} - -int get_my_prio() -{ - struct sched_param sp; - if (sched_getparam(0, &sp) == -1) - { - perror("Error at sched_getparam()\n"); - return -1; - } - return sp.sched_priority; -} - -int child_fn(int priority, int id) -{ - sem_t *sem, *sem_1; - if (set_my_prio(priority) == -1) - exit(-1); - sem = sem_open(semname, 0); - if( sem == SEM_FAILED || sem == NULL ) { - perror(ERROR_PREFIX "sem_open: sem"); - return -1; - } - sem_1 = sem_open(semname_1, 0); - if( sem_1 == SEM_FAILED || sem_1 == NULL ) { - perror(ERROR_PREFIX "sem_open: sem_1"); - return -1; - } - sem_wait(sem_1); - fprintf(stderr, "child %d try to get lock, prio: %d\n", - id, get_my_prio()); - if (sem_wait(sem) == -1) - { - perror("Error at sem_wait"); - fprintf(stderr, "Child %d: Cannot get lock", id); - exit(-1); - } - fprintf(stderr, "child %d got lock\n", id); - exit(0); -} - -int main() -{ -#ifndef _POSIX_PRIORITY_SCHEDULING - printf("_POSIX_PRIORITY_SCHEDULING not defined\n"); - return PTS_UNTESTED; -#endif - sem_t *sem, *sem_1; - int val = 3; /* for sem_1 to track the child state */ - int priority; - pid_t c_1, c_2, c_3, ret_pid; - int retval = PTS_UNRESOLVED; - int status; - - snprintf(semname, 20, "/" TEST "_%ld", (long)getpid()); - /* Initial value of Semaphore is 1 */ - sem = sem_open(semname, O_CREAT, 0777, 1); - if( sem == SEM_FAILED || sem == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - snprintf(semname_1, 20, "/" TEST "_%ld_1", (long)getpid()); - sem_1 = sem_open(semname_1, O_CREAT, 0777, val); - if( sem_1 == SEM_FAILED || sem_1 == NULL ) { - perror(ERROR_PREFIX "sem_open: sem_1"); - sem_unlink(semname); - return PTS_UNRESOLVED; - } - - /* The parent has highest priority */ - priority = sched_get_priority_min(SCHED_FIFO) + 3; - if (set_my_prio(priority) == -1) { - retval = PTS_UNRESOLVED; - goto clean_up; - } - - /* Lock Semaphore */ - if( sem_wait(sem) == -1 ) { - perror(ERROR_PREFIX "sem_wait"); - retval = PTS_UNRESOLVED; - goto clean_up; - } - - c_1 = fork(); - if (c_1 == 0) - { - /* Child 1, should block */ - child_fn(priority - 2, 1); - } - else if (c_1 < 0) - { - perror("Error at fork"); - retval = PTS_UNRESOLVED; - goto clean_up; - } - fprintf(stderr, "P: child_1:%ld forked\n", (long)c_1); - - sleep(1); - c_2 = fork(); - if (c_2 == 0) - { - /* Child 2 */ - child_fn(priority - 1, 2); - } - else if (c_2 < 0) - { - perror("Error at fork"); - retval = PTS_UNRESOLVED; - goto clean_up; - } - fprintf(stderr, "P: child_2: %ld forked\n", (long)c_2); - - /* Make sure the two children has been waiting */ - /*do { - sleep(1); - sem_getvalue(sem_1, &val); - //printf("val = %d\n", val); - } while (val != 1); - */ - c_3 = fork(); - if (c_3 == 0) - { - /* Child 3 */ - child_fn(priority - 1, 3); - } - fprintf(stderr, "P: child_3: %ld forked\n", (long)c_3); - - /* Make sure child 3 has been waiting for the lock */ - /*do { - sleep(1); - sem_getvalue(sem_1, &val); - //printf("val = %d\n", val); - } while (val != 0); - */ - /* Ok, let's release the lock */ - fprintf(stderr, "P: release lock\n"); - sem_post(sem); - ret_pid = wait(&status); - if (ret_pid == c_2 && WIFEXITED(status) - && WEXITSTATUS(status) == 0) - { - fprintf(stderr, "P: release lock\n"); - sem_post(sem); - ret_pid = wait(&status); - if (ret_pid == c_3 && WIFEXITED(status) - && WEXITSTATUS(status) == 0) - { - fprintf(stderr, "P: release lock\n"); - sem_post(sem); - ret_pid = wait(&status); - if (ret_pid == c_1 && WIFEXITED(status) - && WEXITSTATUS(status) == 0) - { - printf("Test Pass\n"); - retval = PTS_PASS; - goto clean_up; - } - printf("Test Fail: Expect child_1: %ld, got %ld\n", - (long)c_1, (long)ret_pid); - retval = PTS_FAIL; - goto clean_up; - } - else - { - printf("Test Fail: Expect child_3: %ld, got %ld\n", - (long)c_3, (long)ret_pid); - retval = PTS_FAIL; - sem_post(sem); - while((wait(NULL) > 0)); - goto clean_up; - } - } - else - { - printf("Test Fail: Expect child_2: %ld, got %ld\n", - (long)c_2, (long)ret_pid); - retval = PTS_FAIL; - sem_post(sem); - sem_post(sem); - while((wait(NULL) > 0)); - goto clean_up; - } - -clean_up: - sem_close(sem); - sem_close(sem_1); - sem_unlink(semname); - sem_unlink(semname_1); - return retval; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/assertions.xml deleted file mode 100644 index 01defa067d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/assertions.xml +++ /dev/null @@ -1,27 +0,0 @@ - - -sem_post will unlock a locked semaphore, and will increment the value of -the semaphore when the value is positive. - - -sem_post will return a value of 0 on successful calls when it unlock a -semaphore. - - -sem_post return EINVAL ERROR on invalid reference to a semaphore. - - -sem_post return zero on a successful call. - - -sem_post will continue after it is interrupted by a signal - - -sem_post cam be called from within a signal catching function - - -If Process Scheduling extension is supported, and scheduler is SCHED_FIFO or -SCHED_RR, the highest priority thread is awaken first. If several threads -with equal priority are waiting, the threads are awaken in FIFO order. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/cln.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/cln.sh deleted file mode 100755 index 880838525b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/cln.sh +++ /dev/null @@ -1,9 +0,0 @@ - -rm -f /tmp/mysem >/dev/null 2>&1 -rm -f /tmp/sem_* >/dev/null 2>&1 -rm -f a.out - -for sem_id in `ipcs -s | awk '{print $2}'` ; do - ipcrm sem $sem_id > /dev/null 2>&1 -done - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/coverage.txt deleted file mode 100644 index 4f7b889f7f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_post/coverage.txt +++ /dev/null @@ -1,2 +0,0 @@ - -assertion 3: not tested. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/1-1.c deleted file mode 100644 index 18fdfd79c0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/1-1.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * sem_timedwait shall lock the unlocked semaphore and decrement the - * semaphore * value by one. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "1-1" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t mysemp; - struct timespec ts; - int val, sts; - - - if ( sem_init (&mysemp, 0, 1) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL); - ts.tv_nsec=0; - - /* Lock Semaphore */ - sts = sem_timedwait(&mysemp, &ts); - if ( sts == -1 ) { - perror(ERROR_PREFIX "sem_timedwait"); - return PTS_UNRESOLVED; - } - - - /* Value of Semaphore */ - if( sem_getvalue(&mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - /* Checking if the value of the Semaphore decremented by one */ - if(( val == 0 ) && ( sts == 0)) { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/10-1.c deleted file mode 100644 index 9babebca31..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/10-1.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * adam.li@intel.com - * If the Timers option is supported, the timeout shall be based on - * the CLOCK_REALTIME clock. If the Timers option is not supported, - * the timeout shall be based on the system clock as returned by - * the time() function. - * - */ - - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "10-1" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define SLEEP_SEC 1 - -int main() { - sem_t mysemp; - struct timespec ts, ts_2; - int rc; - - /* Init the value to 0 */ - if ( sem_init (&mysemp, 0, 0) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - - /* Set the abs timeout */ -#ifdef CLOCK_REALTIME - printf("Test CLOCK_REALTIME\n"); - if (clock_gettime(CLOCK_REALTIME, &ts) != 0) - { - perror("clock_gettime()"); - return PTS_UNRESOLVED; - } - ts.tv_sec += SLEEP_SEC; - ts.tv_nsec=0; -#else - ts.tv_sec=time(NULL); - ts.tv_sec += SLEEP_SEC; - ts.tv_nsec=0; -#endif - /* Lock Semaphore */ - rc = sem_timedwait(&mysemp, &ts); - if ( rc != -1 || (rc == -1 && errno != ETIMEDOUT)) - { - perror(ERROR_PREFIX "sem_timedwait"); - printf("Expect timedout\n"); - return PTS_UNRESOLVED; - } - - /* Check the time */ -#ifdef CLOCK_REALTIME - if (clock_gettime(CLOCK_REALTIME, &ts_2) != 0) - { - perror("clock_gettime()"); - return PTS_UNRESOLVED; - } -#else - ts_2.tv_sec = time(NULL); -#endif - if(ts_2.tv_sec == ts.tv_sec) { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/11-1.c deleted file mode 100644 index 51b22a4b36..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/11-1.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2003, 2004, Intel Corporation. All rights reserved. - * Created by: crystal.xiong REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Under no circumstance shall the function fail with a timeout if - * the semaphore can be locked immediately. The validity of the - * abs_timeout need not be checked if the semaphore can be locked - * immediately. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define TIMEOUT 2 -#define INVALIDTIMEOUT -2 -#define TEST "11-1" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t mysemp[2]; - struct timespec ts[2]; - int val[2], sts[2]; - int i; - - for ( i = 0; i < 2; i++ ) { - if ( sem_init (&mysemp[i], 0, 1) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - if ( i == 0 ) { - ts[i].tv_sec=time(NULL) + TIMEOUT; - ts[i].tv_nsec=0; - } else if ( i == 1 ) { - ts[i].tv_sec=time(NULL) + INVALIDTIMEOUT; - ts[i].tv_nsec=0; - } - /* Lock Semaphore */ - sts[i] = sem_timedwait(&mysemp[i], &ts[i]); - if ( sts[i] == -1 ) { - perror(ERROR_PREFIX "sem_timedwait"); - return PTS_UNRESOLVED; - } - - /* Value of Semaphore */ - if( sem_getvalue(&mysemp[i], &val[i]) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - /* Checking if the value of the Semaphore decremented by one */ - if(( val[i] == 0 ) && ( sts[i] == 0)) { - puts("TEST PASSED"); - sem_destroy(&mysemp[i]); - return PTS_PASS; - } else { - puts("TEST FAILED"); - sem_destroy(&mysemp[i]); - return PTS_FAIL; - } - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/2-1.c deleted file mode 100644 index 507ec95a55..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/2-1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* sem_timedwait will return successfully when sem_post - * will unlock the semaphore from another process. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "2-1" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t mysemp; - struct timespec ts; - int pid; - - - /* Semaphore started out locked */ - if ( sem_init (&mysemp, 0, 0) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - - pid = fork(); - if (pid == 0) // child to lock semaphore - { - ts.tv_sec=time(NULL)+2; - ts.tv_nsec=0; - - if( sem_timedwait(&mysemp, &ts) == -1 ) { - puts ("TEST FAILED"); - return PTS_FAIL; - } else { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } - } - else if (pid > 0) // parent to unlock semaphore - { - int i; - sleep(1); - if (sem_post(&mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_post"); - return PTS_FAIL; - } - if (wait(&i) == -1) { - perror("Error waiting for child to exit"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(i)) { - return PTS_FAIL; - } - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } -return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/2-2.c deleted file mode 100644 index 157fcbc55b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/2-2.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * This test case will verify that sem_timedwait will wait one second to - * unlock the locked semaphore, and then when the semaphore fails to - * unlock should return -1, and leave the semaphore status unchanged - * by doing sem_post on the sempahore and check the current value of - * the semaphore. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "2-2" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t mysemp; - struct timespec ts; - int sts, val; - - - if ( sem_init (&mysemp, 0, 0) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - - /* Try to lock Semaphore */ - sts = sem_timedwait(&mysemp, &ts); - - if ( sem_post(&mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_post"); - return PTS_UNRESOLVED; - } - - if( sem_getvalue(&mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - if ((val == 1) && (sts == -1)) { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/3-1.c deleted file mode 100644 index df20c40965..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/3-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* This tests case will open a locked semaphore. The time will tick 5 times - * until the absolute time passes. The sempahore will unlock, then the - * sem_timedwait call will immediately lock again. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "3-1" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main(){ - - struct timespec ts; - sem_t mysemp; - int i=0; - int val; - - if ( sem_init (&mysemp, 0, 0) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL); - ts.tv_nsec=0; - - while (sem_timedwait(&mysemp, &ts) == -1 ) - { - ts.tv_sec += 1; -// printf("%s \n", asctime(localtime(&ts.tv_sec))); - i++; -// printf("i=%d\n",i); - if (i==5) { - sem_post(&mysemp); - } - } - - /* Value of Semaphore */ - if( sem_getvalue(&mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - /* Checking if the value of the Semaphore after lock & unlock */ - if( val == 0 ) { - puts("TEST PASSED: Sem unlocked after 5 timeouts"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/4-1.c deleted file mode 100644 index 6f6d7a09e1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/4-1.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* sem_timedwait shall return zero if the calling process successfully - * performed the semaphore lock operation on the semaphore designated - * by sem. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "4-1" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t mysemp; - struct timespec ts; - int unresolved=0, sts; - - - if ( sem_init (&mysemp, 0, 1) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - unresolved=1; - } - - ts.tv_sec=time(NULL)+1; - ts.tv_nsec=0; - - /* Lock Semaphore */ - sts = sem_timedwait(&mysemp, &ts); - if ( sts == -1 ) { - perror(ERROR_PREFIX "sem_timedwait"); - unresolved=1; - } - - - /* unlock Semaphore */ - if( sem_post(&mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_post"); - unresolved=1; - } - - if (( sts == 0) && (unresolved == 0)) { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/6-1.c deleted file mode 100644 index 920fa681ab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/6-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * The process would be blocked, and the timeout parameter is - * secified in nanoseconds field value less than zero. Should - * return ERROR (EINVAL). - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "6-1" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t mysemp; - struct timespec ts; - int sts; - - if ( sem_init (&mysemp, 0, 0) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - ts.tv_sec=time(NULL); - ts.tv_nsec= -3; - - sts = sem_timedwait(&mysemp, &ts); - - if((errno == EINVAL) && ( sts == -1)) { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/6-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/6-2.c deleted file mode 100644 index 88f30bd6e6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/6-2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * The process would be blocked, and the timeout parameter is - * secified in nanoseconds field value greater than or equal to - * 1000 million. Should return ERROR (EINVAL). -*/ - - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "5-1" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define NANOSEC 1000000000 - -int main() { - sem_t mysemp; - struct timespec ts; - int sts; - - if ( sem_init (&mysemp, 0, 0) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - ts.tv_sec=time(NULL); - ts.tv_nsec= NANOSEC; - - sts = sem_timedwait(&mysemp, &ts); - - if(( errno == EINVAL) && ( sts == -1)) { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/7-1.c deleted file mode 100644 index d4618e0004..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/7-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* This tests case will open a locked semaphore. The time will tick 5 times - * until the absolute time passes. The sempahore will unlock, then the - * sem_timedwait call will immediately lock again. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "7-1" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main(){ - - struct timespec ts; - sem_t mysemp; - - if ( sem_init (&mysemp, 0, 0) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - - ts.tv_sec=time(NULL); - ts.tv_nsec=0; - - while (sem_timedwait(&mysemp, &ts) == -1 ) - { - if (errno == ETIMEDOUT) { - puts("TEST PASSED"); - sem_destroy(&mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } - return PTS_UNRESOLVED; - } -return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/9-1.c deleted file mode 100644 index 5c30e4e865..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/9-1.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* This tests case will send a SIGABRT to sem_timedwait, and should - * return error EINTR. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "9-1" -#define FUNCTION "sem_timedwait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -void handler(int signo) -{ - printf("In handler\n"); -} - -int main() -{ - sem_t mysemp; - struct timespec ts; - int pid, status; - - - if ( sem_init (&mysemp, 0, 1) == -1 ) { - perror(ERROR_PREFIX "sem_init"); - return PTS_UNRESOLVED; - } - - - if( sem_wait(&mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_wait"); - return PTS_UNRESOLVED; - } - - pid = fork(); - if (pid == 0) { // child create the semaphore. - struct sigaction act; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return CHILDFAIL; - } - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return CHILDFAIL; - } - - ts.tv_sec = time(NULL)+3; - ts.tv_nsec = 0; - - sem_timedwait(&mysemp, &ts); - - if (errno == EINTR) { - printf("Test PASSED\n"); - return (CHILDPASS); - } - puts("TEST FAILED: errno != EINTR"); - return (CHILDFAIL); - - } else { // parent to send a signal to child - int i; - sleep(1); - status = kill(pid,SIGABRT); // send signal to child - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(i)) { - return PTS_FAIL; - } - puts("TEST PASSED"); - return PTS_PASS; - } - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/assertions.xml deleted file mode 100644 index b2efa81698..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/assertions.xml +++ /dev/null @@ -1,50 +0,0 @@ - - -sem_timedwait will lock the unlocked semaphore. - - -if the sempahore can't be locked without waiting for another process -or thread to unlock the semaphore by performing sem_post function. This -wait shall be terminated when the specified timout expires. - - -The timeout shall expire when the absolute time specified by abs_timeout -passes, as measured by the clock on which timeouts are based, or if the -absolute time specified by abs_timeout has already been passed at the -time of the call. - - -sem_timedwait function shall return zero if the calling process successfully -performed the semaphore lock. Return -1 if the call unsuccessful which shall -keep the state of the semaphore unchanged. - - -The sem_timedout function shall fail with: -EINVAL Error: SEM argument doesn't refer to a valid semaphore. - - -The sem_timedout function shall fail with: -EINVAL Error: The process or thread would have blocked, and the abs_timeout -parameter specified a nanoseconds field value less than zero or greater than -or equal to 1000 million. - - -The sem_timedout function shall fail with: -ETIMEDOUT Error: The semaphore could not be locked before the specified -timeout expired. - - -The sem_timedout function may fail with: -EDEADLK Error: A deadlock condition was detected. - - -The sem_timedout function may fail with: -EINTR Error: A signal interrupted this function. - - -If the Timers option is supported, the timeout shall be based on the CLOCK_REALTIME clock. If the Timers option is not supported, the timeout shall be based on the system clock as returned by the time() function. The resolution of the timeout shall be the resolution of the clock on which it is based. - - -Under no circumstance shall the function fail with a timeout if the semaphore can be locked immediately. The validity of the abs_timeout need not be checked if the semaphore can be locked immediately. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/coverage.txt deleted file mode 100644 index 5b4c8611d0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_timedwait/coverage.txt +++ /dev/null @@ -1,19 +0,0 @@ - -This file defines the coverage for sem_timedwait - -ASSERTION COVERED? -1 YES -2 YES -3 YES -4 YES -5 NO -6 YES -7 YES -8 WON'T -- couldn't figure out away of doing it. -9 YES -10 YES -11 YES - - - -~ diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/1-1.c deleted file mode 100644 index ec612442a6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/1-1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * sem_wait shall lock the unlocked semaphore and decrement the semaphore - * value by one. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "1-1" -#define FUNCTION "sem_unlink" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is 1 */ - mysemp = sem_open(semname, O_CREAT,0,1); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if ( sem_unlink(semname) == -1) { - puts("TEST FAILED: Couldn't remove the named semaphore"); - return PTS_FAIL; - } else { - puts("TEST PASSED"); - sem_close(mysemp); - return PTS_PASS; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/2-1.c deleted file mode 100644 index d70a31f067..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/2-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * this test case verifies that the named semaphore has been removed after - * calling sem_unlink. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "2-1" -#define FUNCTION "sem_unlink" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is 1 */ - mysemp = sem_open(semname, O_CREAT,0,1); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if ( sem_unlink(semname) == 0 ) { - if ((sem_wait (mysemp)) == -1) { - puts("TEST FAILED: Couldn't remove named semaphore"); - return PTS_FAIL; - } else { - puts("TEST PASSED"); - sem_close(mysemp); - return PTS_PASS; - } - } - puts("TEST FAILED"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/2-2.c deleted file mode 100644 index dd92d2f586..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/2-2.c +++ /dev/null @@ -1,282 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* Destruction of the semaphore is postponed until all processes which were using -* the semaphore have called sem_close, _exit or exec. - - - -* The steps are: -* -> Create a named semaphore with value = 0. -* -> create 3 processes. Each call sem_wait, then sem_post, then sem_close/_exit/exec -* -> the main process unlinks the semaphore, the posts it and close it. -* -> Check all child processes have returned successfully. - -* The test fails if a semaphore operation returns an error in one of the children. - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SEM_NAME "/sem_unlink_9_1" - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -/* Operations common to all processes on the semaphore*/ -sem_t * common() -{ - int ret; - sem_t * sem; - - /* Reconnect to the semaphore */ - sem = sem_open( SEM_NAME, 0 ); - - if ( sem == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to reconnect the semaphore" ); - } - - - /* block until the semaphore is posted */ - - do - { - ret = sem_wait( sem ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - FAILED( "Waiting for the semaphore failed" ); - } - - /* spend some time... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Post the semaphore back */ - ret = sem_post( sem ); - - if ( ret != 0 ) - { - FAILED( "Failed to post the semaphore" ); - } - - return sem; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t p1, p2, p3, ctl; - - sem_t * sem; - - /* Initialize output */ - output_init(); - - /* Create the semaphore */ - sem = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 0 ); - - if ( ( sem == SEM_FAILED ) && ( errno == EEXIST ) ) - { - sem_unlink( SEM_NAME ); - sem = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 0 ); - } - - if ( sem == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to create the semaphore" ); - } - - /* fork 3 times */ - p1 = fork(); - - if ( p1 == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - if ( p1 == ( pid_t ) 0 ) /* child */ - { - sem = common(); - ret = sem_close( sem ); - - if ( ret != 0 ) - { - FAILED( "Failed to sem_close in child" ); - } - - exit( 0 ); - } - - p2 = fork(); - - if ( p2 == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - if ( p2 == ( pid_t ) 0 ) /* child */ - { - sem = common(); - _exit( 0 ); - } - - p3 = fork(); - - if ( p3 == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - if ( p3 == ( pid_t ) 0 ) /* child */ - { - sem = common(); - ret = execl( "/bin/ls", "ls", NULL ); - UNRESOLVED( errno, "Failed to exec" ); - } - - /* Let all processes start and wait for the semaphore */ - sleep( 1 ); - - /* Unlink */ - ret = sem_unlink( SEM_NAME ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink the semaphore" ); - } - - /* Post the semaphore */ - ret = sem_post( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - /* and close it in this process */ - ret = sem_close( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close the semaphore" ); - } - - /* Wait all processes */ - ctl = waitpid( p1, &status, 0 ); - - if ( ctl != p1 ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != 0 ) ) - { - FAILED( "Child 'sem_close' exited abnormally" ); - } - - ctl = waitpid( p2, &status, 0 ); - - if ( ctl != p2 ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != 0 ) ) - { - FAILED( "Child '_exit' exited abnormally" ); - } - - ctl = waitpid( p3, &status, 0 ); - - if ( ctl != p3 ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != 0 ) ) - { - FAILED( "Child 'exec' exited abnormally" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/3-1.c deleted file mode 100644 index 0e7e9bab26..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/3-1.c +++ /dev/null @@ -1,250 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* sem_unlink will return -1 and set errno to EACCESS if the process has not -* priviledge to unlink the sem. - -* The steps are: -* -> open a semaphore with 0744 mask -* -> fork -* -> change child uid -* -> child attempts to unlink the semaphore. It should fail. -* -> join the child -* -> sem_unlink (should be OK) - -* The test fails if the child process is able to unlink the semaphore. - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* Some of the routines are XSI extensions */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SEM_NAME "/sem_unlink_3_1" - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -/* Set the euid of this process to a non-root uid */ -/* (from ../sem_open/3-1.c) */ -int set_nonroot() -{ - - struct passwd * pw; - setpwent(); - /* search for the first user which is non root */ - - while ( ( pw = getpwent() ) != NULL ) - if ( strcmp( pw->pw_name, "root" ) ) - break; - - endpwent(); - - if ( pw == NULL ) - { - output( "There is no other user than current and root.\n" ); - return 1; - } - - if ( seteuid( pw->pw_uid ) != 0 ) - { - if ( errno == EPERM ) - { - output( "You don't have permission to change your UID.\n" ); - return 1; - } - - perror( "An error occurs when calling seteuid()" ); - return 1; - } - - output( "Testing with user '%s' (uid: %d)\n", - pw->pw_name, ( int ) geteuid() ); - return 0; -} - - - - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t ch, ctl; - sem_t * sem; - - /* Initialize output */ - output_init(); - - /* Create the semaphore */ - sem = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0744, 1 ); - - if ( ( sem == SEM_FAILED ) && ( errno == EEXIST ) ) - { - sem_unlink( SEM_NAME ); - sem = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0744, 1 ); - } - - if ( sem == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to create the semaphore" ); - } - - /* fork */ - ch = fork(); - - if ( ch == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - if ( ch == ( pid_t ) 0 ) /* child */ - { - /* connect to the semaphore */ - sem = sem_open( SEM_NAME, 0 ); - - if ( sem == SEM_FAILED ) - { - output( "Failed to connect to the semaphore, error %d: %s\n", errno, strerror( errno ) ); - exit( 1 ); - } - - /* change euid */ - ret = set_nonroot(); - - if ( ret ) - { - output( "Changing euid failed\n" ); - exit ( 1 ); - } - - /* try and unlink, it should fail */ - ret = sem_unlink( SEM_NAME ); - - if ( ret == 0 ) - { - output( "sem_unlink did not fail in child" ); - exit( 2 ); - } - - if ( errno != EACCES ) - { - output( "sem_unlink failed with unexpected error %d: %s\n", errno, strerror( errno ) ); - exit( 2 ); - } - - /* Ok, child is done. */ - exit( 0 ); - } - - /* Parent waits for the child to finish */ - ctl = waitpid( ch, &status, 0 ); - - if ( ctl != ch ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( !WIFEXITED( status ) ) - { - FAILED( "Child exited abnormally" ); - } - - if ( WEXITSTATUS( status ) == 1 ) - { - UNRESOLVED( 0, "An error occured in child" ); - } - - if ( WEXITSTATUS( status ) == 2 ) - { - FAILED( "Test failed in child" ); - } - - if ( WEXITSTATUS( status ) != 0 ) - { - UNRESOLVED( 0, "Unexpected return value from child" ); - } - - /* Unlink */ - ret = sem_unlink( SEM_NAME ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink the semaphore" ); - } - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/4-1.c deleted file mode 100644 index f8fe36bdb6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/4-1.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (c) 2003, Intel Corporation. All rights reserved. - Created by: majid.awad REMOVE-THIS AT intel DOT com - This file is licensed under the GPL license. For the full content - of this license, see the COPYING file at the top level of this - source tree. - */ - -/* - * Trying to unlink a semaphore which it doesn't exist. It give an ERROR: - * ENOENT. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "4-1" -#define FUNCTION "sem_unlink" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - - char semname[20]; - - sem_unlink(semname); - - if (errno == ENOENT) { - puts("TEST PASSED"); - return PTS_PASS; - } else { - puts("TEST FAILED: semaphore does exist"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/4-2.c deleted file mode 100644 index be3b7e32e7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/4-2.c +++ /dev/null @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* sem_unlink will return -1 and set errno to ENOENT when the named semaphore -* does not exist. - -* The steps are: -* -> Unlink once to make sure this name does not exist. Ignore the error. -* -> Unlink again and check that ENOENT is returned - - -* The test fails if the error is not ENOENT, or there is no error. - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SEM_NAME "/sem_unlink_4_2" - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - - /* Initialize output */ - output_init(); - - ( void ) sem_unlink( SEM_NAME ); - - ret = sem_unlink( SEM_NAME ); - - if ( ret != -1 ) - { - FAILED( "sem_unlink did not return -1" ); - } - - if ( errno != ENOENT ) - { - output( "Error %d: %s\n", errno, strerror( errno ) ); - FAILED( "The error was not ENOENT" ); - } - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/5-1.c deleted file mode 100644 index 4dc28e7114..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/5-1.c +++ /dev/null @@ -1,221 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* sem_unlink will return -1 and set errno to ENAMETOOLONG when the semaphore -* name length is greater than PATH_MAX or a component length is greater than -* NAME_MAX. - -* The steps are: -* -> If PATH_MAX is positive, -* -> create a semaphore with a name bigger than PATH_MAX. -* -> if the creation succeeds, try to unlink. It should fail. -* -> If NAME_MAX is positive, do similar test. - -* The test fails if the ENAMETOOLONG is not returned. -* It also FAILS if this error is returned, as it means we can create a semaphore -* which cannot be removed. -* So actually, if the creation succeeds, the test fails :)) - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SEM_NAME "/sem_unlink_5_1" - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, error; - sem_t * sem; -#undef PATH_MAX -#undef NAME_MAX - long PATH_MAX, NAME_MAX; - char * sem_name; - - /* Initialize output */ - output_init(); - - /* Get PATH_MAX value */ - PATH_MAX = pathconf( "/", _PC_PATH_MAX ); - -#if VERBOSE > 0 - output( "PATH_MAX: %ld\n", PATH_MAX ); -#endif - - if ( PATH_MAX > 0 ) - { - /* create a semaphore with a name longer than PATH_MAX */ - sem_name = calloc( PATH_MAX + 1, sizeof( char ) ); - - if ( sem_name == NULL ) - { - UNRESOLVED( errno, "Failed to allocate space for the semaphore name" ); - } - - /* the space was allocated */ - sem_name[ 0 ] = '/'; - - sem_name[ PATH_MAX ] = '\0'; - - memset( sem_name + 1, 'P', PATH_MAX - 1 ); - - /* Create the semaphore */ - sem = sem_open( sem_name, O_CREAT, 0777, 1 ); - - if ( sem != SEM_FAILED ) - { - ret = sem_unlink( sem_name ); - error = errno; - free( sem_name ); - - if ( ret == 0 ) - { - FAILED( "The function did not return ENAMETOOLONG as expected" ); - } - else - { - output( "Error was %d: %s\n", error, strerror( error ) ); - FAILED( "Unable to unlink a semaphore which we just created" ); - } - } - -#if VERBOSE > 0 - else - { - output( "Creation of the semaphore failed with error %d: %s\n", errno, strerror( errno ) ); - } - -#endif - - } - - /* Get NAME_MAX value */ - NAME_MAX = pathconf( "/", _PC_NAME_MAX ); - -#if VERBOSE > 0 - output( "NAME_MAX: %ld\n", NAME_MAX ); - -#endif - - if ( NAME_MAX > 0 ) - { - /* create a semaphore with a name longer than NAME_MAX */ - sem_name = calloc( NAME_MAX + 2, sizeof( char ) ); - - if ( sem_name == NULL ) - { - UNRESOLVED( errno, "Failed to allocate space for the semaphore name" ); - } - - /* the space was allocated */ - sem_name[ 0 ] = '/'; - - sem_name[ NAME_MAX + 1 ] = '\0'; - - memset( sem_name + 1, 'N', NAME_MAX ); - - /* Create the semaphore */ - sem = sem_open( sem_name, O_CREAT , 0777, 1 ); - - if ( sem != SEM_FAILED ) - { - ret = sem_unlink( sem_name ); - error = errno; - free( sem_name ); - - if ( ret == 0 ) - { - FAILED( "The function did not return ENAMETOOLONG as expected" ); - } - else - { - output( "Error was %d: %s\n", error, strerror( error ) ); - FAILED( "Unable to unlink a semaphore which we just created" ); - } - } - -#if VERBOSE > 0 - else - { - output( "Creation of the semaphore failed with error %d: %s\n", errno, strerror( errno ) ); - } - -#endif - - } - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/6-1.c deleted file mode 100644 index 505f73f4ef..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/6-1.c +++ /dev/null @@ -1,200 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* A call to sem_open with the same name refers to a new semaphore, once -* sem_unlink has been called. - -* The steps are: -* -> open a semaphore -* -> unlink -* -> try to reconnect (should fail) -* -> open with O_CREATE -* -> check the semaphore are different - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SEM_NAME "/sem_unlink_6_1" - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, value; - - sem_t * sem1, * sem2; - - /* Initialize output */ - output_init(); - - /* Create the semaphore */ - sem1 = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 1 ); - - if ( ( sem1 == SEM_FAILED ) && ( errno == EEXIST ) ) - { - sem_unlink( SEM_NAME ); - sem1 = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 1 ); - } - - if ( sem1 == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to create the semaphore" ); - } - - /* Unlink */ - ret = sem_unlink( SEM_NAME ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink the semaphore" ); - } - - /* Try reconnect */ - sem2 = sem_open( SEM_NAME, 0 ); - - if ( sem2 != SEM_FAILED ) - { - FAILED( "Reconnecting the unlinked semaphore did not failed" ); - } - - if ( errno != ENOENT ) - { - output( "Error %d: %s\n", errno, strerror( errno ) ); - FAILED( "Reconnecting the unlinked semaphore failed with a wrong error" ); - } - - /* Reopen the semaphore */ - sem2 = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 3 ); - - if ( sem2 == SEM_FAILED ) - { - output( "Gor error %d: %s\n", errno, strerror( errno ) ); - FAILED( "Failed to recreate the semaphore" ); - } - - /* Check the semaphore have different values */ - ret = sem_getvalue( sem1, &value ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read sem1 value" ); - } - - if ( value != 1 ) - { - output( "Read: %d\n", value ); - FAILED( "Semaphore value is not as expected" ); - } - - ret = sem_getvalue( sem2, &value ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to read sem1 value" ); - } - - if ( value != 3 ) - { - output( "Read: %d\n", value ); - FAILED( "Semaphore value is not as expected" ); - } - - /* Unlink */ - ret = sem_unlink( SEM_NAME ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink the semaphore" ); - } - - /* close both */ - ret = sem_close( sem1 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close the semaphore" ); - } - - ret = sem_close( sem2 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/7-1.c deleted file mode 100644 index c08d1829f9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/7-1.c +++ /dev/null @@ -1,180 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* sem_unlink does not block. - -* The steps are: -* -> open a semaphore -* -> create a thread which blocks on the semaphore -* -> call sem_unlink -* -> clean up - -* The test fails when it hangs on sem_unlink. - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SEM_NAME "/sem_unlink_7_1" - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -void * threaded ( void * arg ) -{ - int ret = 0; - - do - { - ret = sem_wait( arg ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to wait for the semaphore" ); - } - - return NULL; -} - - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - pthread_t thread; - sem_t * sem; - - /* Initialize output */ - output_init(); - - /* Create the semaphore */ - sem = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 1 ); - - if ( ( sem == SEM_FAILED ) && ( errno == EEXIST ) ) - { - sem_unlink( SEM_NAME ); - sem = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 1 ); - } - - if ( sem == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to create the semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &thread, NULL, threaded, sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create the thread" ); - } - - /* Let some time for the thread to block */ - sleep( 1 ); - - /* Unlink */ - ret = sem_unlink( SEM_NAME ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink the semaphore" ); - } - - /* Now, we're success */ - ret = sem_post( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - /* Join the thread */ - ret = pthread_join( thread, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* close */ - ret = sem_close( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close the semaphore" ); - } - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/9-1.c deleted file mode 100644 index 93fad427c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/9-1.c +++ /dev/null @@ -1,199 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* When the semaphore is referenced by other processes, the function has -* no effect on the state of the semaphore. - - -* The steps are: -* -> Create a named semaphore -* -> create a thread which waits on the semaphore -* -> unlink the semaphore -* -> check the thread did not return -* -> post the semaphore -* -> check the thread returned -* -> close the semaphore - -* The test fails if the semaphore state is changed by sem_unlink. - -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SEM_NAME "/sem_unlink_9_1" - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ -int thread_state = 0; - -void * threaded ( void * arg ) -{ - int ret; - thread_state = 1; - - do - { - ret = sem_wait( arg ); - } - while ( ( ret != 0 ) && ( errno == EINTR ) ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to wait for the semaphore" ); - } - - thread_state = 2; - return NULL; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - pthread_t child; - sem_t * sem; - - /* Initialize output */ - output_init(); - - /* Create the semaphore */ - sem = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 0 ); - - if ( ( sem == SEM_FAILED ) && ( errno == EEXIST ) ) - { - sem_unlink( SEM_NAME ); - sem = sem_open( SEM_NAME, O_CREAT | O_EXCL, 0777, 0 ); - } - - if ( sem == SEM_FAILED ) - { - UNRESOLVED( errno, "Failed to create the semaphore" ); - } - - /* Create the child */ - ret = pthread_create( &child, NULL, threaded, sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create the thread" ); - } - - /* Wait for the child to be waiting. */ - while ( thread_state != 1 ) - { - sched_yield(); - } - - /* Unlink */ - ret = sem_unlink( SEM_NAME ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to unlink the semaphore" ); - } - - /* Check the semaphore state did not change. */ - sleep( 1 ); - - if ( thread_state != 1 ) - { - FAILED( "sem_unlink made sem_wait thread return" ); - } - - /* Post the semaphore */ - ret = sem_post( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - /* Join the thread */ - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* Now, we can destroy all */ - ret = sem_close( sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - output( "Test passed\n" ); - -#endif - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/assertions.xml deleted file mode 100644 index fae3c949c8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/assertions.xml +++ /dev/null @@ -1,34 +0,0 @@ - - -sem_unlink shall remove the created named semaphore and return zero on -success. - - -Destruction of the semaphore is postponed until all process which were using the semaphore have called sem_close, _exit or exec. - - -The function returns -1 and sets errno to EACCESS when the process has -insufficient priviledge to unlink the semaphore. - - -ERROR: ENOENT: Trying to unlink a named semaphore which doesn't exist. - - -ERROR: ENAMETOOLONG: The semaphore name length is greater than PATH_MAX or -a patch component length is greater than NAME_MAX. - - -Calls to sem_open to recreate/reconnect the semaphore actually refer to a new -semaphore after sem_unlink has been called. - - -Calls to sem_unlink are not blocking. - - -Calls to sem_unlink should return 0 on success and -1 on failure. - - -When the semaphore is referenced by other processes, the function has no -effect on the state of the semaphore. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/cln.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/cln.sh deleted file mode 100755 index 880838525b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/cln.sh +++ /dev/null @@ -1,9 +0,0 @@ - -rm -f /tmp/mysem >/dev/null 2>&1 -rm -f /tmp/sem_* >/dev/null 2>&1 -rm -f a.out - -for sem_id in `ipcs -s | awk '{print $2}'` ; do - ipcrm sem $sem_id > /dev/null 2>&1 -done - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/coverage.txt deleted file mode 100644 index ade41a9cde..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/coverage.txt +++ /dev/null @@ -1,6 +0,0 @@ - --- assertion 3: not tested. --- assertion 5: not tested. --- assertion 6: Not tested. --- assertion 7: Not tested. --- assertion 8: is being tested in the sem_unlink test cases. diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_unlink/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/1-1.c deleted file mode 100644 index 4f1b058f62..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/1-1.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * sem_wait shall lock the unlocked semaphore and decrement the semaphore - * value by one. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "1-1" -#define FUNCTION "sem_wait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is 1 */ - mysemp = sem_open(semname, O_CREAT, 0777, 1); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - - /* Lock Semaphore */ - if( sem_wait(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_wait"); - return PTS_UNRESOLVED; - } - - - /* Value of Semaphore */ - if( sem_getvalue(mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - - /* Checking if the value of the Semaphore decremented by one */ - } else if( val == 0 ) { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/1-2.c deleted file mode 100644 index 32fb435c3c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/1-2.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * Keep calling sem_wait until the sempahore is locked. That is - * decrementing the semaphore value by one until its zero or locked. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "2-1" -#define FUNCTION "sem_wait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - int value = 10; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is 10 */ - mysemp = sem_open(semname, O_CREAT, 0777, value); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - while (value) - { // checking the value if zero yet. - if( sem_wait(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } else { - value--; - } - } - - - if( sem_getvalue(mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - - } else if( val == 0 ) { - puts("TEST PASSED"); - sem_unlink(semname); - sem_close(mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED: Semaphore is not locked"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/11-1.c deleted file mode 100644 index 3488a34488..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/11-1.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * sem_trywait shall try to lock the unlocked semaphore and decrement - * the semaphore value by one. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "11-1" -#define FUNCTION "sem_trywait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is 1 */ - mysemp = sem_open(semname, O_CREAT, 0777, 1); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - - /* Lock Semaphore by sem_trywait*/ - if( sem_trywait(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_wait"); - return PTS_UNRESOLVED; - } - - - /* Value of Semaphore */ - if( sem_getvalue(mysemp, &val) == -1 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - - /* Checking if the value of the Semaphore decremented by one */ - } else if( val == 0 ) { - puts("TEST PASSED"); - sem_unlink(semname); - sem_close(mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/12-1.c deleted file mode 100644 index 7d3ee805bb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/12-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * sem_trywait shall try to lock the locked semaphore and decrement - * the semaphore value by one. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "12-1" -#define FUNCTION "sem_trywait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is 1 */ - mysemp = sem_open(semname, O_CREAT, 0777, 0); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - - /* Try to Lock Semaphore by sem_trywait*/ - if( sem_trywait(mysemp) == -1 ) { - puts("TEST PASSED"); - sem_unlink(semname); - sem_close(mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED: Semaphore locked when it shouldn't"); - return PTS_FAIL; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/13-1.c deleted file mode 100644 index dc5e5b11d0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/13-1.c +++ /dev/null @@ -1,193 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* If the semaphore count is 0, the call blocks until the semphore can be -* locked or the operation is interrupted by a signal. - - -* The steps are: -* -> Initialize a semaphore to 0 count -* -> Register a signal handler for SIGALRM which post the semaphore -* -> save current time -* -> set an alarm to 1 second -* -> sem_wait -* -> Verify either errno is EINTR or no error occured. -* -> Verify 1 sec has elapsed. - -* The test fails if the call did not block. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ -sem_t sem; - -void handler( int sig ) -{ - int ret; - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post semaphore" ); - } -} - - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - - struct timespec ts_ref, ts_fin; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Initialize semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to init semaphore" ); - } - - /* Register signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - sigaction( SIGALRM, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Save current time */ - ret = clock_gettime( CLOCK_REALTIME, &ts_ref ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Unable to read clock" ); - } - - /* Alarm */ - alarm( 1 ); - - /* Wait for the semaphore */ - ret = sem_wait( &sem ); - - if ( ( ret != 0 ) && ( errno != EINTR ) ) - { - UNRESOLVED( errno, "Failed to wait for the semaphore" ); - } - - /* Check that 1 second has really elapsed */ - ret = clock_gettime( CLOCK_REALTIME, &ts_fin ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Unable to read clock" ); - } - - if ( ( ( ts_fin.tv_sec - ts_ref.tv_sec ) * 1000000000 ) + ( ts_fin.tv_nsec - ts_ref.tv_nsec ) < 1000000000 ) - { - output( "Ts: %d.%9.9d -> %d.%9.9d\n", ts_ref.tv_sec, ts_ref.tv_nsec, ts_fin.tv_sec, ts_fin.tv_nsec ); - FAILED( "The sem_wait call did not block" ); - } - - /* Destroy the semaphore */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to sem_destroy" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/3-1.c deleted file mode 100644 index b14cad4a4b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/3-1.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* This test case verifies that the semaphore shall be locked until the - * sem_post is executed and returns successfully. - * Lines: 39056-39057 - */ - - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "3-1" -#define FUNCTION "sem_wait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - - -int main() -{ - sem_t *mysemp; - char semname[50]; - int val; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0, 1); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if( sem_wait(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_wait"); - return PTS_UNRESOLVED; - } - - if( sem_post(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_post"); - return PTS_UNRESOLVED; - } - - if( sem_getvalue(mysemp, &val) < 0 ) { - perror(ERROR_PREFIX "sem_getvalue"); - return PTS_UNRESOLVED; - } - - if (val == 1 ) { - puts("TEST PASSED"); - sem_unlink(semname); - sem_close(mysemp); - return PTS_PASS; - } else { - puts("TEST FAILED"); - return PTS_FAIL; - } -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/5-1.c deleted file mode 100644 index 111beac181..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/5-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* - * errno return EAGAIN: The semaphore can't be immediately locked by - * sem_trywait when its already locked. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "5-1" -#define FUNCTION "sem_trywait" -#define ERROR_PREFIX "unexpected errno: " FUNCTION " " TEST ": " - - - -int main() { - sem_t *mysemp; - char semname[50]; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - /* Initial value of Semaphore is 0 Locked */ - mysemp = sem_open(semname, O_CREAT, 0777, 0); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - /* Lock Semaphore by sem_trywait*/ - if (( sem_trywait(mysemp) == -1) && ( errno == EAGAIN) ) { - puts("TEST PASSED"); - sem_close(mysemp); - sem_unlink(semname); - return PTS_PASS; - } else { - puts("TEST FAILED: ERROR IS NOT EAGAIN"); - return PTS_FAIL; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/7-1.c deleted file mode 100644 index 7d47b6c307..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/7-1.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2003, Intel Corporation. All rights reserved. - * Created by: majid.awad REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - */ - -/* sem_wait hangs when it tries to lock a locked semaphore, and then killed - * by sending a kill signal. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -#define TEST "7-1" -#define FUNCTION "sem_wait" -#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " - -#define CHILDPASS 1 -#define CHILDFAIL 0 - -void handler(int signo) -{ - printf("In handler\n"); -} - -int main() -{ - sem_t *mysemp; - char semname[50]; - int pid, status; - - sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid()); - - mysemp = sem_open(semname, O_CREAT, 0, 1); - if( mysemp == SEM_FAILED || mysemp == NULL ) { - perror(ERROR_PREFIX "sem_open"); - return PTS_UNRESOLVED; - } - - if( sem_wait(mysemp) == -1 ) { - perror(ERROR_PREFIX "sem_wait"); - return PTS_UNRESOLVED; - } - - pid = fork(); - if (pid == 0) { // child create the semaphore. - struct sigaction act; - - act.sa_handler=handler; - act.sa_flags=0; - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return CHILDFAIL; - } - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return CHILDFAIL; - } - - sem_wait(mysemp); - - if (errno == EINTR) { - printf("Test PASSED\n"); - return (CHILDPASS); - } - puts("TEST FAILED: errno != EINTR"); - return (CHILDFAIL); - - } else { // parent to send a signal to child - int i; - sleep(1); - status = kill(pid,SIGABRT); // send signal to child - if (wait(&i) == -1) { - perror("Error waiting for child to exit\n"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(i)) { - return PTS_FAIL; - } - puts("TEST PASSED"); - sem_unlink(semname); - return PTS_PASS; - } - - return PTS_UNRESOLVED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/assertions.xml deleted file mode 100644 index 13c3314823..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/assertions.xml +++ /dev/null @@ -1,44 +0,0 @@ - - -sem_wait will lock the unlocked semaphore and decrement the semaphore -value by one. - - -sem_wait: This test case verifies that the semaphore shall remain -locked until the sem_post is executed and return successfully. - - -sem_wait hangs when it tries to lock a locked semaphore, and then killed -by sending a kill signal (SIGKILL). - - -errno return EAGAIN: The semaphore can't be immediately locked by -sem_trywait when its already locked. - - -errno return EINVAL: the semaphore argument doesn't not refer to a valid -semaphore - - -errno return EINTR: a signal interrupted the waiting semaphore. - - -errno return EDEADLK: sem_wait/trywait will fail if a deadlock condition is -detected. - - -sem_wait/trywait return 0 on success and -1 of failure. - - -sem_trywait shall try to lock the unlocked semaphore and decrement -the semaphore value by one. - - -sem_trywait shall fail to lock a locked semaphore and try to decrement -the semaphore value by one. - - -If the semaphore count is 0, the call blocks until the semphore can be locked -or the operation is interrupted by a signal. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/cln.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/cln.sh deleted file mode 100755 index 880838525b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/cln.sh +++ /dev/null @@ -1,9 +0,0 @@ - -rm -f /tmp/mysem >/dev/null 2>&1 -rm -f /tmp/sem_* >/dev/null 2>&1 -rm -f a.out - -for sem_id in `ipcs -s | awk '{print $2}'` ; do - ipcrm sem $sem_id > /dev/null 2>&1 -done - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/coverage.txt deleted file mode 100644 index b955d0b0bf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/coverage.txt +++ /dev/null @@ -1,14 +0,0 @@ - -Will not test the following error values of the semaphores because it is -unknown to me of how to return these values. - --- EDEADLK: A deadlock condition was detected. - --- assertion 6: not tested. - --- assertion 9: is being covered in the other sem_wait cases. - -TODO: Help create a test case for the EDEADLK ERROR code. - - -~ diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/testfrmw.c deleted file mode 100644 index d6f4d8ba12..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/testfrmw.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/testfrmw.h deleted file mode 100644 index e3c9028f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sem_wait/testfrmw.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * 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., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/1-1.c deleted file mode 100644 index 5072a99fe1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/1-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_open() function establish a connection between a shared - * memory object and a file descriptor. - * - * Step: - * 1. Create a file a shared memory object using shm_open(). - * 2. Write in the file referenced by the file descriptor return by - * shm_open(). - * 3. Reopen the file with shm_open(). - * 4. Read in the file. - * The test pass if it read what it was previously written. - */ - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "posixtest_1-1" - -int main() { - int fd; - char str[BUF_SIZE] = "qwerty"; - char *buf; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - buf = mmap(NULL, BUF_SIZE, PROT_WRITE, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - strcpy(buf, str); - - fd = shm_open(SHM_NAME, O_RDONLY, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - buf = mmap(NULL, BUF_SIZE, PROT_READ, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - shm_unlink(SHM_NAME); - if(strcmp(buf, str) == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/10-1.c deleted file mode 100644 index 0df6acd5c2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/10-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test whether the file offset is set because it is unspecified. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test whether the file offset is set because it is unspecified.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/11-1.c deleted file mode 100644 index e7fdd31fc5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/11-1.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the FD_CLOEXEC file descriptor flag associated with the new file - * descriptor is set - * - * The test use fstat to check the flag. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_11-1" - -int main(){ - int fd, flags; - - fd = shm_open(SHM_NAME, O_RDONLY|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - flags = fcntl(fd, F_GETFD); - if(flags == -1) { - perror("An error occurs when calling fcntl()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - shm_unlink(SHM_NAME); - - if(flags & FD_CLOEXEC){ - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("shm_open() does not set the FD_CLOEXEC flags.\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/12-1.c deleted file mode 100644 index f560d31df4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/12-1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the behavior of implementation when an application does not - * specify exactly one of the first two values (access modes) below in the - * value of oflag: - * O_RDONLY - * O_RDWR - * - * Often O_RDONLY == 0 and O_RDWR == 2^n, so when both values are specified, - * the result is the same than when only O_RDWR is set. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the behavior of implementation when an application does not\nspecify exactly one of two values: O_RDONLY and O_RDWR.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/13-1.c deleted file mode 100644 index 33d1937a9b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/13-1.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the file is not open for write access when the applications - * specify the value of O_RDONLY. - * - * The test uses ftruncate to check that the file is not open for write access. - */ - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_13-1" -#define BUF_SIZE 8 - -int main(){ - int fd, result; - - fd = shm_open(SHM_NAME, O_RDONLY|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - result = ftruncate(fd, BUF_SIZE); - - if(result == -1 && errno == EINVAL) { - printf("Test PASSED\n"); - shm_unlink(SHM_NAME); - return PTS_PASS; - } else if(result == 0){ - printf("The file is open for write acces.\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; - } - - perror("ftruncate"); - shm_unlink(SHM_NAME); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/13-2.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/13-2.sh deleted file mode 100755 index 52cd4284d0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/13-2.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -# -# Test that the file is open for read acces when the applications specify -# the value of O_RDONLY. -# -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/14-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/14-1.sh deleted file mode 100755 index 23ba744562..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/14-1.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -# -# Test that the file is open for write acces when the applications specify -# the value of O_RDWR. -# -# This is tested implicitly via assertion 1. - -echo "Tested implicitly via assertion 1." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/14-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/14-2.c deleted file mode 100644 index dbefdd528b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/14-2.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the file is open for read acces when the applications specify - * the value of O_RDWR. - * - * Step: - * 1. Create a file a shared memory object using shm_open(). - * 2. Write in the file referenced by the file descriptor return by - * shm_open(). - * 3. Reopen the file with shm_open() and O_RDWR set. - * 4. Read in the file. - * The test pass if it read what it was previously written. - */ - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "posixtest_14-2" - -int main() { - int fd; - char str[BUF_SIZE] = "qwerty"; - char *buf; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - return PTS_UNRESOLVED; - } - - buf = mmap(NULL, BUF_SIZE, PROT_WRITE, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - return PTS_UNRESOLVED; - } - - strcpy(buf, str); - - fd = shm_open(SHM_NAME, O_RDWR, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - buf = mmap(NULL, BUF_SIZE, PROT_READ, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - return PTS_UNRESOLVED; - } - - shm_unlink(SHM_NAME); - if(strcmp(buf, str) == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/15-1.c deleted file mode 100644 index 5566231e20..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/15-1.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shared memory object is created if the shared memory object - * does not exists and the O_CREAT flags is set. - * - * Steps: - * 1. Ensure that the shared memory object does not exists using shm_unlink. - * 2. Call shm_open() with O_CREAT flags set. - * 3. Check that the shared memory object exists now using fstat. - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_15-1" - - -int main(){ - int fd, result; - struct stat stat_buf; - - result = shm_unlink(SHM_NAME); - if(result != 0 && errno != ENOENT) { - /* The shared memory object exist and shm_unlink can not - remove it. */ - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDONLY|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - result = fstat(fd, &stat_buf); - - if(result == 0) { - printf("Test PASSED\n"); - shm_unlink(SHM_NAME); - return PTS_PASS; - } else if(result == -1 && errno == EBADF) { - printf("The shared memory object was no created.\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; - } - - perror("fstat"); - shm_unlink(SHM_NAME); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/16-1.c deleted file mode 100644 index 0f9134fcbd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/16-1.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the user ID of the shared memory object is set to the effective - * user ID of the process when the shared memory object does not exists and the - * O_CREAT flags is set. - * - * The test use fstat to check the flag. - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_16-1" - -int main(){ - int fd, result; - struct stat stat_buf; - - result = shm_unlink(SHM_NAME); - if(result != 0 && errno != ENOENT) { - /* The shared memory object exist and shm_unlink can not - remove it. */ - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDONLY|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - result = fstat(fd, &stat_buf); - if(result != 0) { - perror("An error occurs when calling fstat()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - shm_unlink(SHM_NAME); - - if(stat_buf.st_uid == geteuid()){ - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("shm_open() does not set the user ID to the effective user ID of the process.\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/17-1.c deleted file mode 100644 index 526a1e7166..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/17-1.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the goup ID of the shared memory object is set to the effective - * group ID of the process when the shared memory object does not exists and - * the O_CREAT flags is set. - * - * The test use fstat to check the flag. - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_17-1" - -int main(){ - int fd, result; - struct stat stat_buf; - - result = shm_unlink(SHM_NAME); - if(result != 0 && errno != ENOENT) { - /* The shared memory object exist and shm_unlink can not - remove it. */ - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDONLY|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - result = fstat(fd, &stat_buf); - if(result != 0) { - perror("An error occurs when calling fstat()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - shm_unlink(SHM_NAME); - - if(stat_buf.st_gid == getegid()){ - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("shm_open() does not set the user ID to the effective user ID of the process.\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/18-1.c deleted file mode 100644 index bb04e3c2db..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/18-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the permission bits of the shared memory object are set to the - * value of the mode argument except those set in the file mode creation mask - * of the process when the shared memory object does not exists and the O_CREAT - * flags is set. - * - * Steps: - * 1. Set umask to UMASK_FLAGS. - * 2. Ensure that the shared memory object does not exist. - * 3. Call shm_open with mode MOD_FLAGS. - * 4. Get the stat of the opened file. - * 5. Check that the permissions flags are right. - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_18-1" - -/* execution bits is undefined */ -#define MOD_FLAGS (S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH) /* -w?rw?r-? */ -#define UMASK_FLAGS (S_IRGRP | S_IWOTH) /* --?r-?-w? */ -#define ALL_MOD_FLAGS (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | \ - S_IROTH | S_IWOTH) /* rw?rw?rw? */ - - -int main(){ - int fd, result; - struct stat stat_buf; - - umask(UMASK_FLAGS); - - result = shm_unlink(SHM_NAME); - if(result != 0 && errno != ENOENT) { - /* The shared memory object exist and shm_unlink can not - remove it. */ - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDONLY|O_CREAT, MOD_FLAGS); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - result = fstat(fd, &stat_buf); - if(result != 0) { - perror("An error occurs when calling fstat()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - shm_unlink(SHM_NAME); - - /* Check the permissions flags. - * Permissions flags are right when the permissions bits of - * stat_buf.st_mode are set if and only if the same bits of MOD_FLAGS - * are set and thoses of UMASK_FLAGS are not, i.e.: - * ALL_MOD_FLAGS & (stat_buf.st_mode ^ (MOD_FLAGS & ~UMASK_FLAGS)) == 0 - */ - if( !(ALL_MOD_FLAGS & - (stat_buf.st_mode ^ (MOD_FLAGS & ~UMASK_FLAGS))) ) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("shm_open() does not set the rights permissions.\n"); - return PTS_FAIL; - -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/19-1.c deleted file mode 100644 index 6ee8c5f456..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/19-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the effect of calling shm_open() when the shared memory object - * does not exists, the O_CREAT flags is set, and bits in mode other than the - * file permission bits are set. It is unspecified. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the effect of calling shm_open() when the shared memory object\ndoes not exists, the O_CREAT flags is set, and bits in mode other than the\nfile permission bits are set. It is unspecified.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/2-1.c deleted file mode 100644 index f4bab48da5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/2-1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test that the shm_open() function create an open file description - * that refers to the shared memory object and a file descriptor that refers to - * that open file description. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that the shm_open() function create an open file description\nthat refers to the shared memory object and a file descriptor that refers to\nthat open file description."); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/20-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/20-1.c deleted file mode 100644 index cf1daa8914..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/20-1.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that shm_open does not open the shared memory object for writing when - * calling shm_open with O_RDONLY even if the mode set write permission. - * - * The test use ftruncate to check the object is not open for writing. - */ - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "posixtest_20-1" - -int main() { - int fd, result; - - result = shm_unlink(SHM_NAME); - if(result != 0 && errno != ENOENT) { - /* The shared memory object exist and shm_unlink can not - remove it. */ - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDONLY|O_CREAT, S_IRUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - result = ftruncate(fd, BUF_SIZE); - - if(result == -1 && errno == EINVAL) { - printf("Test PASSED\n"); - shm_unlink(SHM_NAME); - return PTS_PASS; - } else if(result == 0){ - printf("The shared memory object is opened for writing.\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; - } - - perror("ftruncate"); - shm_unlink(SHM_NAME); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/20-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/20-2.c deleted file mode 100644 index 81ac7b2cea..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/20-2.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that shm_open open the shared memory object for writing when calling - * shm_open with O_RDWR even if the mode don't set write permission. - * - * The test use ftruncate to check the object is open for writing. - */ - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "posixtest_20-2" - -int main() { - int fd, result; - - result = shm_unlink(SHM_NAME); - if(result != 0 && errno != ENOENT) { - /* The shared memory object exist and shm_unlink can not - remove it. */ - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, 0); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - result = ftruncate(fd, BUF_SIZE); - if(result == 0){ - printf("Test PASSED\n"); - shm_unlink(SHM_NAME); - return PTS_PASS; - } else if(result == -1 && errno == EINVAL) { - printf("The shared memory object is not opened for writing.\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; - } - - perror("ftruncate"); - shm_unlink(SHM_NAME); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/20-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/20-3.c deleted file mode 100644 index c6efeca98f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/20-3.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that shm_open open the shared memory object for reading when calling - * shm_open even if the mode don't set read permission. - * - * The test use mmap to check the object is open for reading. - */ - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "posixtest_20-3" - -int main() { - int fd, result; - void *ptr; - - result = shm_unlink(SHM_NAME); - if(result != 0 && errno != ENOENT) { - /* The shared memory object exist and shm_unlink can not - remove it. */ - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, 0); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - ptr = mmap(NULL, BUF_SIZE, PROT_NONE, MAP_SHARED, fd, 0); - if( ptr != MAP_FAILED) { - printf("Test PASSED\n"); - shm_unlink(SHM_NAME); - return PTS_PASS; - } else if(errno == EACCES){ - printf("The shared memory object is not opened for reading.\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; - } - - perror("mmap"); - shm_unlink(SHM_NAME); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/21-1.c deleted file mode 100644 index d63e482c9d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/21-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shared memory object has a size of zero when created. - * - * The test use fstat to get the size of shared memory object. - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_21-1" - -int main(){ - int fd, result; - struct stat stat_buf; - - result = shm_unlink(SHM_NAME); - if(result != 0 && errno != ENOENT) { - /* The shared memory object exist and shm_unlink can not - remove it. */ - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDONLY|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - result = fstat(fd, &stat_buf); - if(result != 0) { - perror("An error occurs when calling fstat()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - shm_unlink(SHM_NAME); - - if(stat_buf.st_size == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("The shared memory object has not a size of zero.\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/22-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/22-1.c deleted file mode 100644 index f66ea23bba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/22-1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that shm_open() fails if the shared memory object exist and O_EXCL and - * O_CREAT are set. - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_22-1" - -int main(){ - int fd; - - /* Create the shared memory object */ - fd = shm_open(SHM_NAME, O_RDONLY|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDONLY|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - - if(fd == -1 && errno == EEXIST) { - printf("Test PASSED\n"); - shm_unlink(SHM_NAME); - return PTS_PASS; - } else if(fd != -1) { - printf("Test FAILED\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; - } - - perror("shm_open"); - shm_unlink(SHM_NAME); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/23-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/23-1.c deleted file mode 100644 index e649ab994a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/23-1.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the check for the existence of the shared memory object and the - * creation of the object if it does not exist is atomic with respect to other - * processes executing shm_open() naming the same shared memory object with - * O_EXCL and O_CREAT set. - * - * This test launch NPROCESS processes which all try to open NLOOP shared - * memory objects. If an unexpected error occurs or if the number of created - * objects is not NLOOP, the test failed. In other case the test is unresolved. - */ - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ - -/* adam.li: 2004-04-30: Rewrite the test case. The idea is that with - O_CREAT and O_EXCL specified, to shm_open() a object can only success - once, although multiple processes might open with the same name at the - same time. - */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NAME_SIZE 50 -#define SHM_NAME "/posixtest_23-1_%d" - -/* The processes communicate by a shared memory object */ -#define SHM_RESULT_NAME "/result_23-1" - -#define NPROCESS 1000 /* Number of concurrent processes */ -#define NLOOP 1000 /* Number of shared memory object */ - -char name[NAME_SIZE]; -int *create_cnt; -sem_t *sem; - -int child_func(void) -{ - int i, fd; - struct timespec ts = {.tv_sec = 0, .tv_nsec = 0}; - int msec = 0; - - sleep(1); - srand(time(NULL)); - for(i=0; i 0); - - for(i=0; i -#include "posixtest.h" - -int main() -{ - printf("Will not test the result of shm_open() when O_EXCL is set and O_CREAT is not\nset because it is undefined.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/25-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/25-1.c deleted file mode 100644 index 374e914ebc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/25-1.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the object is truncated to zero length when O_TRUNC is set, the - * shared memory object exists and it is successfully opened O_RDWR. - * - * Steps: - * 1. Create a shared memory object and set it to a non zero size. - * 2. Call shm_open with O_TRUNC and O_RDWR set. - * 3. Check that the shared memory object is zero length using fstat. - */ - - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_25-1" -#define SHM_SZ 16 - -int main(){ - int fd; - struct stat stat_buf; - - /* Create the shared memory object */ - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, SHM_SZ) == -1) { - perror("An error occurs when calling ftruncate()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(fstat(fd, &stat_buf) != 0) { - perror("An error occurs when calling fstat()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - shm_unlink(SHM_NAME); - - if(stat_buf.st_size == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("The shared memory object is not zero length.\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/26-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/26-1.c deleted file mode 100644 index d59fb0b467..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/26-1.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the mode is unchanged when O_TRUNC is set, the shared memory - * object exists and it is successfully opened O_RDWR. - * - * Steps: - * 1. Create a shared memory object. - * 2. Call shm_open with O_TRUNC and O_RDWR set and with differents permission - * mode. - * 3. Check that the mode is unchanged. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_26-1" -#define CREATION_MODE S_IRUSR|S_IWUSR -#define OPEN_MODE S_IRGRP - - -int main(){ - int fd; - struct stat stat_buf; - mode_t old_mode; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, CREATION_MODE); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(fstat(fd, &stat_buf) != 0) { - perror("An error occurs when calling fstat()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - old_mode = stat_buf.st_mode; - - fd = shm_open(SHM_NAME, O_RDWR|O_TRUNC, OPEN_MODE); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(fstat(fd, &stat_buf) != 0) { - perror("An error occurs when calling fstat()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - shm_unlink(SHM_NAME); - - if(stat_buf.st_mode == old_mode) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("The mode has changed.\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/26-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/26-2.c deleted file mode 100644 index 39bc8570c4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/26-2.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the owner is unchanged when O_TRUNC is set, the shared memory - * object exists and it is successfully opened O_RDWR. - * - * In most case this test will be unresolved if not run by root. - * Steps: - * 1. Create a shared memory object. - * 2. Set a non zero size for this object (to force the modification of the - * object when it will be reopen with O_TRUNC set). - * 3. Set his effective user id to an other user id which is not root. - * 4. Call shm_open with O_TRUNC set. - * 5. Check that the owner is unchanged. - */ - -/* getpwent() is part of XSI option */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "posixtest_26-2" - -int main(){ - int fd; - struct stat stat_buf; - struct passwd *pw; - uid_t old_uid; - gid_t old_gid; - - umask(0); - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, - S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); - - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(fstat(fd, &stat_buf) != 0) { - perror("An error occurs when calling fstat()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - old_uid = stat_buf.st_uid; - old_gid = stat_buf.st_gid; - - /* search for the first user which is non root and which is not the - current user */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root") && pw->pw_uid != getuid()) - break; - - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(seteuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\nTry to rerun this test as root.\n"); - } else { - perror("An error occurs when calling seteuid()"); - } - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - printf("Testing with user '%s' (uid: %i)\n", - pw->pw_name, pw->pw_uid); - - - fd = shm_open(SHM_NAME, O_RDWR|O_TRUNC, 0); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - seteuid(getuid()); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(fstat(fd, &stat_buf) != 0) { - perror("An error occurs when calling fstat()"); - seteuid(getuid()); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - seteuid(getuid()); - shm_unlink(SHM_NAME); - - if(stat_buf.st_uid == old_uid && stat_buf.st_gid == old_gid) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - if(stat_buf.st_uid != old_uid) - printf("The user ID has changed.\n"); - if(stat_buf.st_gid != old_gid) - printf("The group ID has changed.\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/27-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/27-1.c deleted file mode 100644 index 31a7d4a69f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/27-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the result of shm_open() when using O_TRUNC with O_RDONLY. - * It is undefined. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the result of shm_open() when using O_TRUNC with O_RDONLY.\nIt is undefined.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/28-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/28-1.c deleted file mode 100644 index 1f0bdfb1ed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/28-1.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the state of the shared memory object, including all data - * associated with the shared memory object, persists until the shared memory - * object is unlinked even if all other references are gone. - * - * Steps: - * 1. Create a shared memory object, map it and write a string in it. - * 2. Unmap the memory and close the file descriptor. - * 3. Reopen the shared memory object and remap it. - * 4. Check that the previously written string is always in the memory. - */ - - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "posixtest_28-1" - -int main() { - int fd; - char str[BUF_SIZE] = "qwerty"; - char *buf; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - buf = mmap(NULL, BUF_SIZE, PROT_WRITE, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - strcpy(buf, str); - - if(munmap(buf, BUF_SIZE) != 0) { - perror("An error occurs when calling munmap()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(close(fd) != 0) { - perror("An error occurs when calling close()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - /* Now, there are no more reference on SHM_NAME but it is not unlink */ - - fd = shm_open(SHM_NAME, O_RDONLY, S_IRUSR|S_IWUSR); - if(fd == -1 && errno == ENOENT) { - printf("The name of the shared memory object was removed.\n"); - return PTS_FAIL; - } else if(fd == -1) { - perror("An error occurs when calling shm_open()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - buf = mmap(NULL, BUF_SIZE, PROT_READ, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(strcmp(buf, str) == 0) { - printf("Test PASSED\n"); - shm_unlink(SHM_NAME); - return PTS_PASS; - } - printf("The content of the shared memory object was removed.\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/28-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/28-2.c deleted file mode 100644 index 434030a425..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/28-2.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the state of the shared memory object, including all data - * associated with the shared memory object, persists until all mapping - * references are gone even if the shared memory object is unlinked and there - * is no open reference anymore. - * - * Steps: - * 1. Create a shared memory object, map it and write a string in it. - * 2. Close the file descriptor and unlink the object. - * 3. Check that the previously written string is always in the mapped memory. - */ - - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "posixtest_28-2" - -int main() { - int fd; - char str[BUF_SIZE] = "qwerty"; - char *buf; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - buf = mmap(NULL, BUF_SIZE, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - strcpy(buf, str); - - if(close(fd) != 0) { - perror("An error occurs when calling close()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(shm_unlink(SHM_NAME) !=0) { - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - /* Now, SHM_NAME is unlinked and there are no more open references on - it but a mapping reference remain */ - - if(strcmp(buf, str) == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("The content of the shared memory object was removed.\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/28-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/28-3.c deleted file mode 100644 index fa9a5d113d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/28-3.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the state of the shared memory object, including all data - * associated with the shared memory object, persists until all open references - * are gone even if the shared memory object is unlinked and there - * is no mapping reference anymore. - * - * Steps: - * 1. Create a shared memory object, map it and write a string in it. - * 2. Unmap the memory and unlink the shared memory object. - * 3. Remap the shared memory object. - * 4. Check that the previously written string is always in the memory. - */ - - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "posixtest_28-3" - -int main() { - int fd; - char str[BUF_SIZE] = "qwerty"; - char *buf; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - buf = mmap(NULL, BUF_SIZE, PROT_WRITE, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - strcpy(buf, str); - - if(munmap(buf, BUF_SIZE) != 0) { - perror("An error occurs when calling munmap()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(shm_unlink(SHM_NAME) !=0) { - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - /* Now, SHM_NAME is unlinked and there are no more mapping references - on it but an open reference remain */ - - buf = mmap(NULL, BUF_SIZE, PROT_READ, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED && errno == EBADF) { - printf("The shared memory object was removed.\n"); - return PTS_FAIL; - } else if(buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - return PTS_UNRESOLVED; - } - - if(strcmp(buf, str) == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("The content of the shared memory object was removed.\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/29-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/29-1.c deleted file mode 100644 index ca49dc7ee4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/29-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test whether the name and shared memory object state remain valid - * after a system reboot. It is unspecified. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test whether the name and shared memory object state remain valid\nafter a system reboot. It is unspecified.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/3-1.c deleted file mode 100644 index 4bcdfbdbb2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/3-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test whether the name appears in the file system and is visible to - * other functions that take pathnames as arguments because it is unspecified. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test whether the name appears in the file system and is visible to\nother functions that take pathnames as arguments because it is unspecified.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/30-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/30-1.sh deleted file mode 100755 index 90129ac6ee..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/30-1.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Test that shm_open() returns a non-negative integer representing the -# lowest numbered unused file descriptor upon successful completion. -# -# This is tested implicitly via assertion 8. - -echo "Tested implicitly via assertion 8." -exit 0 - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/31-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/31-1.sh deleted file mode 100755 index c07b936d60..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/31-1.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -# -# Test that shm_open() return -1 upon unsuccessful completion. -# -# This is tested implicitly via assertions 32 to 42. - -echo "Tested implicitly via assertions 32 to 42." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/32-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/32-1.c deleted file mode 100644 index 93667305de..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/32-1.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_open() function sets errno = EACCES if the shared memory - * object exists and the permissions specified by oflag are denied - * - * Create a shared memory object with no read or write permission and try to - * open it. - */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_32-1" - -/** Set the euid of this process to a non-root uid */ -int set_nonroot() -{ - struct passwd *pw; - setpwent(); - /* search for the first user which is non root */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root")) - break; - endpwent(); - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return 1; - } - - if(seteuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\n"); - return 1; - } - perror("An error occurs when calling seteuid()"); - return 1; - } - - printf("Testing with user '%s' (uid: %d)\n", - pw->pw_name, (int)geteuid()); - return 0; -} - -int main() { - int fd; - - /* This test should be run under standard user permissions */ - if (getuid() == 0) { - if (set_nonroot() != 0) { - printf("Cannot run this test as non-root user\n"); - return PTS_UNTESTED; - } - } - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, 0); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDWR, 0); - - if(fd == -1 && errno == EACCES) { - printf("Test PASSED\n"); - shm_unlink(SHM_NAME); - return PTS_PASS; - } else if(fd != -1) { - printf("shm_open success.\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; - } - - perror("shm_open"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/34-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/34-1.c deleted file mode 100644 index 40fc686531..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/34-1.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_open() function sets errno = EACCES if O_TRUNC is - * specified and write permission is denied - */ - -/* FIXME : ambiguite de la spec */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_34-1" - -/** Set the euid of this process to a non-root uid */ -int set_nonroot() -{ - struct passwd *pw; - setpwent(); - /* search for the first user which is non root */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root")) - break; - endpwent(); - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return 1; - } - - if(seteuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\n"); - return 1; - } - perror("An error occurs when calling seteuid()"); - return 1; - } - - printf("Testing with user '%s' (uid: %d)\n", - pw->pw_name, (int)geteuid()); - return 0; -} - -int main() { - int fd; - - /* This test should be run under standard user permissions */ - if (getuid() == 0) { - if (set_nonroot() != 0) { - printf("Cannot run this test as non-root user\n"); - return PTS_UNTESTED; - } - } - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDWR | O_TRUNC, 0); - - if(fd == -1 && errno == EACCES) { - printf("Test PASSED\n"); - shm_unlink(SHM_NAME); - return PTS_PASS; - } else if(fd != -1) { - printf("shm_open success.\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; - } - - perror("shm_open"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/35-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/35-1.sh deleted file mode 100755 index f711d95104..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/35-1.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -# -# Test that the shm_open() function sets errno = EEXIST if O_CREAT and O_EXCL -# are set and the named shared memory object already exists. -# -# This is tested implicitly via assertion 22. - -echo "Tested implicitly via assertion 22." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/36-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/36-1.c deleted file mode 100644 index 42f73d6b07..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/36-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_open() function sets errno = EINTR if the operation was - * interrupted by a signal. - * - * This is very difficult to test for a non blocking function. - */ - -#include -#include "posixtest.h" - -int main(){ - printf("It is very difficult to test that the shm_open() function sets errno = EINTR\nwhen it is interrupted by a signal.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/37-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/37-1.c deleted file mode 100644 index dff820d11f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/37-1.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_open() function sets errno = EINVAL if the shm_open() - * operation is not supported for the given name. - * - * The supported names are implementation-defined, so the test is done for - * several differents names. The test pass for a given name if shm_open make no - * error or set errno to EINVAL. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -char *shm_name[] = { - /* char which are in portable character set but not in portable - filename character set */ - "$#\n@\t\a,~}", - /* char which are not in portable character set (accentuated char and c - cedilla) */ - "éêîôçà", - /* some file or directory which should exist */ - "..", - "/", - "//", - "/abc", - NULL}; - -int main() { - int fd, i=0, result = PTS_PASS; - - while(shm_name[i]) { - fflush(stderr); - printf("Name: '%s'\n", shm_name[i]); - fflush(stdout); - - fd = shm_open(shm_name[i], O_RDWR | O_CREAT, 0); - - if(fd == -1 && errno == EINVAL) { - printf(" OK: errno == EINVAL\n"); - } else if(fd != -1) { - printf(" OK: open with success.\n"); - } else { - perror(" Unexpected error"); - result = PTS_FAIL; - } - - shm_unlink(shm_name[i]); - - i++; - } - - if(result == PTS_PASS) - printf("Test PASSED\n"); - else - printf("Test FAILED\n"); - return result; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/38-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/38-1.c deleted file mode 100644 index 233a5a92b6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/38-1.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_open() function sets errno = EMFILE if too many file - * descriptors are currently in use by this process. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_38-1" - -int main() { - int fd = 0, count = 0; - - while(fd != -1) { - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - count++; - } - if(errno == EMFILE) { - shm_unlink(SHM_NAME); - printf("Test PASSED: %i files open.\n", count); - return PTS_PASS; - } - perror("shm_open"); - shm_unlink(SHM_NAME); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/39-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/39-1.c deleted file mode 100644 index 4f2d787a08..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/39-1.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_open() function sets errno = ENAMETOOLONG if the length - * of a pathname component is longer than {NAME_MAX} (not including the - * terminating null). - */ - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() { - int fd, i; - long name_max; - char *shm_name; - - name_max = pathconf("/", _PC_NAME_MAX); - if(name_max == -1) { - perror("An error occurs when calling pathconf()"); - return PTS_UNRESOLVED; - } - shm_name = malloc(name_max+3); - - shm_name[0] = '/'; - for(i=1; i -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -/* Ensure that each component length is short enough */ -#define COMPONENT_SIZE _POSIX_NAME_MAX - -int main() { - int fd, i, path_max; - char *shm_name; - - path_max = pathconf("/", _PC_PATH_MAX); - if(path_max == -1) { - perror("An error occurs when calling pathconf()"); - return PTS_UNRESOLVED; - } - shm_name = malloc(path_max+1); - - for(i=0; i -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_41-1" - -int main() { - int fd, result; - - result = shm_unlink(SHM_NAME); - if(result != 0 && errno != ENOENT) { - /* The shared memory object exist and shm_unlink can not - remove it. */ - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDONLY, S_IRUSR); - - if(fd == -1 && errno == ENOENT) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if(fd != -1) { - printf("shm_open() success.\n"); - return PTS_FAIL; - } - - perror("Unexpected error"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/42-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/42-1.c deleted file mode 100644 index 0362bdf1d5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/42-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_open() function sets errno = ENOSPC if there is - * insufficient space for the creation of the new shared memory object. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that the shm_open() function sets errno to ENOSPC if there is\ninsufficient space for the creation of the new shared memory object.\n"); - return PTS_UNTESTED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/5-1.c deleted file mode 100644 index 88235a3e69..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/5-1.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that when name begins with the slash character, then processes calling - * shm_open() with the same value of name refer to the same shared memory - * object, as long as that name has not been removed. - * - * Steps: - * 1. Create a child process. - * (The child process) - * 2. Open a shared memory file O_RDWR with a name beginning with slash. - * 3. Write a string in the file. - * (The father) - * 2. Open a shared memory file O_RDONLY with the same name. - * 3. Read into the file. - * 4. Check that it obtain the right string. - */ - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "/posixtest_5-1" - -char str[BUF_SIZE] = "qwerty"; - -int child_process() { - int fd; - char *buf; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - kill(getppid(), SIGUSR1); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - kill(getppid(), SIGUSR1); - return PTS_UNRESOLVED; - } - - buf = mmap(NULL, BUF_SIZE, PROT_WRITE, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - kill(getppid(), SIGUSR1); - return PTS_UNRESOLVED; - } - - strcpy(buf, str); - - return PTS_PASS; -} - - -int main() { - int fd, child_pid; - char *buf; - - child_pid = fork(); - if(child_pid == -1) { - perror("An error occurs when calling fork()"); - return PTS_UNRESOLVED; - } else if(child_pid == 0) { - return child_process(); - } - - wait(NULL); - - fd = shm_open(SHM_NAME, O_RDONLY, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - buf = mmap(NULL, BUF_SIZE, PROT_READ, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - return PTS_UNRESOLVED; - } - - shm_unlink(SHM_NAME); - - if(strcmp(buf, str) == 0) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/6-1.c deleted file mode 100644 index f19a4a1249..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/6-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the effec of a name which does not begin with the slash - * character because it is implementation-defined. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the effect of a name which does not begin with the slash\ncharacter because it is implementation-defined.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/7-1.c deleted file mode 100644 index 7748cc828f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/7-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test the interpretation of slash characters other than the leading - * slash character in name because it is implementation-defined. - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test the interpretation of slash characters other than the leading\nslash character in name because it is implementation-defined.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/8-1.c deleted file mode 100644 index b25e5d540a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/8-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that shm_open() return a file descriptor for the shared memory object - * that is the lowest numbered file descriptor not currently open for that - * process - * - * Steps: - * 1. Open a temporary file. - * 2. Open a shared memory object. - * 3. Check that the file descriptor number of the shared memory object - * follows the one of the temporary file. - * It assume that no file descriptor are closed before getting the two file - * descriptors. - */ - -/* mkstemp is an XOPEN extension. */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_8-1" - -int main() { - int fd1, fd2; - char path[25] = "/tmp/posixtestXXXXXX"; - - fd1 = mkstemp(path); - if(fd1 == -1) { - perror("An error occurs when calling mkstemp()"); - return PTS_UNRESOLVED; - } - - fd2 = shm_open(SHM_NAME, O_RDWR | O_CREAT, S_IRUSR|S_IWUSR); - if(fd2 == -1) { - perror("An error occurs when calling shm_open()"); - unlink(path); - return PTS_UNRESOLVED; - } - - unlink(path); - shm_unlink(SHM_NAME); - - if(fd2 == (fd1+1)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/9-1.c deleted file mode 100644 index 9b28fbaddf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/9-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Will not test that the open file description is new (and therefore the file - * descriptor does not share it with any other processes). - */ - -#include -#include "posixtest.h" - -int main() -{ - printf("Will not test that the open file description is new.\n"); - return PTS_UNTESTED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/assertions.xml deleted file mode 100644 index 4185bbfd93..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/assertions.xml +++ /dev/null @@ -1,180 +0,0 @@ - - - The shm_open() function shall establish a connection between a shared memory - object and a file descriptor - - - The shm_open() function shall create an open file description that refers to - the shared memory object and a file descriptor that refers to that open file - description - - - It is unspecified whether the name appears in the file system and is visible - to other functions that take pathnames as arguments - - - The name argument conforms to the construction rules for a pathname. - - - If name begins with the slash character, then processes calling shm_open() - with the same value of name refer to the same shared memory object, as long - as that name has not been removed - - - If name does not begin with the slash character, the effect is - implementation-defined - - - The interpretation of slash characters other than the leading slash - character in name is implementation-defined - - - If successful, shm_open() shall return a file descriptor for the shared - memory object that is the lowest numbered file descriptor not currently open - for that process - - - The open file description is new, and therefore the file descriptor does not - share it with any other processes - - - It is unspecified whether the file offset is set. - - - The FD_CLOEXEC file descriptor flag associated with the new file descriptor - is set - - - Applications specify exactly one of the first two values (access modes) - below in the value of oflag: - O_RDONLY - O_RDWR - - - When the applications specify the value of O_RDONLY, the file is open for - read acces only - - - When the applications specify the value of O_RDWR, the file is open for both - read and write acces - - - If the shared memory object does not exists and the O_CREAT flags is set, - the shared memory object is created - - - If the shared memory object does not exists and the O_CREAT flags is set, - the user ID of the shared memory object shall be set to the effective user - ID of the process - - - If the shared memory object does not exists and the O_CREAT flags is set, - the group ID of the shared memory object is set to a system default group ID - or to the effective group ID of the process - - - If the shared memory object does not exists and the O_CREAT flags is set, - the permission bits of the shared memory object shall be set to the value of - the mode argument except those set in the file mode creation mask of the - process - - - If the shared memory object does not exists, the O_CREAT flags is set, and - bits in mode other than the file permission bits are set, the effect is - unspecified - - - If the shared memory object does not exists and the O_CREAT flags is set, - the mode argument does not affect whether the shared memory object is opened - for reading, for writing, or for both - - - When created, the shared memory object has a size of zero. - - - If O_EXCL and O_CREAT are set, shm_open() fails if the shared memory object - exist - - - The check for the existence of the shared memory object and the creation of - the object if it does not exist is atomic with respect to other processes - executing shm_open() naming the same shared memory object with O_EXCL and - O_CREAT set - - - If O_EXCL is set and O_CREAT is not set, the result is undefined - - - If O_TRUNC is set, the shared memory object exists and it is successfully - opened O_RDWR, the object shall be truncated to zero length - - - If O_TRUNC is set, the shared memory object exists and it is successfully - opened O_RDWR, the mode and owner shall be unchanged by this function call - - - The result of using O_TRUNC with O_RDONLY is undefined - - - When a shared memory object is created, the state of the shared memory - object, including all data associated with the shared memory object, - persists until the shared memory object is unlinked and all other references - are gone - - - It is unspecified whether the name and shared memory object state remain - valid after a system reboot - - - Upon successful completion, the shm_open() function shall return a - non-negative integer representing the lowest numbered unused file descriptor - - - Upon unsuccessful completion, the shm_open() function shall return -1 - - - The shm_open() function sets errno = EACCES if the shared memory object - exists and the permissions specified by oflag are denied - - - The shm_open() function sets errno = EACCES if the shared memory object does - not exist and permission to create the shared memory object is denied - - - The shm_open() function sets errno = EACCES if O_TRUNC is specified and - write permission is denied - - - The shm_open() function sets errno = EEXIST if O_CREAT and O_EXCL are set - and the named shared memory object already exists - - - The shm_open() function sets errno = EINTR if the shm_open() operation was - interrupted by a signal - - - The shm_open() function sets errno = EINVAL if the shm_open() operation is - not supported for the given name - - - The shm_open() function sets errno = EMFILE if too many file descriptors are - currently in use by this process - - - The shm_open() function sets errno = ENAMETOOLONG if the length of the name - argument exceeds {PATH_MAX} or a pathname component is longer than - {NAME_MAX} - - - The shm_open() function sets errno = ENFILE if too many shared memory - objects are currently open in the system - - - The shm_open() function sets errno = ENOENT if O_CREAT is not set and the - named shared memory object does not exist - - - The shm_open() function sets errno = ENOSPC if there is insufficient space - for the creation of the new shared memory object - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/coverage.txt deleted file mode 100644 index 7fe143c4b6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_open/coverage.txt +++ /dev/null @@ -1,51 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES Implementation of file description not specified. -3 YES Unspecified. -4 YES -5 YES -6 YES Implementation defined. -7 YES Implementation defined. -8 YES -9 YES Implementation of file description not specified. -10 YES Unspecified. -11 YES -12 YES No error specified. -13 YES -14 YES -15 YES -16 YES -17 YES -18 YES -19 YES Unspecified. -20 YES -21 YES -22 YES -23 YES The test never pass. For a conforming - implementation, the test is unresolved. -24 YES Undefined. -25 YES -26 YES -27 YES Undefined. -28 YES -29 YES Unspecified, need to reboot. -30 YES -31 YES -32 YES -33 NO Not easy to test. It is somewhat implementation -specific. -34 YES -35 YES -36 YES -37 YES -38 YES -39 YES -40 NO Cannot find a proper way to test. -41 YES -42 YES - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/1-1.c deleted file mode 100644 index 36b160cc3f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/1-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_unlink() function remove the name of the shared memory - * object named by the string pointed to by name. - */ - - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_1-1" - -int main() { - int fd; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(close(fd) != 0) { - perror("An error occurs when calling close()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(shm_unlink(SHM_NAME) != 0 ) { - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDONLY, 0); - - if(fd == -1 && errno == ENOENT) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if (fd == -1) { - perror("shm_open"); - return PTS_UNRESOLVED; - } - - printf("The name of shared memory object was not removed.\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/10-1.c deleted file mode 100644 index b5f8a1fefd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/10-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_unlink() function sets errno = ENAMETOOLONG if the length - * of a pathname component is longer than {NAME_MAX} (not including the - * terminating null). - */ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -int main() { - int result, i; - long name_max; - char *shm_name; - - name_max = pathconf("/", _PC_NAME_MAX); - shm_name = malloc(name_max+3); - - shm_name[0] = '/'; - for(i=1; i -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -/* Ensure that each component length is short enough */ -#define COMPONENT_SIZE _POSIX_NAME_MAX - -int main() { - int result, i, path_max; - char *shm_name; - - path_max = pathconf("/", _PC_PATH_MAX); - if(path_max == -1) { - perror("An error occurs when calling pathconf()"); - return PTS_UNRESOLVED; - } - shm_name = malloc(path_max+1); - - for(i=0; i -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_11-1" - -int main() { - int result; - - /* Ensure that the name SHM_NAME is removed */ - shm_unlink(SHM_NAME); - - result = shm_unlink(SHM_NAME); - - if(result == -1 && errno == ENOENT) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if (result == -1) { - perror("Unexpected error"); - return PTS_UNRESOLVED; - } - - printf("shm_unlink() success."); - return PTS_FAIL; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/2-1.c deleted file mode 100644 index 3d83b85a8a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/2-1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the name is removed before shm_unlink() returns even if one or - * more references to the shared memory object exist when the object is - * unlinked. - */ - - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_2-1" - -int main() { - int fd; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(shm_unlink(SHM_NAME) != 0 ) { - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDONLY, 0); - - if(fd == -1 && errno == ENOENT) { - printf("Test PASSED\n"); - return PTS_PASS; - } else if (fd == -1) { - perror("shm_open"); - return PTS_UNRESOLVED; - } - - printf("The name of shared memory object was not removed.\n"); - shm_unlink(SHM_NAME); - return PTS_FAIL; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/3-1.c deleted file mode 100644 index 4c40965b07..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/3-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the removal of the memory object contents is postponed until all - * open and map references to the shared memory object have been removed. - */ - - -/* ftruncate was formerly an XOPEN extension. We define _XOPEN_SOURCE here to - avoid warning if the implementation does not program ftruncate as a base - interface */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define BUF_SIZE 8 -#define SHM_NAME "posixtest_3-1" - -int main() { - int fd; - char *buf; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(shm_unlink(SHM_NAME) != 0) { - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - /* Now, SHM_NAME is unlinked but there are open references on it */ - - buf = mmap(NULL, BUF_SIZE, PROT_READ, MAP_SHARED, fd, 0); - if( buf == MAP_FAILED && errno == EBADF) { - printf("The shared memory object was removed.\n"); - return PTS_FAIL; - } else if(buf == MAP_FAILED) { - perror("An error occurs when calling mmap()"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/4-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/4-1.sh deleted file mode 100755 index efa019ddfd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/4-1.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Test that the reuse of the name subsequently causes shm_open() to fail -# if O_CREAT is not set even if the object continues to exist after the last -# shm_unlink() -# -# This is tested implicitly via assertions 1 and 2. - -echo "Tested implicitly via assertions 1 and 2." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/5-1.c deleted file mode 100644 index f98fe9dea5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/5-1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the reuse of the name subsequently causes shm_open() to - * create a new shared memory object if O_CREAT is set even if the object - * continues to exist after the last shm_unlink(), - */ - - -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_5-1" - - -int main() { - int fd; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(shm_unlink(SHM_NAME) != 0 ) { - perror("An error occurs when calling shm_unlink()"); - return PTS_UNRESOLVED; - } - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if (fd == -1 && errno == EEXIST) { - printf("shm_open() can not create a new object.\n"); - return PTS_FAIL; - } else if(fd == -1) { - perror("shm_open"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - shm_unlink(SHM_NAME); - return PTS_PASS; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/6-1.c deleted file mode 100644 index a0d66da788..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/6-1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the shm_unlink() function returns zero upon successful completion. - */ - - -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_6-1" - -int main() { - int fd; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(shm_unlink(SHM_NAME) == 0 ) { - printf("Test PASSED\n"); - return PTS_PASS; - } else { - perror("shm_unlink() does not return zero"); - return PTS_FAIL; - } - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/7-1.sh b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/7-1.sh deleted file mode 100755 index 04538f1bea..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/7-1.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -# -# Test that the shm_unlink() function return -1 upon unsuccessful completion. -# -# This is tested implicitly via assertions 9 to 11. - -echo "Tested implicitly via assertions 9 to 11." -exit 0 diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/8-1.c deleted file mode 100644 index 77286c4d3e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/8-1.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that the named shared memory object is not changed by this function - * call when the process does not have permission to unlink the name. - * - * Steps: - * 1. Create a shared memory object. - * 2. Set his effective user id to an other user id which is not root. - * 3. Try to unlink the name. - * If it fail: set the effective user id to real user id and unlink. - * In most case this test will be unresolved if not run by root. - */ - -/* getpwent() is part of XSI option */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_9-1" -#define BUF_SIZE 8 - - -int main() { - int fd, result; - struct passwd *pw; - struct stat stat_before, stat_after; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - if(ftruncate(fd, BUF_SIZE) != 0) { - perror("An error occurs when calling ftruncate()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(fstat(fd, &stat_before) != 0) { - perror("An error occurs when calling fstat()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - /* search for the first user which is non root and which is not the - current user */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root") && pw->pw_uid != getuid()) - break; - - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return PTS_UNRESOLVED; - } - - if(seteuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\nTry to rerun this test as root.\n"); - return PTS_UNRESOLVED; - } - perror("An error occurs when calling seteuid()"); - return PTS_UNRESOLVED; - } - - printf("Testing with user '%s' (uid: %i)\n", - pw->pw_name, pw->pw_uid); - - result = shm_unlink(SHM_NAME); - if(result == 0) { - printf("shm_unlink() success.\n"); - return PTS_UNRESOLVED; - } - - seteuid(getuid()); - - if(fstat(fd, &stat_after) != 0) { - perror("An error occurs when calling fstat()"); - shm_unlink(SHM_NAME); - return PTS_UNRESOLVED; - } - - if(stat_after.st_uid != stat_before.st_uid || - stat_after.st_gid != stat_before.st_gid || - stat_after.st_size != stat_before.st_size || - stat_after.st_mode != stat_before.st_mode) { - printf("The shared memory object has changed.\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/9-1.c deleted file mode 100644 index 6c8bd6d792..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/9-1.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Test that shm_unlink() sets errno = EACCES if permission is denied to unlink - * the named shared memory object. - * - * Steps: - * 1. Create a shared memory object. - * 2. Set his effective user id to an other user id which is not root. - * 3. Try to unlink the name. - * If it fail: set the effective user id to real user id and unlink. - * In most case this test will be unresolved if not run by root. - */ - -/* getpwent() is part of XSI option */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define SHM_NAME "posixtest_9-1" - - -int main() { - int fd, result; - struct passwd *pw; - - fd = shm_open(SHM_NAME, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if(fd == -1) { - perror("An error occurs when calling shm_open()"); - return PTS_UNRESOLVED; - } - - /* search for the first user which is non root and which is not the - current user */ - while((pw = getpwent()) != NULL) - if(strcmp(pw->pw_name, "root") && pw->pw_uid != getuid()) - break; - - if(pw == NULL) { - printf("There is no other user than current and root.\n"); - return PTS_UNRESOLVED; - } - - if(seteuid(pw->pw_uid) != 0) { - if(errno == EPERM) { - printf("You don't have permission to change your UID.\nTry to rerun this test as root.\n"); - return PTS_UNRESOLVED; - } - perror("An error occurs when calling seteuid()"); - return PTS_UNRESOLVED; - } - - printf("Testing with user '%s' (uid: %i)\n", - pw->pw_name, pw->pw_uid); - - result = shm_unlink(SHM_NAME); - if(result == -1&& errno == EACCES) { - printf("Test PASSED\n"); - seteuid(getuid()); - shm_unlink(SHM_NAME); - return PTS_PASS; - } else if(result == -1) { - perror("Unexpected error"); - seteuid(getuid()); - shm_unlink(SHM_NAME); - return PTS_FAIL; - } - - printf("shm_unlink() success.\n"); - return PTS_UNRESOLVED; - -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/assertions.xml deleted file mode 100644 index 41adaf8043..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/assertions.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - The shm_unlink() function shall remove the name of the shared memory object - named by the string pointed to by name - - - If one or more references to the shared memory object exist when the object - is unlinked, the name shall be removed before shm_unlink() returns - - - If one or more references to the shared memory object exist when the object - is unlinked, the removal of the memory object contents shall be postponed - until all open and map references to the shared memory object have been - removed - - - Even if the object continues to exist after the last shm_unlink(), reuse of - the name shall subsequently cause shm_open() to fail if O_CREAT is not set - - - Even if the object continues to exist after the last shm_unlink(), reuse of - the name shall subsequently cause shm_open() to create a new shared memory - object if O_CREAT is set - - - Upon successful completion, the shm_unlink() function shall return zero - - - Upon unsuccessful completion, the shm_unlink() function shall return -1 - - - If -1 is returned, the named shared memory object shall not be changed by - this function call - - - The shm_unlink() function sets errno = EACCES if permission is denied to - unlink the named shared memory object - - - The shm_unlink() function sets errno = ENAMETOOLONG if the length of the - name argument exceeds PATH_MAX or a pathname component is longer than - NAME_MAX - - - The shm_unlink() function sets errno = ENOENT if the named shared memory - object does not exist - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/coverage.txt deleted file mode 100644 index c404ad6da2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/shm_unlink/coverage.txt +++ /dev/null @@ -1,17 +0,0 @@ -This document explains why certain assertions were not tested. - -Assertions not listed here should be covered by the tests in this directory. - - -Assertions Tested ? Remarks -1 YES -2 YES -3 YES -4 YES -5 YES -6 YES -7 YES -8 YES -9 YES -10 YES -11 YES diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-1.c deleted file mode 100644 index 972ea7d20c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGABRT - 3. Raise SIGABRT. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-10.c deleted file mode 100644 index a359ac301b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-10.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGPIPE - 3. Raise SIGPIPE. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPIPE) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-11.c deleted file mode 100644 index e64e77801e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-11.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGQUIT - 3. Raise SIGQUIT. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGQUIT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-12.c deleted file mode 100644 index 99e6e47221..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-12.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGSEGV - 3. Raise SIGSEGV. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSEGV) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-13.c deleted file mode 100644 index 33b76ce01a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-13.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGTERM - 3. Raise SIGTERM. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTERM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-14.c deleted file mode 100644 index ae4beb083a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-14.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGTSTP - 3. Raise SIGTSTP. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTSTP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-15.c deleted file mode 100644 index c02d3ffc8b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-15.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGTTIN - 3. Raise SIGTTIN. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTIN) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-16.c deleted file mode 100644 index de9de580c4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-16.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGTTOU - 3. Raise SIGTTOU. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTOU) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-17.c deleted file mode 100644 index 08283c432c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-17.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGUSR1 - 3. Raise SIGUSR1. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR1) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-18.c deleted file mode 100644 index 1bebb9114e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-18.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGUSR2 - 3. Raise SIGUSR2. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR2) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-19.c deleted file mode 100644 index dee3d43a62..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-19.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGPOLL - 3. Raise SIGPOLL. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPOLL) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-2.c deleted file mode 100644 index 38ffbf1d0a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-2.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGALRM - 3. Raise SIGALRM. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-20.c deleted file mode 100644 index 2c0a1f5776..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-20.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGPROF - 3. Raise SIGPROF. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPROF) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-21.c deleted file mode 100644 index 79296a53ef..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-21.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGSYS - 3. Raise SIGSYS. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSYS) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-22.c deleted file mode 100644 index 9d5f4422f5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-22.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGTRAP - 3. Raise SIGTRAP. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTRAP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-23.c deleted file mode 100644 index d129105039..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-23.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGURG - 3. Raise SIGURG. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGURG) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-24.c deleted file mode 100644 index 62b50e8e74..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-24.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGVTALRM - 3. Raise SIGVTALRM. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGVTALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-25.c deleted file mode 100644 index 20105f4a5d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-25.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGXCPU - 3. Raise SIGXCPU. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXCPU) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-26.c deleted file mode 100644 index e440df7207..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-26.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGXFSZ - 3. Raise SIGXFSZ. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXFSZ) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-3.c deleted file mode 100644 index 63ec017e36..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-3.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGBUS - 3. Raise SIGBUS. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGBUS) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-4.c deleted file mode 100644 index dab1885f87..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-4.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGCHLD - 3. Raise SIGCHLD. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCHLD) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-5.c deleted file mode 100644 index 0abc859279..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-5.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGCONT - 3. Raise SIGCONT. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCONT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-6.c deleted file mode 100644 index 02b65e3169..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-6.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGFPE - 3. Raise SIGFPE. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGFPE) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-7.c deleted file mode 100644 index 746747c7e3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-7.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGHUP - 3. Raise SIGHUP. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGHUP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-8.c deleted file mode 100644 index 21e7871bd7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-8.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGILL - 3. Raise SIGILL. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGILL) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-9.c deleted file mode 100644 index f31e4f991f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/1-9.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #1 of the sigaction system call that shows - sigaction (when used with a non-null act pointer) changes the action - for a signal. - - Steps: - 1. Initialize a global variable to indicate the signal - handler has not been called. (A signal handler of the - prototype "void func(int signo);" will set the global - variable to indicate otherwise. - 2. Use sigaction to setup a signal handler for SIGINT - 3. Raise SIGINT. - 4. Verify the global indicates the signal was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGINT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/10-1.c deleted file mode 100644 index a29596fdb6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/10-1.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - Test assertion #10 by verifying that SIGCHLD signals are sent to a parent - when their children are stopped. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. - * -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define NUMSTOPS 10 - -int child_stopped = 0; -int waiting = 1; - -void handler(int signo, siginfo_t *info, void *context) -{ - if (info && info->si_code == CLD_STOPPED) { - printf("Child has been stopped\n"); - waiting = 0; - child_stopped++; - } -} - - -int main() -{ - pid_t pid; - struct sigaction act; - struct timeval tv; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaction(SIGCHLD, &act, 0); - - if ((pid = fork()) == 0) { - /* child */ - while(1) { - /* wait forever, or until we are - interrupted by a signal */ - tv.tv_sec = 0; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - } - return 0; - } else { - /* parent */ - int s; - int i; - - for (i = 0; i < NUMSTOPS; i++) { - waiting = 1; - - printf("--> Sending SIGSTOP\n"); - kill(pid, SIGSTOP); - - /* - Don't let the kernel optimize away queued - SIGSTOP/SIGCONT signals. - */ - while (waiting) { - tv.tv_sec = 1; - tv.tv_usec = 0; - if (!select(0, NULL, NULL, NULL, &tv)) - break; - } - - - printf("--> Sending SIGCONT\n"); - kill(pid, SIGCONT); - } - - /* POSIX specifies default action to be abnormal termination */ - kill(pid, SIGHUP); - waitpid(pid, &s, 0); - } - - if (child_stopped == NUMSTOPS) { - printf("Test PASSED\n"); - return 0; - } - - printf("Test FAILED\n"); - return -1; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/11-1.c deleted file mode 100644 index 1e47b041f5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/11-1.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #11 by verifying that SIGCHLD signals are sent to a parent - when their children are continued after being stopped. - - NOTE: This is only required to work if the XSI options are implemented. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. - * -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -#define NUMSTOPS 2 - -int child_continued = 0; -int waiting = 1; - -void handler(int signo, siginfo_t *info, void *context) -{ - if (info && info->si_code == CLD_CONTINUED) { - printf("Child has been stopped\n"); - waiting = 0; - child_continued++; - } -} - - -int main() -{ - pid_t pid; - struct sigaction act; - struct timeval tv; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaction(SIGCHLD, &act, 0); - - if ((pid = fork()) == 0) { - /* child */ - while(1) { - /* wait forever, or until we are - interrupted by a signal */ - tv.tv_sec = 0; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - } - return 0; - } else { - /* parent */ - int s; - int i; - - /* delay to allow child to get into select call */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - for (i = 0; i < NUMSTOPS; i++) { - struct timeval tv; - printf("--> Sending SIGSTOP\n"); - kill(pid, SIGSTOP); - - /* - Don't let the kernel optimize away queued - SIGSTOP/SIGCONT signals. - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - printf("--> Sending SIGCONT\n"); - waiting = 1; - kill(pid, SIGCONT); - while (waiting) { - tv.tv_sec = 1; - tv.tv_usec = 0; - if (!select(0, NULL, NULL, NULL, &tv)) - break; - } - - } - - /* POSIX specifies default action to be abnormal termination */ - kill(pid, SIGHUP); - waitpid(pid, &s, 0); - } - - if (child_continued == NUMSTOPS) { - printf("Test PASSED\n"); - printf("In the section of the POSIX spec that describes the SA_NOCLDSTOP flag in the sigaction() interface " - "it is specified that if the SA_NOCLDSTOP flag is not set in sa_flags, then a SIGCHLD and a SIGCHLD " - "signal **MAY** be generated for the calling process whenever any of its stopped child processes are continued. " - "Because of that, this test will PASS either way, but note that the signals implementation you are currently " - "run this test on DOES choose to send a SIGCHLD signal whenever any of its stopped child processes are " - "continued. Again, this is not a bug because of the existence of the word *MAY* in the spec.\n"); - return PTS_PASS; - } - - printf("Test PASSED\n"); - - printf("In the section of the POSIX spec that describes the SA_NOCLDSTOP flag in the sigaction() interface " - "it is specified that if the SA_NOCLDSTOP flag is not set in sa_flags, then a SIGCHLD and a SIGCHLD " - "signal **MAY** be generated for the calling process whenever any of its stopped child processes are continued. " - "Because of that, this test will PASS either way, but note that the signals implementation you are currently " - "run this test on chooses NOT TO send a SIGCHLD signal whenever any of its stopped child processes are " - "continued. Again, this is not a bug because of the existence of the word *MAY* in the spec.\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-1.c deleted file mode 100644 index 1f9d582b25..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-1.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGABRT\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-10.c deleted file mode 100644 index d7b2afed6a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-10.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGPIPE\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPIPE) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-11.c deleted file mode 100644 index 6424f20472..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-11.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGQUIT\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGQUIT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-12.c deleted file mode 100644 index cb8d7d4924..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-12.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGSEGV\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSEGV) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-13.c deleted file mode 100644 index fc6bb3a398..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-13.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGTERM\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTERM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-14.c deleted file mode 100644 index d3faa89a52..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-14.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGTSTP\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTSTP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-15.c deleted file mode 100644 index c2f273c2c1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-15.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGTTIN\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTIN) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-16.c deleted file mode 100644 index db961e4bea..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-16.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGTTOU\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTOU) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-17.c deleted file mode 100644 index 60442b0614..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-17.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGUSR1\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR1) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-18.c deleted file mode 100644 index 17c8c97e90..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-18.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGUSR2\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR2) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-19.c deleted file mode 100644 index ed6d35b785..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-19.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGPOLL\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPOLL) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-2.c deleted file mode 100644 index fe5b214aab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-2.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGALRM\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-20.c deleted file mode 100644 index fc1db49355..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-20.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGPROF\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPROF) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-21.c deleted file mode 100644 index fc141c0af3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-21.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGSYS\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSYS) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-22.c deleted file mode 100644 index 739768754b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-22.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGTRAP\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTRAP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-23.c deleted file mode 100644 index 5eb6a7eb85..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-23.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGURG\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGURG) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-24.c deleted file mode 100644 index d94866ec20..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-24.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGVTALRM\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGVTALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-25.c deleted file mode 100644 index f5d176a4d0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-25.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGXCPU\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXCPU) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-26.c deleted file mode 100644 index 97c73205b9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-26.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGXFSZ\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXFSZ) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-27.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-27.c deleted file mode 100644 index a74335e1e7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-27.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGABRT\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-28.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-28.c deleted file mode 100644 index b1fac383c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-28.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGALRM\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-29.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-29.c deleted file mode 100644 index db460771f9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-29.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGBUS\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGBUS) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-3.c deleted file mode 100644 index 73ded97f27..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-3.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGBUS\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGBUS) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-30.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-30.c deleted file mode 100644 index fd88d46e0e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-30.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGCHLD\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCHLD) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-31.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-31.c deleted file mode 100644 index 6ed691b3a6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-31.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGCONT\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCONT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-32.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-32.c deleted file mode 100644 index 125dceef03..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-32.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGFPE\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGFPE) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-33.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-33.c deleted file mode 100644 index d6d55664c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-33.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGHUP\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGHUP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-34.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-34.c deleted file mode 100644 index 039c7276ab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-34.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGILL\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGILL) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-35.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-35.c deleted file mode 100644 index b3422a9280..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-35.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGINT\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGINT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-36.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-36.c deleted file mode 100644 index 3d0a4ca81c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-36.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGPIPE\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPIPE) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-37.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-37.c deleted file mode 100644 index 046aab387c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-37.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGQUIT\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGQUIT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-38.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-38.c deleted file mode 100644 index 83efe07053..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-38.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGSEGV\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSEGV) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-39.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-39.c deleted file mode 100644 index 969e85ade0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-39.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGTERM\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTERM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-4.c deleted file mode 100644 index 597db3148e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-4.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGCHLD\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCHLD) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-40.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-40.c deleted file mode 100644 index 76dee6be1c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-40.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGTSTP\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTSTP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-41.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-41.c deleted file mode 100644 index 1a2feeb416..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-41.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGTTIN\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTIN) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-42.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-42.c deleted file mode 100644 index 1c19f85dee..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-42.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGTTOU\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTOU) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-43.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-43.c deleted file mode 100644 index b1b6ca0167..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-43.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGUSR1\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR1) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-44.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-44.c deleted file mode 100644 index cf1a90353b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-44.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGUSR2\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR2) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-45.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-45.c deleted file mode 100644 index cd084130f4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-45.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGPOLL\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPOLL) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-46.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-46.c deleted file mode 100644 index 2bf3fcddae..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-46.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGPROF\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPROF) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-47.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-47.c deleted file mode 100644 index e76335cc74..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-47.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGSYS\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSYS) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-48.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-48.c deleted file mode 100644 index ec967dea77..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-48.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGTRAP\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTRAP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-49.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-49.c deleted file mode 100644 index 9ed30bcc1a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-49.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGURG\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGURG) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-5.c deleted file mode 100644 index 07284a1c1c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-5.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGCONT\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCONT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-50.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-50.c deleted file mode 100644 index 0c1bffa2c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-50.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGVTALRM\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGVTALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-51.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-51.c deleted file mode 100644 index 86d38720aa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-51.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGXCPU\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXCPU) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-52.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-52.c deleted file mode 100644 index b47dbadcd2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-52.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, but a new stack has not be set by sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGXFSZ\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXFSZ) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-6.c deleted file mode 100644 index 2b8e943727..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-6.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGFPE\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGFPE) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-7.c deleted file mode 100644 index 448933a558..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-7.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGHUP\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGHUP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-8.c deleted file mode 100644 index 87295a1555..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-8.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGILL\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGILL) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-9.c deleted file mode 100644 index edcad6e1f6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/12-9.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #12 of the sigaction system call that verifies - signal-catching functions are executed on the alternate stack if the - SA_ONSTACK flag is set in the sigaction.sa_flags parameter to the - sigaction function call, and an alternate stack has been setup with - sigaltstack(). - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t alt_ss; - -void handler(int signo) -{ - stack_t ss; - - printf("Caught SIGINT\n"); - - if (sigaltstack((stack_t *)0, &ss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (ss.ss_sp != alt_ss.ss_sp || ss.ss_size != alt_ss.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_ONSTACK; - sigemptyset(&act.sa_mask); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if ((alt_ss.ss_sp = (void *)malloc(SIGSTKSZ)) == NULL) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - alt_ss.ss_size = SIGSTKSZ; - alt_ss.ss_flags = 0; - - if (sigaltstack(&alt_ss, (stack_t *)0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGINT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-1.c deleted file mode 100644 index 9254a93f9b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGABRT\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-10.c deleted file mode 100644 index 9b4efc8729..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-10.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGPIPE\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPIPE) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-11.c deleted file mode 100644 index 4961213309..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-11.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGQUIT\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGQUIT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-12.c deleted file mode 100644 index bf2cc17238..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-12.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGSEGV\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSEGV) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-13.c deleted file mode 100644 index 5105077266..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-13.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGTERM\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTERM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-14.c deleted file mode 100644 index 60badbf019..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-14.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGTSTP\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTSTP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-15.c deleted file mode 100644 index 33c86d871d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-15.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGTTIN\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTIN) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-16.c deleted file mode 100644 index c297fa6b74..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-16.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGTTOU\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTOU) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-17.c deleted file mode 100644 index e1dcaaa420..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-17.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGUSR1\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR1) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-18.c deleted file mode 100644 index d5cca37fcf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-18.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGUSR2\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR2) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-19.c deleted file mode 100644 index ab6e253e06..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-19.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGPOLL\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPOLL) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-2.c deleted file mode 100644 index 92ba1c9522..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-2.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGALRM\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-20.c deleted file mode 100644 index 3cdb52932e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-20.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGPROF\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPROF) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-21.c deleted file mode 100644 index 20ecdb2512..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-21.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGSYS\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSYS) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-22.c deleted file mode 100644 index 33bd4b6695..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-22.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGTRAP\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTRAP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-23.c deleted file mode 100644 index 613dc3a70a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-23.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGURG\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGURG) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-24.c deleted file mode 100644 index 17ad5c556e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-24.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGVTALRM\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGVTALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-25.c deleted file mode 100644 index 32383d44ab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-25.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGXCPU\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXCPU) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-26.c deleted file mode 100644 index fb052536c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-26.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGXFSZ\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXFSZ) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-3.c deleted file mode 100644 index fe46f15231..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-3.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGBUS\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGBUS) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-4.c deleted file mode 100644 index 2d03f1c482..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-4.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGCHLD\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCHLD) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-5.c deleted file mode 100644 index 04af227539..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-5.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGCONT\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCONT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-6.c deleted file mode 100644 index 7559a92c5c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-6.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGFPE\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGFPE) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-7.c deleted file mode 100644 index c448af120d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-7.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGHUP\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGHUP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-8.c deleted file mode 100644 index 7f387ce0b0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-8.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGILL\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGILL) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-9.c deleted file mode 100644 index 3dbd860a87..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/13-9.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #13 of the sigaction system call that verifies - signal-catching functions are executed on the current stack if the - SA_ONSTACK flag is cleared in the sigaction.sa_flags parameter to the - sigaction function call. - - NOTE: This test case does not attempt to verify the proper operation - of sigaltstack. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include "posixtest.h" - -stack_t current; - -void handler(int signo) -{ - stack_t oss; - - printf("Caught SIGINT\n"); - - if (sigaltstack((stack_t *)0, &oss) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - exit(-1); - } - - if (oss.ss_sp != current.ss_sp || oss.ss_size != current.ss_size) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaltstack((stack_t *)0, ¤t) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGINT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-1.c deleted file mode 100644 index 706dbfc64a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-1.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGABRT with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGABRT, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGABRT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-10.c deleted file mode 100644 index 2e6a55ba76..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-10.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGPIPE with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGPIPE, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPIPE - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-11.c deleted file mode 100644 index 6f81c98422..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-11.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGQUIT with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGQUIT, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGQUIT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-12.c deleted file mode 100644 index 1c3a91a86b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-12.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGSEGV with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGSEGV, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGSEGV - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-13.c deleted file mode 100644 index bb02e028f2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-13.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGTERM with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGTERM, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTERM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-14.c deleted file mode 100644 index 3439835f9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-14.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGTSTP with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGTSTP, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTSTP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-15.c deleted file mode 100644 index 888566ae1a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-15.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGTTIN with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGTTIN, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTTIN - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-16.c deleted file mode 100644 index c72f493d5c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-16.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGTTOU with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGTTOU, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTTOU - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-17.c deleted file mode 100644 index 8e8ab37916..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-17.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGUSR1 with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGUSR1, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGUSR1 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-18.c deleted file mode 100644 index ecb95add7f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-18.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGUSR2 with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGUSR2, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGUSR2 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-19.c deleted file mode 100644 index 937e49ba35..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-19.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGPOLL with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGPOLL, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPOLL - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-2.c deleted file mode 100644 index 69583e8f4b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-2.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGALRM with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGALRM, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGALRM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-20.c deleted file mode 100644 index efd4d902cf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-20.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGPROF with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGPROF, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPROF - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-21.c deleted file mode 100644 index e76c21dab6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-21.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGSYS with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGSYS, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGSYS - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-22.c deleted file mode 100644 index b9f72003bf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-22.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGTRAP with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGTRAP, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTRAP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-23.c deleted file mode 100644 index d8a29bbe34..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-23.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGURG with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGURG, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGURG - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-24.c deleted file mode 100644 index 57e1621c17..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-24.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGVTALRM with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGVTALRM, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGVTALRM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-25.c deleted file mode 100644 index 4f67a57992..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-25.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGXCPU with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGXCPU, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGXCPU - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-26.c deleted file mode 100644 index bc15cb3986..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-26.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGXFSZ with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGXFSZ, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGXFSZ - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-3.c deleted file mode 100644 index b0fc5b55ef..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-3.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGBUS with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGBUS, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGBUS - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-4.c deleted file mode 100644 index 610605b005..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-4.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGCHLD with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGCHLD, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGCHLD - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-5.c deleted file mode 100644 index 504cab9c44..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-5.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGCONT with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGCONT, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGCONT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-6.c deleted file mode 100644 index 4606f0681e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-6.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGFPE with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGFPE, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGFPE - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-7.c deleted file mode 100644 index 6c0020f772..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-7.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGHUP with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGHUP, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGHUP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-8.c deleted file mode 100644 index 779adab2ec..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-8.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGILL with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGILL, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGILL - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-9.c deleted file mode 100644 index 68ad79aedf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/16-9.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_RESTART is set in sa_flags, interruptible function interrupted by signal -* shall restart silently. - -* The steps are: -* -> create a child thread -* -> child registers a handler for SIGINT with SA_RESTART, then waits for the semaphore -* -> parent kills the child with SIGINT, then post the semaphore. - -* The test fails if the sem_wait function returns EINTR - -*Note: -This test uses sem_wait to check if EINTR is returned. As the function is not required to -fail with EINTR, the test may return PASS and the feature not be correct (false positive). -Anyway, a false negative status cannot be returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test tests for an XSI feature */ -#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGINT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -volatile sig_atomic_t caught = 0; -sem_t sem; - -/* Handler function */ -void handler( int signo ) -{ - printf( "Caught signal %d\n", signo ); - caught++; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret = 0; - - ret = sem_wait( &sem ); - - if ( ret != 0 ) - { - if ( errno == EINTR ) - { - FAILED( "The function returned EINTR while SA_RESTART is set" ); - } - else - { - UNRESOLVED( errno, "sem_wait failed" ); - } - } - - return NULL; -} - -/* main function */ -int main() -{ - int ret; - pthread_t child; - - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = SA_RESTART; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGNAL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Initialize the semaphore */ - ret = sem_init( &sem, 0, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to init a semaphore" ); - } - - /* Create the child thread */ - ret = pthread_create( &child, NULL, threaded, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a child thread" ); - } - - /* Let the child thread enter the wait routine... - we use sched_yield as there is no certain way to test that the child - is waiting for the semaphore... */ - sched_yield(); - - sched_yield(); - - sched_yield(); - - /* Ok, now kill the child */ - ret = pthread_kill( child, SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to kill the child thread" ); - } - - /* wait that the child receives the signal */ - while ( !caught ) - sched_yield(); - - /* Now let the child run and terminate */ - ret = sem_post( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to post the semaphore" ); - } - - ret = pthread_join( child, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join the thread" ); - } - - /* terminate */ - ret = sem_destroy( &sem ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to destroy the semaphore" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-1.c deleted file mode 100644 index d0a8e316ba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-1.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGABRT signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGABRT\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGABRT, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGABRT signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGABRT); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-10.c deleted file mode 100644 index 2a0cab7544..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-10.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGPIPE signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGPIPE\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGPIPE, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGPIPE signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGPIPE); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-11.c deleted file mode 100644 index 8824cb7d04..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-11.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGQUIT signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGQUIT\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGQUIT, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGQUIT signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGQUIT); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-12.c deleted file mode 100644 index 5afced48fd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-12.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGSEGV signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGSEGV\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGSEGV, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGSEGV signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGSEGV); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-13.c deleted file mode 100644 index 2180a3e5e8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-13.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGTERM signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGTERM\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGTERM, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGTERM signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGTERM); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-14.c deleted file mode 100644 index 742db1eec4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-14.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGTSTP signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGTSTP\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGTSTP, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGTSTP signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGTSTP); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-15.c deleted file mode 100644 index aac5b2a8b2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-15.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGTTIN signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGTTIN\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGTTIN, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGTTIN signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGTTIN); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-16.c deleted file mode 100644 index 92afee89a3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-16.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGTTOU signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGTTOU\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGTTOU, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGTTOU signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGTTOU); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-17.c deleted file mode 100644 index d8f0e3837f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-17.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGUSR1 signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGUSR1\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGUSR1, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGUSR1 signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGUSR1); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-18.c deleted file mode 100644 index eadbc602bc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-18.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGUSR2 signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGUSR2\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGUSR2, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGUSR2 signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGUSR2); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-19.c deleted file mode 100644 index 33e6420bbc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-19.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGPOLL signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGPOLL\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGPOLL, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGPOLL signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGPOLL); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-2.c deleted file mode 100644 index fea9c6538c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-2.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGALRM signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGALRM\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGALRM, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGALRM signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGALRM); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-20.c deleted file mode 100644 index 8774ef1dd3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-20.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGPROF signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGPROF\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGPROF, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGPROF signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGPROF); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-21.c deleted file mode 100644 index 19079bf529..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-21.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGSYS signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGSYS\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGSYS, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGSYS signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGSYS); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-22.c deleted file mode 100644 index 217e6f0022..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-22.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGTRAP signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGTRAP\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGTRAP, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGTRAP signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGTRAP); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-23.c deleted file mode 100644 index ca82e6f758..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-23.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGURG signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGURG\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGURG, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGURG signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGURG); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-24.c deleted file mode 100644 index d4a8494d11..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-24.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGVTALRM signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGVTALRM\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGVTALRM, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGVTALRM signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGVTALRM); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-25.c deleted file mode 100644 index 47270419d1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-25.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGXCPU signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGXCPU\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGXCPU, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGXCPU signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGXCPU); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-26.c deleted file mode 100644 index 42e4859c8c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-26.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGXFSZ signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGXFSZ\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGXFSZ, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGXFSZ signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGXFSZ); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-3.c deleted file mode 100644 index 3e4892c26c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-3.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGBUS signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGBUS\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGBUS, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGBUS signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGBUS); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-4.c deleted file mode 100644 index a8e7aff103..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-4.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGCHLD signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGCHLD\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGCHLD, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGCHLD signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGCHLD); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-5.c deleted file mode 100644 index 504a08481e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-5.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGCONT signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGCONT\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGCONT, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGCONT signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGCONT); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-6.c deleted file mode 100644 index 86c12ce097..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-6.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGFPE signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGFPE\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGFPE, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGFPE signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGFPE); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-7.c deleted file mode 100644 index 8f6dae153e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-7.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGHUP signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGHUP\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGHUP, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGHUP signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGHUP); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-8.c deleted file mode 100644 index 0f48a8c40d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-8.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGILL signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGILL\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGILL, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGILL signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGILL); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-9.c deleted file mode 100644 index f28c4b1677..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/17-9.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #17 by verifying that select returns -1 with - errno set to EINTR if a handler for the SIGINT signal is setup with - the SA_RESTART flag cleared. - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -volatile sig_atomic_t wakeup = 1; - -void handler(int signo) -{ - printf("Caught SIGINT\n"); - wakeup++; -} - -int main() -{ - pid_t pid; - struct timeval tv; - - if ((pid = fork()) == 0) { - /* child */ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGINT, &act, 0); - - while(wakeup == 1) { - tv.tv_sec = 3; - tv.tv_usec = 0; - if (select(0, NULL, NULL, NULL, &tv)== -1 && - errno == EINTR) { - perror("select"); - return PTS_PASS; - } - } - - return PTS_FAIL; - } else { - /* parent */ - int s; - - /* - There is a race condition between the parent - process sending the SIGINT signal, and the - child process being inside the 'select' function - call. - - I could not find a pure POSIX method for determining - the state of the child process, so I just added a delay - so that the test is valid in most conditions. (The - problem is that it would be perfectly legal for a - POSIX conformant OS to not schedule the child process - for a long time.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - kill(pid, SIGINT); - waitpid(pid, &s, 0); - if (WEXITSTATUS(s) == PTS_PASS) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-1.c deleted file mode 100644 index aa3390dda1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-1.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGABRT without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGABRT, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGABRT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGABRT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGABRT" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-10.c deleted file mode 100644 index 9aeda04310..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-10.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGPIPE without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGPIPE, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPIPE - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPIPE */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPIPE" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-11.c deleted file mode 100644 index 7cfd7fadcb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-11.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGQUIT without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGQUIT, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGQUIT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGQUIT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGQUIT" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-12.c deleted file mode 100644 index a94b3c9e66..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-12.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGSEGV without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGSEGV, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGSEGV - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGSEGV */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGSEGV" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-13.c deleted file mode 100644 index f12004dc9f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-13.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGTERM without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGTERM, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTERM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTERM */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTERM" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-14.c deleted file mode 100644 index 77ebad0ab9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-14.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGTSTP without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGTSTP, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTSTP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTSTP */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTSTP" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-15.c deleted file mode 100644 index 2f86191b63..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-15.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGTTIN without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGTTIN, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTTIN - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTTIN */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTTIN" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-16.c deleted file mode 100644 index 11f3a71ba1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-16.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGTTOU without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGTTOU, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTTOU - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTTOU */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTTOU" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-17.c deleted file mode 100644 index d7d0c39e25..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-17.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGUSR1 without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGUSR1, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGUSR1 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGUSR1 */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGUSR1" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-18.c deleted file mode 100644 index 784c649e76..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-18.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGUSR2 without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGUSR2, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGUSR2 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGUSR2 */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGUSR2" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-19.c deleted file mode 100644 index 81a8746208..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-19.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGPOLL without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGPOLL, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPOLL - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPOLL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPOLL" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-2.c deleted file mode 100644 index 359e4d1933..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-2.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGALRM without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGALRM, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGALRM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGALRM */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGALRM" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-20.c deleted file mode 100644 index 755f76c81d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-20.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGPROF without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGPROF, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPROF - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPROF */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPROF" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-21.c deleted file mode 100644 index 34cde9fed4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-21.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGSYS without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGSYS, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGSYS - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGSYS */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGSYS" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-22.c deleted file mode 100644 index a058e6b63a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-22.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGTRAP without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGTRAP, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTRAP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTRAP */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTRAP" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-23.c deleted file mode 100644 index 1d4be9f041..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-23.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGURG without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGURG, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGURG - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGURG */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGURG" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-24.c deleted file mode 100644 index a1ccba821b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-24.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGVTALRM without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGVTALRM, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGVTALRM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGVTALRM */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGVTALRM" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-25.c deleted file mode 100644 index d42e48f59b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-25.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGXCPU without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGXCPU, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGXCPU - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGXCPU */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGXCPU" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-26.c deleted file mode 100644 index 5e124d496c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-26.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGXFSZ without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGXFSZ, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGXFSZ - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGXFSZ */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGXFSZ" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-3.c deleted file mode 100644 index 85d6750f16..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-3.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGBUS without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGBUS, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGBUS - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGBUS */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGBUS" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-4.c deleted file mode 100644 index a68badf15c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-4.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGCHLD without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGCHLD, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGCHLD - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGCHLD */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGCHLD" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-5.c deleted file mode 100644 index 44f94cd067..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-5.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGCONT without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGCONT, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGCONT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGCONT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGCONT" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-6.c deleted file mode 100644 index 2b27826c41..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-6.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGFPE without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGFPE, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGFPE - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGFPE */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGFPE" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-7.c deleted file mode 100644 index ee628c1bb9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-7.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGHUP without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGHUP, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGHUP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGHUP */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGHUP" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-8.c deleted file mode 100644 index 99c11e761c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-8.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGILL without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGILL, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGILL - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGILL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGILL" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-9.c deleted file mode 100644 index 91317a9f72..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/18-9.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is not set in sa_flags, sa_handler is used as the signal -* handling function. - -* The steps are: -* -> register a handler for SIGINT without SA_SIGINFO, and a known function -* as saèhandler -* -> raise SIGINT, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGINT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig ) -{ - called = 1; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - sa.sa_handler = handler; - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGINT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGINT" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-1.c deleted file mode 100644 index d997760e85..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-1.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGABRT with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGABRT, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGABRT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGABRT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGABRT" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-10.c deleted file mode 100644 index dbb5bf6fa3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-10.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGPIPE with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGPIPE, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPIPE - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPIPE */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPIPE" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-11.c deleted file mode 100644 index 3f612c229a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-11.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGQUIT with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGQUIT, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGQUIT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGQUIT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGQUIT" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-12.c deleted file mode 100644 index 8b8a17e06a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-12.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGSEGV with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGSEGV, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGSEGV - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGSEGV */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGSEGV" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-13.c deleted file mode 100644 index 3c93b5cd8e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-13.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGTERM with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGTERM, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTERM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTERM */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTERM" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-14.c deleted file mode 100644 index d264e802b7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-14.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGTSTP with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGTSTP, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTSTP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTSTP */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTSTP" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-15.c deleted file mode 100644 index 936fac49c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-15.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGTTIN with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGTTIN, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTTIN - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTTIN */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTTIN" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-16.c deleted file mode 100644 index 719eb1ee06..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-16.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGTTOU with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGTTOU, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTTOU - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTTOU */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTTOU" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-17.c deleted file mode 100644 index 2d351a3ddd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-17.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGUSR1 with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGUSR1, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGUSR1 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGUSR1 */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGUSR1" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-18.c deleted file mode 100644 index 2b56ca6162..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-18.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGUSR2 with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGUSR2, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGUSR2 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGUSR2 */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGUSR2" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-19.c deleted file mode 100644 index a2083cc755..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-19.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGPOLL with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGPOLL, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPOLL - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPOLL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPOLL" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-2.c deleted file mode 100644 index e4a8183a65..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-2.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGALRM with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGALRM, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGALRM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGALRM */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGALRM" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-20.c deleted file mode 100644 index c1e72d71b1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-20.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGPROF with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGPROF, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPROF - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPROF */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPROF" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-21.c deleted file mode 100644 index 1324c2a470..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-21.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGSYS with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGSYS, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGSYS - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGSYS */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGSYS" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-22.c deleted file mode 100644 index 47fd25dc93..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-22.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGTRAP with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGTRAP, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTRAP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTRAP */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTRAP" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-23.c deleted file mode 100644 index ca4f065118..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-23.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGURG with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGURG, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGURG - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGURG */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGURG" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-24.c deleted file mode 100644 index 63a16a3ced..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-24.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGVTALRM with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGVTALRM, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGVTALRM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGVTALRM */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGVTALRM" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-25.c deleted file mode 100644 index f94c4649c0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-25.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGXCPU with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGXCPU, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGXCPU - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGXCPU */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGXCPU" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-26.c deleted file mode 100644 index 007f96844d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-26.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGXFSZ with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGXFSZ, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGXFSZ - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGXFSZ */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGXFSZ" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-3.c deleted file mode 100644 index 0534c009a1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-3.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGBUS with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGBUS, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGBUS - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGBUS */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGBUS" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-4.c deleted file mode 100644 index 386cde0806..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-4.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGCHLD with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGCHLD, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGCHLD - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGCHLD */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGCHLD" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-5.c deleted file mode 100644 index 859961eafe..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-5.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGCONT with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGCONT, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGCONT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGCONT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGCONT" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-6.c deleted file mode 100644 index 5dc32e0044..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-6.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGFPE with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGFPE, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGFPE - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGFPE */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGFPE" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-7.c deleted file mode 100644 index 98886ed8b5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-7.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGHUP with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGHUP, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGHUP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGHUP */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGHUP" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-8.c deleted file mode 100644 index 7bec03c270..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-8.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGILL with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGILL, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGILL - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGILL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGILL" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-9.c deleted file mode 100644 index 6e60c68b89..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/19-9.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported, -* sa_sigaction is used as the signal handling function. - -* The steps are: -* -> test for RTS extension -* -> register a handler for SIGINT with SA_SIGINFO, and a known function -* as sa_sigaction -* -> raise SIGINT, and check the function has been called. - -* The test fails if the function is not called -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGINT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGNAL ) - { - FAILED( "Wrong signal generated?" ); - } - - called = 1; -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGINT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - if ( called ) - { - FAILED( "The signal handler has been called when no signal was raised" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGINT" ); - } - - if ( !called ) - { - FAILED( "the sa_handler was not called whereas SA_SIGINFO was not set" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-1.c deleted file mode 100644 index facefdd0ce..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGABRT to use handler1 - 2. Call sigaction again to set handler for SIGABRT to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGABRT, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-10.c deleted file mode 100644 index c7cc918b4a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-10.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGPIPE to use handler1 - 2. Call sigaction again to set handler for SIGPIPE to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPIPE, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-11.c deleted file mode 100644 index b08d2d655f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-11.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGQUIT to use handler1 - 2. Call sigaction again to set handler for SIGQUIT to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGQUIT, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-12.c deleted file mode 100644 index 862da240b9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-12.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGSEGV to use handler1 - 2. Call sigaction again to set handler for SIGSEGV to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSEGV, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-13.c deleted file mode 100644 index 2083f6dc3a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-13.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGTERM to use handler1 - 2. Call sigaction again to set handler for SIGTERM to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTERM, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-14.c deleted file mode 100644 index fb032cd660..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-14.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGTSTP to use handler1 - 2. Call sigaction again to set handler for SIGTSTP to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTSTP, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-15.c deleted file mode 100644 index 23c2d6f442..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-15.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGTTIN to use handler1 - 2. Call sigaction again to set handler for SIGTTIN to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTIN, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-16.c deleted file mode 100644 index 9fe1ea6f37..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-16.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGTTOU to use handler1 - 2. Call sigaction again to set handler for SIGTTOU to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTOU, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-17.c deleted file mode 100644 index 9319e944fe..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-17.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGUSR1 to use handler1 - 2. Call sigaction again to set handler for SIGUSR1 to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR1, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-18.c deleted file mode 100644 index 6d224b966f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-18.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGUSR2 to use handler1 - 2. Call sigaction again to set handler for SIGUSR2 to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR2, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-19.c deleted file mode 100644 index 655ce96d1a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-19.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGPOLL to use handler1 - 2. Call sigaction again to set handler for SIGPOLL to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPOLL, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-2.c deleted file mode 100644 index f0f8fd33ab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-2.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGALRM to use handler1 - 2. Call sigaction again to set handler for SIGALRM to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGALRM, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-20.c deleted file mode 100644 index 65ea88ab19..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-20.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGPROF to use handler1 - 2. Call sigaction again to set handler for SIGPROF to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPROF, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-21.c deleted file mode 100644 index b52ee0969d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-21.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGSYS to use handler1 - 2. Call sigaction again to set handler for SIGSYS to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSYS, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-22.c deleted file mode 100644 index 888f832d1f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-22.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGTRAP to use handler1 - 2. Call sigaction again to set handler for SIGTRAP to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTRAP, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-23.c deleted file mode 100644 index e60d118300..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-23.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGURG to use handler1 - 2. Call sigaction again to set handler for SIGURG to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGURG, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-24.c deleted file mode 100644 index 98bcce68a1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-24.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGVTALRM to use handler1 - 2. Call sigaction again to set handler for SIGVTALRM to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGVTALRM, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-25.c deleted file mode 100644 index 6b0fb0b62e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-25.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGXCPU to use handler1 - 2. Call sigaction again to set handler for SIGXCPU to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXCPU, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-26.c deleted file mode 100644 index 50ee719869..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-26.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGXFSZ to use handler1 - 2. Call sigaction again to set handler for SIGXFSZ to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXFSZ, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-3.c deleted file mode 100644 index 2eef0b1e14..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-3.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGBUS to use handler1 - 2. Call sigaction again to set handler for SIGBUS to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGBUS, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-4.c deleted file mode 100644 index 58de79277a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-4.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGCHLD to use handler1 - 2. Call sigaction again to set handler for SIGCHLD to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCHLD, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-5.c deleted file mode 100644 index c3f82d8bc1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-5.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGCONT to use handler1 - 2. Call sigaction again to set handler for SIGCONT to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCONT, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-6.c deleted file mode 100644 index 09a9ef937c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-6.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGFPE to use handler1 - 2. Call sigaction again to set handler for SIGFPE to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGFPE, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-7.c deleted file mode 100644 index bc905b9f56..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-7.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGHUP to use handler1 - 2. Call sigaction again to set handler for SIGHUP to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGHUP, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-8.c deleted file mode 100644 index 49e2a70b9d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-8.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGILL to use handler1 - 2. Call sigaction again to set handler for SIGILL to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGILL, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-9.c deleted file mode 100644 index 78174e4409..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/2-9.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #2 of the sigaction system call that shows - sigaction (when used with a non-null oact pointer) changes the action - for a signal. - - Steps: - 1. Call sigaction to set handler for SIGINT to use handler1 - 2. Call sigaction again to set handler for SIGINT to use handler2, - but this time use a non-null oarg and verify the sa_handler for - oarg is set for handler1. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler1(int signo) -{ -} - -void handler2(int signo) -{ -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler1; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = handler2; - sigemptyset(&act.sa_mask); - if (sigaction(SIGINT, &act, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (oact.sa_handler == handler1) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test Failed\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/21-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/21-1.c deleted file mode 100644 index 61d3ead23d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/21-1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - Test assertion #21 by verifying that adding a sigaction for SIGCHLD - with the SA_NOCLDWAIT bit set in sigaction.sa_flags will result in - a child process not transforming into a zombie after death. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - - -void handler(int signo) -{ - printf("Caught SIGCHLD\n"); -} - - -int main() -{ - - /* Make sure this flag is supported. */ - #ifndef SA_NOCLDWAIT - fprintf(stderr,"SA_NOCLWAIT flag is not available for testing\n"); - return PTS_UNSUPPORTED; - #endif - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NOCLDWAIT; - sigemptyset(&act.sa_mask); - sigaction(SIGCHLD, &act, 0); - - if (fork() == 0) { - /* child */ - return 0; - } else { - /* parent */ - int s; - if (wait(&s) == -1 && errno == ECHILD) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-1.c deleted file mode 100644 index 1fad479e03..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-1.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGABRT with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGABRT - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGABRT - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGABRT caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGABRT\n"); - raise(SIGABRT); - printf("Returning from raising SIGABRT\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-10.c deleted file mode 100644 index 254a116b20..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-10.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPIPE with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGPIPE - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGPIPE - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGPIPE caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGPIPE\n"); - raise(SIGPIPE); - printf("Returning from raising SIGPIPE\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPIPE) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-11.c deleted file mode 100644 index 0c204fecf4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-11.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGQUIT with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGQUIT - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGQUIT - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGQUIT caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGQUIT\n"); - raise(SIGQUIT); - printf("Returning from raising SIGQUIT\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGQUIT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-12.c deleted file mode 100644 index bbc7124736..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-12.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGSEGV with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGSEGV - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGSEGV - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGSEGV caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGSEGV\n"); - raise(SIGSEGV); - printf("Returning from raising SIGSEGV\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSEGV) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-13.c deleted file mode 100644 index 0b3bf3b006..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-13.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTERM with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGTERM - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGTERM - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGTERM caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGTERM\n"); - raise(SIGTERM); - printf("Returning from raising SIGTERM\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTERM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-14.c deleted file mode 100644 index 4f6807f10b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-14.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTSTP with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGTSTP - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGTSTP - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGTSTP caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGTSTP\n"); - raise(SIGTSTP); - printf("Returning from raising SIGTSTP\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTSTP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-15.c deleted file mode 100644 index 9e3a55fa40..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-15.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTTIN with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGTTIN - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGTTIN - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGTTIN caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGTTIN\n"); - raise(SIGTTIN); - printf("Returning from raising SIGTTIN\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTIN) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-16.c deleted file mode 100644 index db92c5dfd2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-16.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTTOU with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGTTOU - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGTTOU - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGTTOU caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGTTOU\n"); - raise(SIGTTOU); - printf("Returning from raising SIGTTOU\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTOU) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-17.c deleted file mode 100644 index 01fe087a28..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-17.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGUSR1 with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGUSR1 - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGUSR1 - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGUSR1 caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGUSR1\n"); - raise(SIGUSR1); - printf("Returning from raising SIGUSR1\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR1) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-18.c deleted file mode 100644 index c91cc1aa07..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-18.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGUSR2 with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGUSR2 - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGUSR2 - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGUSR2 caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGUSR2\n"); - raise(SIGUSR2); - printf("Returning from raising SIGUSR2\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR2) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-19.c deleted file mode 100644 index bebc5d7cc8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-19.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPOLL with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGPOLL - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGPOLL - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGPOLL caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGPOLL\n"); - raise(SIGPOLL); - printf("Returning from raising SIGPOLL\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPOLL) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-2.c deleted file mode 100644 index 0adffacc1d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-2.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGALRM with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGALRM - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGALRM - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGALRM caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGALRM\n"); - raise(SIGALRM); - printf("Returning from raising SIGALRM\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-20.c deleted file mode 100644 index 7325a72318..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-20.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPROF with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGPROF - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGPROF - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGPROF caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGPROF\n"); - raise(SIGPROF); - printf("Returning from raising SIGPROF\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPROF) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-21.c deleted file mode 100644 index 2679785ff0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-21.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGSYS with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGSYS - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGSYS - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGSYS caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGSYS\n"); - raise(SIGSYS); - printf("Returning from raising SIGSYS\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSYS) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-22.c deleted file mode 100644 index 879bc02158..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-22.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTRAP with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGTRAP - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGTRAP - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGTRAP caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGTRAP\n"); - raise(SIGTRAP); - printf("Returning from raising SIGTRAP\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTRAP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-23.c deleted file mode 100644 index d184594509..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-23.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGURG with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGURG - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGURG - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGURG caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGURG\n"); - raise(SIGURG); - printf("Returning from raising SIGURG\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGURG) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-24.c deleted file mode 100644 index 0dc8b5e2b9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-24.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGVTALRM with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGVTALRM - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGVTALRM - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGVTALRM caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGVTALRM\n"); - raise(SIGVTALRM); - printf("Returning from raising SIGVTALRM\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGVTALRM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-25.c deleted file mode 100644 index 7e0531c29b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-25.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGXCPU with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGXCPU - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGXCPU - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGXCPU caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGXCPU\n"); - raise(SIGXCPU); - printf("Returning from raising SIGXCPU\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXCPU) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-26.c deleted file mode 100644 index efbd62d4c9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-26.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGXFSZ with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGXFSZ - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGXFSZ - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGXFSZ caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGXFSZ\n"); - raise(SIGXFSZ); - printf("Returning from raising SIGXFSZ\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXFSZ) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-3.c deleted file mode 100644 index 13543468df..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-3.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGBUS with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGBUS - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGBUS - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGBUS caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGBUS\n"); - raise(SIGBUS); - printf("Returning from raising SIGBUS\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGBUS) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-4.c deleted file mode 100644 index 77e1a653d1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-4.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGCHLD with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGCHLD - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGCHLD - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGCHLD caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGCHLD\n"); - raise(SIGCHLD); - printf("Returning from raising SIGCHLD\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCHLD) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-5.c deleted file mode 100644 index 4b99fb9775..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-5.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGCONT with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGCONT - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGCONT - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGCONT caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGCONT\n"); - raise(SIGCONT); - printf("Returning from raising SIGCONT\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCONT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-6.c deleted file mode 100644 index e058b17f44..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-6.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGFPE with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGFPE - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGFPE - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGFPE caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGFPE\n"); - raise(SIGFPE); - printf("Returning from raising SIGFPE\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGFPE) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-7.c deleted file mode 100644 index 7b61a36586..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-7.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGHUP with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGHUP - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGHUP - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGHUP caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGHUP\n"); - raise(SIGHUP); - printf("Returning from raising SIGHUP\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGHUP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-8.c deleted file mode 100644 index f72ea9e1f4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-8.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGILL with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGILL - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGILL - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGILL caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGILL\n"); - raise(SIGILL); - printf("Returning from raising SIGILL\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGILL) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-9.c deleted file mode 100644 index 178a05df75..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/22-9.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #22 of the sigaction system call that verifies - that if the SA_NODEFER flag is set for a given signal, then when the - sa_sigaction signal-catching function is entered, then the signal that - was caught is not added to the signal mask by raising that signal in the - signal handler and verifying that the handler is reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGINT with SA_NODEFER set - in the sa_flags field - 4. (child) raise SIGINT - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGINT - 7. (child, signal handler) if count is 1 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGINT caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - exit(0); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGINT\n"); - raise(SIGINT); - printf("Returning from raising SIGINT\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = SA_NODEFER; - sigemptyset(&act.sa_mask); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGINT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - return PTS_FAIL; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-1.c deleted file mode 100644 index e88ddf9306..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-1.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGABRT -* -> raise SIGABRT -* -> In handler, check for reentrance then raise SIGABRT again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGABRT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGABRT again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGABRT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGABRT" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-10.c deleted file mode 100644 index 945af04e37..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-10.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGPIPE -* -> raise SIGPIPE -* -> In handler, check for reentrance then raise SIGPIPE again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPIPE - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPIPE again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPIPE */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPIPE" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-11.c deleted file mode 100644 index 7c3eb7c32c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-11.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGQUIT -* -> raise SIGQUIT -* -> In handler, check for reentrance then raise SIGQUIT again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGQUIT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGQUIT again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGQUIT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGQUIT" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-12.c deleted file mode 100644 index 6b1a96d13c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-12.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGSEGV -* -> raise SIGSEGV -* -> In handler, check for reentrance then raise SIGSEGV again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGSEGV - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGSEGV again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGSEGV */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGSEGV" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-13.c deleted file mode 100644 index f92da090b9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-13.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGTERM -* -> raise SIGTERM -* -> In handler, check for reentrance then raise SIGTERM again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTERM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTERM again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTERM */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTERM" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-14.c deleted file mode 100644 index 14f19bc7bd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-14.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGTSTP -* -> raise SIGTSTP -* -> In handler, check for reentrance then raise SIGTSTP again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTSTP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTSTP again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTSTP */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTSTP" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-15.c deleted file mode 100644 index 6c05bb8db1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-15.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGTTIN -* -> raise SIGTTIN -* -> In handler, check for reentrance then raise SIGTTIN again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTTIN - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTTIN again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTTIN */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTTIN" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-16.c deleted file mode 100644 index 189e4ab2e9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-16.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGTTOU -* -> raise SIGTTOU -* -> In handler, check for reentrance then raise SIGTTOU again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTTOU - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTTOU again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTTOU */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTTOU" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-17.c deleted file mode 100644 index 67cb706068..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-17.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGUSR1 -* -> raise SIGUSR1 -* -> In handler, check for reentrance then raise SIGUSR1 again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGUSR1 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGUSR1 again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGUSR1 */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGUSR1" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-18.c deleted file mode 100644 index 4ed137a92b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-18.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGUSR2 -* -> raise SIGUSR2 -* -> In handler, check for reentrance then raise SIGUSR2 again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGUSR2 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGUSR2 again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGUSR2 */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGUSR2" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-19.c deleted file mode 100644 index df7f6ced71..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-19.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGPOLL -* -> raise SIGPOLL -* -> In handler, check for reentrance then raise SIGPOLL again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPOLL - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPOLL again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPOLL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPOLL" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-2.c deleted file mode 100644 index 0d7c39a193..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-2.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGALRM -* -> raise SIGALRM -* -> In handler, check for reentrance then raise SIGALRM again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGALRM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGALRM again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGALRM */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGALRM" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-20.c deleted file mode 100644 index 478f13c9b5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-20.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGPROF -* -> raise SIGPROF -* -> In handler, check for reentrance then raise SIGPROF again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPROF - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPROF again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPROF */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGPROF" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-21.c deleted file mode 100644 index 308614ea13..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-21.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGSYS -* -> raise SIGSYS -* -> In handler, check for reentrance then raise SIGSYS again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGSYS - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGSYS again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGSYS */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGSYS" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-22.c deleted file mode 100644 index 97fb249ac7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-22.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGTRAP -* -> raise SIGTRAP -* -> In handler, check for reentrance then raise SIGTRAP again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTRAP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTRAP again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTRAP */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGTRAP" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-23.c deleted file mode 100644 index 11d2c9de99..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-23.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGURG -* -> raise SIGURG -* -> In handler, check for reentrance then raise SIGURG again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGURG - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGURG again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGURG */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGURG" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-24.c deleted file mode 100644 index 6c5906de41..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-24.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGVTALRM -* -> raise SIGVTALRM -* -> In handler, check for reentrance then raise SIGVTALRM again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGVTALRM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGVTALRM again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGVTALRM */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGVTALRM" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-25.c deleted file mode 100644 index bdbe9f09b3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-25.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGXCPU -* -> raise SIGXCPU -* -> In handler, check for reentrance then raise SIGXCPU again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGXCPU - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGXCPU again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGXCPU */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGXCPU" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-26.c deleted file mode 100644 index 4b58696b32..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-26.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGXFSZ -* -> raise SIGXFSZ -* -> In handler, check for reentrance then raise SIGXFSZ again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGXFSZ - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGXFSZ again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGXFSZ */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGXFSZ" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-3.c deleted file mode 100644 index 0822a283b7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-3.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGBUS -* -> raise SIGBUS -* -> In handler, check for reentrance then raise SIGBUS again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGBUS - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGBUS again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGBUS */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGBUS" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-4.c deleted file mode 100644 index 0fb2ee9784..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-4.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGCHLD -* -> raise SIGCHLD -* -> In handler, check for reentrance then raise SIGCHLD again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGCHLD - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGCHLD again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGCHLD */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGCHLD" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-5.c deleted file mode 100644 index cf4a33a443..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-5.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGCONT -* -> raise SIGCONT -* -> In handler, check for reentrance then raise SIGCONT again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGCONT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGCONT again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGCONT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGCONT" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-6.c deleted file mode 100644 index 209606f16e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-6.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGFPE -* -> raise SIGFPE -* -> In handler, check for reentrance then raise SIGFPE again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGFPE - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGFPE again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGFPE */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGFPE" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-7.c deleted file mode 100644 index b45af47d0e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-7.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGHUP -* -> raise SIGHUP -* -> In handler, check for reentrance then raise SIGHUP again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGHUP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGHUP again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGHUP */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGHUP" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-8.c deleted file mode 100644 index 573f5e51a5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-8.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGILL -* -> raise SIGILL -* -> In handler, check for reentrance then raise SIGILL again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGILL - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGILL again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGILL */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGILL" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-9.c deleted file mode 100644 index e556c70aba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/23-9.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_NODEFER is not set in sa_flags, the caught signal is added to the -* thread's signal mask during the handler execution. - -* The steps are: -* -> register a signal handler for SIGINT -* -> raise SIGINT -* -> In handler, check for reentrance then raise SIGINT again. - -* The test fails if signal handler if reentered or signal is not pending when raised again. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGINT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -int called = 0; - -void handler( int sig ) -{ - int ret; - sigset_t pending; - called++; - - if ( called == 2 ) - { - FAILED( "Signal was not masked in signal handler" ); - } - - if ( called == 1 ) - { - - /* Raise the signal again. It should be masked */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGINT again" ); - } - - /* check the signal is pending */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to get pending signal set" ); - } - - ret = sigismember( &pending, SIGNAL ); - - if ( ret != 1 ) - { - FAILED( "signal is not pending" ); - } - } - - called++; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGINT */ - ret = sigaction( SIGNAL, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to raise SIGINT" ); - } - - while ( called != 4 ) - sched_yield(); - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-1.c deleted file mode 100644 index 48daa3301d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-1.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGABRT - 4. (child) raise SIGABRT - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGABRT - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGABRT caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGABRT\n"); - raise(SIGABRT); - printf("Returning from raising SIGABRT\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-10.c deleted file mode 100644 index 32442546a0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-10.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPIPE - 4. (child) raise SIGPIPE - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGPIPE - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGPIPE caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGPIPE\n"); - raise(SIGPIPE); - printf("Returning from raising SIGPIPE\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPIPE) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-11.c deleted file mode 100644 index ea89f893d7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-11.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGQUIT - 4. (child) raise SIGQUIT - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGQUIT - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGQUIT caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGQUIT\n"); - raise(SIGQUIT); - printf("Returning from raising SIGQUIT\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGQUIT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-12.c deleted file mode 100644 index 1e246c8bbe..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-12.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGSEGV - 4. (child) raise SIGSEGV - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGSEGV - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGSEGV caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGSEGV\n"); - raise(SIGSEGV); - printf("Returning from raising SIGSEGV\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSEGV) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-13.c deleted file mode 100644 index 68521c173a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-13.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTERM - 4. (child) raise SIGTERM - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGTERM - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGTERM caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGTERM\n"); - raise(SIGTERM); - printf("Returning from raising SIGTERM\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTERM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-14.c deleted file mode 100644 index 7df9a23396..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-14.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTSTP - 4. (child) raise SIGTSTP - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGTSTP - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGTSTP caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGTSTP\n"); - raise(SIGTSTP); - printf("Returning from raising SIGTSTP\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTSTP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-15.c deleted file mode 100644 index c4e26fc35e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-15.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTTIN - 4. (child) raise SIGTTIN - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGTTIN - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGTTIN caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGTTIN\n"); - raise(SIGTTIN); - printf("Returning from raising SIGTTIN\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTIN) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-16.c deleted file mode 100644 index 8070ccb2f3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-16.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTTOU - 4. (child) raise SIGTTOU - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGTTOU - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGTTOU caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGTTOU\n"); - raise(SIGTTOU); - printf("Returning from raising SIGTTOU\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTOU) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-17.c deleted file mode 100644 index bdfcdacccc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-17.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGUSR1 - 4. (child) raise SIGUSR1 - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGUSR1 - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGUSR1 caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGUSR1\n"); - raise(SIGUSR1); - printf("Returning from raising SIGUSR1\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR1) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-18.c deleted file mode 100644 index 9f7641e5a2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-18.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGUSR2 - 4. (child) raise SIGUSR2 - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGUSR2 - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGUSR2 caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGUSR2\n"); - raise(SIGUSR2); - printf("Returning from raising SIGUSR2\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR2) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-19.c deleted file mode 100644 index c127820cba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-19.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPOLL - 4. (child) raise SIGPOLL - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGPOLL - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGPOLL caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGPOLL\n"); - raise(SIGPOLL); - printf("Returning from raising SIGPOLL\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPOLL) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-2.c deleted file mode 100644 index 84602126c0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-2.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGALRM - 4. (child) raise SIGALRM - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGALRM - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGALRM caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGALRM\n"); - raise(SIGALRM); - printf("Returning from raising SIGALRM\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-20.c deleted file mode 100644 index ede5b6a6ad..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-20.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPROF - 4. (child) raise SIGPROF - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGPROF - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGPROF caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGPROF\n"); - raise(SIGPROF); - printf("Returning from raising SIGPROF\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPROF) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-21.c deleted file mode 100644 index 614dc3e484..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-21.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGSYS - 4. (child) raise SIGSYS - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGSYS - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGSYS caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGSYS\n"); - raise(SIGSYS); - printf("Returning from raising SIGSYS\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSYS) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-22.c deleted file mode 100644 index c2fc51bd85..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-22.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTRAP - 4. (child) raise SIGTRAP - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGTRAP - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGTRAP caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGTRAP\n"); - raise(SIGTRAP); - printf("Returning from raising SIGTRAP\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTRAP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-23.c deleted file mode 100644 index 8d58648207..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-23.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGURG - 4. (child) raise SIGURG - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGURG - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGURG caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGURG\n"); - raise(SIGURG); - printf("Returning from raising SIGURG\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGURG) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-24.c deleted file mode 100644 index b2dd5b0ad6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-24.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGVTALRM - 4. (child) raise SIGVTALRM - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGVTALRM - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGVTALRM caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGVTALRM\n"); - raise(SIGVTALRM); - printf("Returning from raising SIGVTALRM\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGVTALRM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-25.c deleted file mode 100644 index d6ef61ab47..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-25.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGXCPU - 4. (child) raise SIGXCPU - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGXCPU - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGXCPU caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGXCPU\n"); - raise(SIGXCPU); - printf("Returning from raising SIGXCPU\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXCPU) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-26.c deleted file mode 100644 index 2861134bbd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-26.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGXFSZ - 4. (child) raise SIGXFSZ - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGXFSZ - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGXFSZ caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGXFSZ\n"); - raise(SIGXFSZ); - printf("Returning from raising SIGXFSZ\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXFSZ) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-3.c deleted file mode 100644 index b02489e4a3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-3.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGBUS - 4. (child) raise SIGBUS - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGBUS - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGBUS caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGBUS\n"); - raise(SIGBUS); - printf("Returning from raising SIGBUS\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGBUS) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-4.c deleted file mode 100644 index b7f9d9f720..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-4.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGCHLD - 4. (child) raise SIGCHLD - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGCHLD - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGCHLD caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGCHLD\n"); - raise(SIGCHLD); - printf("Returning from raising SIGCHLD\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCHLD) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-5.c deleted file mode 100644 index ac9506bde7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-5.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGCONT - 4. (child) raise SIGCONT - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGCONT - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGCONT caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGCONT\n"); - raise(SIGCONT); - printf("Returning from raising SIGCONT\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCONT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-6.c deleted file mode 100644 index 341c706989..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-6.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGFPE - 4. (child) raise SIGFPE - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGFPE - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGFPE caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGFPE\n"); - raise(SIGFPE); - printf("Returning from raising SIGFPE\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGFPE) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-7.c deleted file mode 100644 index 64849b7670..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-7.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGHUP - 4. (child) raise SIGHUP - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGHUP - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGHUP caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGHUP\n"); - raise(SIGHUP); - printf("Returning from raising SIGHUP\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGHUP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-8.c deleted file mode 100644 index be5dde1b26..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-8.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGILL - 4. (child) raise SIGILL - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGILL - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGILL caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGILL\n"); - raise(SIGILL); - printf("Returning from raising SIGILL\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGILL) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-9.c deleted file mode 100644 index d934544d0a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/25-9.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #25 of the sigaction system call that verifies - that when the sa_sigaction signal-catching function is entered, then - the signal that was caught is added to the signal mask by raising that - signal in the signal handler and verifying that the handler is not - reentered. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGINT - 4. (child) raise SIGINT - 5. (child, signal handler) increment handler count - 6. (child, signal handler) if count is 1 then raise SIGINT - 7. (child, signal handler) if count is 2 then set error variable - 8. (child) if error is set then return -1, else return 0 - 6. (parent - returning from wait) If child returned 0 then exit 0, - otherwise exit -1. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_count = 0; -int handler_error = 0; - -void handler(int signo) -{ - static int inside_handler = 0; - - printf("SIGINT caught\n"); - if (inside_handler) { - printf("Signal caught while inside handler\n"); - handler_error++; - exit(-1); - } - - inside_handler++; - handler_count++; - - if (handler_count == 1) { - printf("Raising SIGINT\n"); - raise(SIGINT); - printf("Returning from raising SIGINT\n"); - } - - inside_handler--; -} - -int main() -{ - if (fork() == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGINT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_error) - return PTS_UNRESOLVED; - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WEXITSTATUS(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-1.c deleted file mode 100644 index 8f8d69670a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-1.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGABRT with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGABRT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGABRT */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-10.c deleted file mode 100644 index 6e582d95ed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-10.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGPIPE with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPIPE - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPIPE */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-11.c deleted file mode 100644 index d014f03028..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-11.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGQUIT with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGQUIT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGQUIT */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-12.c deleted file mode 100644 index 7407a19392..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-12.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGSEGV with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGSEGV - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGSEGV */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-13.c deleted file mode 100644 index e4e4f23a1f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-13.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGTERM with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTERM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTERM */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-14.c deleted file mode 100644 index 6c4bcebb31..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-14.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGTSTP with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTSTP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTSTP */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-15.c deleted file mode 100644 index 3630027072..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-15.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGTTIN with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTTIN - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTTIN */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-16.c deleted file mode 100644 index 051cb07095..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-16.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGTTOU with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTTOU - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTTOU */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-17.c deleted file mode 100644 index 446de910d3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-17.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGUSR1 with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGUSR1 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGUSR1 */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-18.c deleted file mode 100644 index ecbd3fbc09..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-18.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGUSR2 with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGUSR2 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGUSR2 */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-19.c deleted file mode 100644 index 6a46b9916a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-19.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGPOLL with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPOLL - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPOLL */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-2.c deleted file mode 100644 index c54455eea4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-2.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGALRM with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGALRM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGALRM */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-20.c deleted file mode 100644 index 92dc46f346..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-20.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGPROF with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGPROF - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGPROF */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-21.c deleted file mode 100644 index 0b4089438a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-21.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGSYS with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGSYS - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGSYS */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-22.c deleted file mode 100644 index b57aa7eb48..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-22.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGTRAP with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGTRAP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGTRAP */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-23.c deleted file mode 100644 index 2cfab0b470..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-23.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGURG with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGURG - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGURG */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-24.c deleted file mode 100644 index e46748988d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-24.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGVTALRM with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGVTALRM - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGVTALRM */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-25.c deleted file mode 100644 index b44c1f4cc3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-25.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGXCPU with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGXCPU - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGXCPU */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-26.c deleted file mode 100644 index 1d44fde6f3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-26.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGXFSZ with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGXFSZ - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGXFSZ */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-3.c deleted file mode 100644 index 5cb047d995..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-3.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGBUS with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGBUS - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGBUS */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-4.c deleted file mode 100644 index 428d1beb53..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-4.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGCHLD with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGCHLD - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGCHLD */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-5.c deleted file mode 100644 index fe02d4eae8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-5.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGCONT with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGCONT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGCONT */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-6.c deleted file mode 100644 index 2710580f3d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-6.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGFPE with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGFPE - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGFPE */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-7.c deleted file mode 100644 index 8ae011a9aa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-7.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGHUP with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGHUP - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGHUP */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-8.c deleted file mode 100644 index 7bb83cc00f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-8.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGILL with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGILL - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGILL */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-9.c deleted file mode 100644 index 414c768021..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/28-9.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - -* The steps are: -* -> register a signal handler for SIGINT with signal(). -* -> check this signal handler works. -* -> change the signal handler with sigaction, saving old handler in oact. -* -> check the new signal handler works. -* -> set the old signal handler back -* -> check the old signal handler still works. - -* The test fails if a signal handler does not work as expected. -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ -#include "posixtest.h" -#include -#include - -#ifdef __GNUC__ /* We are using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - -#define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - -#define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - -#define PASSED \ - output_fini(); \ - exit(PTS_PASS); - -#define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif -void output_init() -{ - /* do nothing */ - return ; -} - -void output( char * string, ... ) -{ - va_list ap; -#ifndef PLOT_OUTPUT - char *ts = "[??:??:??]"; - - struct tm * now; - time_t nw; -#endif - -#ifndef PLOT_OUTPUT - nw = time( NULL ); - now = localtime( &nw ); - - if ( now == NULL ) - printf( ts ); - else - printf( "[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec ); - -#endif - va_start( ap, string ); - - vprintf( string, ap ); - - va_end( ap ); - -} - -void output_fini() -{ - /*do nothing */ - return ; -} - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIGNAL SIGINT - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t called = 1; - -void handler_1( int sig ) -{ - called++; -} - -void handler_2( int sig ) -{ - called--; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa, save; - - /* Initialize output */ - output_init(); - - /* Register the signal handler with signal */ - - if ( SIG_ERR == signal( SIGNAL, handler_1 ) ) - { - UNRESOLVED( errno, "Failed to register signal handler with signal()" ); - } - - /* As whether signal handler is restored to default when executed - is implementation defined, we cannot check it was registered here. */ - - /* Set the new signal handler with sigaction*/ - sa.sa_flags = 0; - - sa.sa_handler = handler_2; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGINT */ - ret = sigaction( SIGNAL, &sa, &save ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 0 ) - { - FAILED( "handler not executed" ); - } - - /* Restore the first signal handler */ - ret = sigaction( SIGNAL, &save, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Check the signal handler has been set up */ - ret = raise( SIGNAL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret , "Failed to raise the signal" ); - } - - if ( called != 1 ) - { - FAILED( "handler not executed" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/29-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/29-1.c deleted file mode 100644 index f7c44c4c7a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/29-1.c +++ /dev/null @@ -1,221 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* If SA_SIGINFO is set and realtime signals extension is supported, queueable -* signals generated by sigqueue or some other functions are delivered in FIFO -* order. - -* The steps are: -* -> Test for RTS extension support -* -> install a handler for SIGRTMAX signal with SA_SIGINFO set. -* -> Mask this signal -* -> Generate the signal several imes with sigqueue and known user values. -* -> unmask the signal -* -> check that the signals are delivered in order. - -* The test fails if the signals are not delivered in FIFO order. -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/* This test uses some XSI features */ -//#define _XOPEN_SOURCE 600 - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define QUEUELENGTH 10 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -sig_atomic_t latest = 0; - -void handler( int sig, siginfo_t *info, void *context ) -{ - if ( info->si_signo != SIGRTMAX ) - { - output( "Received unexpected signal %d\n", info->si_signo ); - } - else - { - latest++; - - if ( latest != info->si_value.sival_int ) - { - output( "Got signal %d, expected %d!\n", info->si_value.sival_int, latest ); - FAILED( "Wrong signal delivered -- no FIFO order?" ); - } - } -} - -/* main function */ -int main() -{ - int ret; - long rts; - - struct sigaction sa; - union sigval sv; - sigset_t mask; - - /* Initialize output */ - output_init(); - - /* Test the RTS extension */ - rts = sysconf( _SC_REALTIME_SIGNALS ); - - if ( rts < 0L ) - { - UNTESTED( "This test needs the RTS extension" ); - } - - /* Set the signal handler */ - sa.sa_flags = SA_SIGINFO; - - sa.sa_sigaction = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGRTMAX */ - ret = sigaction( SIGRTMAX, &sa, 0 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set signal handler" ); - } - - /* Mask this signal */ - ret = sigemptyset( &mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "An error occured while initializing mask" ); - } - - ret = sigaddset( &mask, SIGRTMAX ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to add SIGRTMAX to signal set" ); - } - - ret = sigprocmask( SIG_BLOCK, &mask, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set process signal mask" ); - } - - /* Now queue the signal to be pending */ - - for ( sv.sival_int = 1; sv.sival_int <= QUEUELENGTH; sv.sival_int++ ) - { - ret = sigqueue( getpid(), SIGRTMAX, sv ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to queue the signal" ); - } - } - - if ( latest != 0 ) - { - FAILED( "Signal was delivered while masked??" ); - } - - /* And finally unmask the signal so it is delivered */ - ret = sigprocmask( SIG_UNBLOCK, &mask, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to set process signal mask" ); - } - - sched_yield(); - - /* Check the signal has been delivered as expected */ - - if ( latest != QUEUELENGTH ) - { - output( "Only %d signal delivered instead of %d\n", latest, QUEUELENGTH ); - - if ( latest == 1 ) - { - UNTESTED( "It seems like SIGRTMAX is not a queuable signal here?" ); - } - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-1.c deleted file mode 100644 index 397430dde7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGABRT to handler - 3. Call sigaction with a null act - 4. raise SIGABRT - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGABRT, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-10.c deleted file mode 100644 index 04720367b7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-10.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGPIPE to handler - 3. Call sigaction with a null act - 4. raise SIGPIPE - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGPIPE, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGPIPE) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-11.c deleted file mode 100644 index dd96f10a3c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-11.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGQUIT to handler - 3. Call sigaction with a null act - 4. raise SIGQUIT - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGQUIT, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGQUIT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-12.c deleted file mode 100644 index 8a3932ed44..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-12.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGSEGV to handler - 3. Call sigaction with a null act - 4. raise SIGSEGV - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGSEGV, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGSEGV) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-13.c deleted file mode 100644 index 0fcebacf4d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-13.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGTERM to handler - 3. Call sigaction with a null act - 4. raise SIGTERM - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGTERM, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGTERM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-14.c deleted file mode 100644 index 01216e5370..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-14.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGTSTP to handler - 3. Call sigaction with a null act - 4. raise SIGTSTP - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGTSTP, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGTSTP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-15.c deleted file mode 100644 index 5bd3158719..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-15.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGTTIN to handler - 3. Call sigaction with a null act - 4. raise SIGTTIN - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGTTIN, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGTTIN) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-16.c deleted file mode 100644 index 136cb89211..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-16.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGTTOU to handler - 3. Call sigaction with a null act - 4. raise SIGTTOU - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGTTOU, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGTTOU) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-17.c deleted file mode 100644 index 6f8f058988..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-17.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGUSR1 to handler - 3. Call sigaction with a null act - 4. raise SIGUSR1 - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGUSR1, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGUSR1) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-18.c deleted file mode 100644 index 0f212cafe0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-18.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGUSR2 to handler - 3. Call sigaction with a null act - 4. raise SIGUSR2 - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGUSR2, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGUSR2) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-19.c deleted file mode 100644 index 3329366c26..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-19.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGPOLL to handler - 3. Call sigaction with a null act - 4. raise SIGPOLL - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGPOLL, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGPOLL) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-2.c deleted file mode 100644 index 9f3c2eb14a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-2.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGALRM to handler - 3. Call sigaction with a null act - 4. raise SIGALRM - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGALRM, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-20.c deleted file mode 100644 index be774bc8f7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-20.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGPROF to handler - 3. Call sigaction with a null act - 4. raise SIGPROF - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGPROF, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGPROF) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-21.c deleted file mode 100644 index adf07573e4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-21.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGSYS to handler - 3. Call sigaction with a null act - 4. raise SIGSYS - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGSYS, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGSYS) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-22.c deleted file mode 100644 index 0e2909b213..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-22.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGTRAP to handler - 3. Call sigaction with a null act - 4. raise SIGTRAP - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGTRAP, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGTRAP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-23.c deleted file mode 100644 index e84ab71ed8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-23.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGURG to handler - 3. Call sigaction with a null act - 4. raise SIGURG - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGURG, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGURG) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-24.c deleted file mode 100644 index e4f1fe08bb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-24.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGVTALRM to handler - 3. Call sigaction with a null act - 4. raise SIGVTALRM - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGVTALRM, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGVTALRM) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-25.c deleted file mode 100644 index 92eb375141..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-25.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGXCPU to handler - 3. Call sigaction with a null act - 4. raise SIGXCPU - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGXCPU, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGXCPU) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-26.c deleted file mode 100644 index eb5b6d997c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-26.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGXFSZ to handler - 3. Call sigaction with a null act - 4. raise SIGXFSZ - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGXFSZ, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGXFSZ) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-3.c deleted file mode 100644 index e47e2bbc8f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-3.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGBUS to handler - 3. Call sigaction with a null act - 4. raise SIGBUS - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGBUS, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGBUS) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-4.c deleted file mode 100644 index cf4486ba7d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-4.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGCHLD to handler - 3. Call sigaction with a null act - 4. raise SIGCHLD - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGCHLD, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGCHLD) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-5.c deleted file mode 100644 index c871b92b2a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-5.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGCONT to handler - 3. Call sigaction with a null act - 4. raise SIGCONT - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGCONT, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGCONT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-6.c deleted file mode 100644 index 3258dc17f5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-6.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGFPE to handler - 3. Call sigaction with a null act - 4. raise SIGFPE - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGFPE, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGFPE) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-7.c deleted file mode 100644 index b187a2f7f4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-7.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGHUP to handler - 3. Call sigaction with a null act - 4. raise SIGHUP - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGHUP, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGHUP) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-8.c deleted file mode 100644 index 538256263e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-8.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGILL to handler - 3. Call sigaction with a null act - 4. raise SIGILL - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGILL, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGILL) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-9.c deleted file mode 100644 index e29bd02c4b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/3-9.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #3 of the sigaction system call that shows - calling sigaction with a null act argument does not change the - signal handler. - - Steps: - 1. Initialize global variable to indicate handler has not been called - 2. Set the signal handler for SIGINT to handler - 3. Call sigaction with a null act - 4. raise SIGINT - 5. Verify handler was called. -*/ - -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - struct sigaction oact; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (sigaction(SIGINT, 0, &oact) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGINT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/30-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/30-1.c deleted file mode 100644 index 7cf01457b7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/30-1.c +++ /dev/null @@ -1,221 +0,0 @@ -/* -* Copyright (c) 2005, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* 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., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertions: -* -* sigaction returns -1 and errno is set to EINVAL if signal number is invalid -* or an attempt to do an operation which is not allowed is made. - - -* The steps are: -* -> Try setting a signal handler for signal SIGRTMAX + 1 -* -> Try setting a signal handler for SIGKILL -* -> Try setting a signal handler for SIGSTOP -* -> Try ignoring SIGSTOP -* -> Try ignoring SIGKILL - - -* The test fails if the signals are not delivered in FIFO order. -*/ - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/******************************************************************************/ -/*************************** standard includes ********************************/ -/******************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include -#include - -/******************************************************************************/ -/*************************** Test framework *******************************/ -/******************************************************************************/ -#include "testfrmw.h" -#include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int - * (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/******************************************************************************/ -/**************************** Configuration ***********************************/ -/******************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define SIG_INVALID SIGRTMAX+10 - -/******************************************************************************/ -/*************************** Test case ***********************************/ -/******************************************************************************/ - -void handler( int signo ) -{ - return ; -} - -/* main function */ -int main() -{ - int ret; - - struct sigaction sa; - - /* Initialize output */ - output_init(); - - /* Set the signal handler */ - sa.sa_flags = 0; - - sa.sa_handler = handler; - - ret = sigemptyset( &sa.sa_mask ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to empty signal set" ); - } - - /* Install the signal handler for SIGRTMAX */ -#if VERBOSE > 0 - output( "Trying to catch invalid signal %d\n", SIG_INVALID ); - -#endif - ret = sigaction( SIG_INVALID, &sa, 0 ); - - if ( ret == 0 ) - { - output( "Is signal %d valid on this implementation?\n", SIG_INVALID ); - FAILED( "Setting handler for invalid signal did not fail" ); - } - - if ( errno != EINVAL ) - { - output( "Got error %d (%s) instead of %d (%s)\n", - errno, strerror( errno ), EINVAL, strerror( EINVAL ) ); - FAILED( "Wrong error code returned" ); - } - - /* Install the signal handler for SIGKILL */ -#if VERBOSE > 0 - output( "Trying to catch unauthorized signal SIGKILL (%d)\n", SIGKILL ); - -#endif - ret = sigaction( SIGKILL, &sa, 0 ); - - if ( ret == 0 ) - { - FAILED( "Setting handler for SIGKILL did not fail" ); - } - - if ( errno != EINVAL ) - { - output( "Got error %d (%s) instead of %d (%s)\n", - errno, strerror( errno ), EINVAL, strerror( EINVAL ) ); - FAILED( "Wrong error code returned" ); - } - - /* Install the signal handler for SIGSTOP */ -#if VERBOSE > 0 - output( "Trying to catch unauthorized signal SIGSTOP (%d)\n", SIGSTOP ); - -#endif - ret = sigaction( SIGSTOP, &sa, 0 ); - - if ( ret == 0 ) - { - FAILED( "Setting handler for SIGSTOP did not fail" ); - } - - if ( errno != EINVAL ) - { - output( "Got error %d (%s) instead of %d (%s)\n", - errno, strerror( errno ), EINVAL, strerror( EINVAL ) ); - FAILED( "Wrong error code returned" ); - } - - sa.sa_handler = SIG_IGN; - - /* Ingrore SIGKILL */ -#if VERBOSE > 0 - output( "Trying to ignore unauthorized signal SIGKILL (%d)\n", SIGKILL ); - -#endif - ret = sigaction( SIGKILL, &sa, 0 ); - - if ( ret == 0 ) - { - FAILED( "Ignoring SIGKILL did not fail" ); - } - - if ( errno != EINVAL ) - { - output( "Got error %d (%s) instead of %d (%s)\n", - errno, strerror( errno ), EINVAL, strerror( EINVAL ) ); - FAILED( "Wrong error code returned" ); - } - - /* Ignore SIGSTOP */ -#if VERBOSE > 0 - output( "Trying to ignore unauthorized signal SIGSTOP (%d)\n", SIGSTOP ); - -#endif - ret = sigaction( SIGSTOP, &sa, 0 ); - - if ( ret == 0 ) - { - FAILED( "Ignoring SIGSTOP did not fail" ); - } - - if ( errno != EINVAL ) - { - output( "Got error %d (%s) instead of %d (%s)\n", - errno, strerror( errno ), EINVAL, strerror( EINVAL ) ); - FAILED( "Wrong error code returned" ); - } - - /* Test passed */ -#if VERBOSE > 0 - - output( "Test passed\n" ); - -#endif - - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-1.c deleted file mode 100644 index 930503e028..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-1.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGABRT with SIGKILL added to - the signal mask - 4. (child) raise SIGABRT - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-10.c deleted file mode 100644 index ba5a94fdc4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-10.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPIPE with SIGKILL added to - the signal mask - 4. (child) raise SIGPIPE - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGPIPE) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-100.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-100.c deleted file mode 100644 index a488aac73d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-100.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGTRAP will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTRAP, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-101.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-101.c deleted file mode 100644 index 4aea196373..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-101.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGURG will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGURG, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-102.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-102.c deleted file mode 100644 index cdae1f290d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-102.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGVTALRM will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-103.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-103.c deleted file mode 100644 index d934e968b4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-103.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGXCPU will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGXCPU, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-104.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-104.c deleted file mode 100644 index ae5783cb17..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-104.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGXFSZ will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-11.c deleted file mode 100644 index 32d583bb0b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-11.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGQUIT with SIGKILL added to - the signal mask - 4. (child) raise SIGQUIT - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGQUIT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-12.c deleted file mode 100644 index 734b86e008..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-12.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGSEGV with SIGKILL added to - the signal mask - 4. (child) raise SIGSEGV - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGSEGV) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-13.c deleted file mode 100644 index 8ebac93bee..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-13.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTERM with SIGKILL added to - the signal mask - 4. (child) raise SIGTERM - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGTERM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-14.c deleted file mode 100644 index 7f54fcfe81..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-14.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTSTP with SIGKILL added to - the signal mask - 4. (child) raise SIGTSTP - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGTSTP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-15.c deleted file mode 100644 index 2e27216b94..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-15.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTTIN with SIGKILL added to - the signal mask - 4. (child) raise SIGTTIN - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGTTIN) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-16.c deleted file mode 100644 index 0cb10f754a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-16.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTTOU with SIGKILL added to - the signal mask - 4. (child) raise SIGTTOU - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGTTOU) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-17.c deleted file mode 100644 index 4021e51ccf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-17.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGUSR1 with SIGKILL added to - the signal mask - 4. (child) raise SIGUSR1 - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGUSR1) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-18.c deleted file mode 100644 index abf2154b49..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-18.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGUSR2 with SIGKILL added to - the signal mask - 4. (child) raise SIGUSR2 - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGUSR2) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-19.c deleted file mode 100644 index a02efff6d1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-19.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPOLL with SIGKILL added to - the signal mask - 4. (child) raise SIGPOLL - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGPOLL) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-2.c deleted file mode 100644 index 6604f71948..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-2.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGALRM with SIGKILL added to - the signal mask - 4. (child) raise SIGALRM - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-20.c deleted file mode 100644 index 35d7f79374..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-20.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPROF with SIGKILL added to - the signal mask - 4. (child) raise SIGPROF - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGPROF) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-21.c deleted file mode 100644 index 7b7e6e630c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-21.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGSYS with SIGKILL added to - the signal mask - 4. (child) raise SIGSYS - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGSYS) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-22.c deleted file mode 100644 index 3edbcba3af..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-22.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTRAP with SIGKILL added to - the signal mask - 4. (child) raise SIGTRAP - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGTRAP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-23.c deleted file mode 100644 index 821c7a0cfd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-23.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGURG with SIGKILL added to - the signal mask - 4. (child) raise SIGURG - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGURG) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-24.c deleted file mode 100644 index c2626ca72f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-24.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGVTALRM with SIGKILL added to - the signal mask - 4. (child) raise SIGVTALRM - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGVTALRM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-25.c deleted file mode 100644 index 8be23ae74e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-25.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGXCPU with SIGKILL added to - the signal mask - 4. (child) raise SIGXCPU - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGXCPU) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-26.c deleted file mode 100644 index a95afb7c9e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-26.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGXFSZ with SIGKILL added to - the signal mask - 4. (child) raise SIGXFSZ - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGXFSZ) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-27.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-27.c deleted file mode 100644 index 9dd9a90e76..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-27.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGABRT with SIGSTOP added to - the signal mask - 4. (child) raise SIGABRT - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-28.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-28.c deleted file mode 100644 index e430675509..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-28.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGALRM with SIGSTOP added to - the signal mask - 4. (child) raise SIGALRM - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-29.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-29.c deleted file mode 100644 index 28e86e192e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-29.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGBUS with SIGSTOP added to - the signal mask - 4. (child) raise SIGBUS - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGBUS) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-3.c deleted file mode 100644 index e1e7bfe6e2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-3.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGBUS with SIGKILL added to - the signal mask - 4. (child) raise SIGBUS - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGBUS) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-30.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-30.c deleted file mode 100644 index dcc9dcae51..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-30.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGCHLD with SIGSTOP added to - the signal mask - 4. (child) raise SIGCHLD - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCHLD) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-31.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-31.c deleted file mode 100644 index eeb65dc4d2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-31.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGCONT with SIGSTOP added to - the signal mask - 4. (child) raise SIGCONT - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCONT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-32.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-32.c deleted file mode 100644 index f138993d9f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-32.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGFPE with SIGSTOP added to - the signal mask - 4. (child) raise SIGFPE - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGFPE) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-33.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-33.c deleted file mode 100644 index 08775bb3e5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-33.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGHUP with SIGSTOP added to - the signal mask - 4. (child) raise SIGHUP - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGHUP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-34.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-34.c deleted file mode 100644 index ff2b77c5c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-34.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGILL with SIGSTOP added to - the signal mask - 4. (child) raise SIGILL - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGILL) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-35.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-35.c deleted file mode 100644 index 1461126379..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-35.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGINT with SIGSTOP added to - the signal mask - 4. (child) raise SIGINT - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGINT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-36.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-36.c deleted file mode 100644 index 9871d7dcc3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-36.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPIPE with SIGSTOP added to - the signal mask - 4. (child) raise SIGPIPE - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPIPE) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-37.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-37.c deleted file mode 100644 index c08f2b115e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-37.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGQUIT with SIGSTOP added to - the signal mask - 4. (child) raise SIGQUIT - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGQUIT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-38.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-38.c deleted file mode 100644 index 231cb200ac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-38.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGSEGV with SIGSTOP added to - the signal mask - 4. (child) raise SIGSEGV - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSEGV) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-39.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-39.c deleted file mode 100644 index f286729ddc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-39.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTERM with SIGSTOP added to - the signal mask - 4. (child) raise SIGTERM - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTERM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-4.c deleted file mode 100644 index c09accb4a8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-4.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGCHLD with SIGKILL added to - the signal mask - 4. (child) raise SIGCHLD - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGCHLD) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-40.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-40.c deleted file mode 100644 index 8058ab3d5b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-40.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTSTP with SIGSTOP added to - the signal mask - 4. (child) raise SIGTSTP - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTSTP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-41.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-41.c deleted file mode 100644 index 92de6036f6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-41.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTTIN with SIGSTOP added to - the signal mask - 4. (child) raise SIGTTIN - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTIN) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-42.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-42.c deleted file mode 100644 index c7768a0027..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-42.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTTOU with SIGSTOP added to - the signal mask - 4. (child) raise SIGTTOU - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTOU) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-43.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-43.c deleted file mode 100644 index bef8a7744f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-43.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGUSR1 with SIGSTOP added to - the signal mask - 4. (child) raise SIGUSR1 - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR1) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-44.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-44.c deleted file mode 100644 index e91008ea06..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-44.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGUSR2 with SIGSTOP added to - the signal mask - 4. (child) raise SIGUSR2 - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR2) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-45.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-45.c deleted file mode 100644 index 1a46c262ac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-45.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPOLL with SIGSTOP added to - the signal mask - 4. (child) raise SIGPOLL - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPOLL) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-46.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-46.c deleted file mode 100644 index b80499d261..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-46.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGPROF with SIGSTOP added to - the signal mask - 4. (child) raise SIGPROF - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPROF) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-47.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-47.c deleted file mode 100644 index 1b10d2c79f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-47.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGSYS with SIGSTOP added to - the signal mask - 4. (child) raise SIGSYS - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSYS) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-48.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-48.c deleted file mode 100644 index b1c7b9b156..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-48.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGTRAP with SIGSTOP added to - the signal mask - 4. (child) raise SIGTRAP - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTRAP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-49.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-49.c deleted file mode 100644 index 7b87f74a87..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-49.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGURG with SIGSTOP added to - the signal mask - 4. (child) raise SIGURG - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGURG) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-5.c deleted file mode 100644 index 3db11f699d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-5.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGCONT with SIGKILL added to - the signal mask - 4. (child) raise SIGCONT - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGCONT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-50.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-50.c deleted file mode 100644 index e538f36879..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-50.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGVTALRM with SIGSTOP added to - the signal mask - 4. (child) raise SIGVTALRM - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGVTALRM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-51.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-51.c deleted file mode 100644 index 2dc1f2d3d7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-51.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGXCPU with SIGSTOP added to - the signal mask - 4. (child) raise SIGXCPU - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXCPU) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-52.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-52.c deleted file mode 100644 index 40ee2932ed..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-52.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGXFSZ with SIGSTOP added to - the signal mask - 4. (child) raise SIGXFSZ - 5. (child, signal handler) raise SIGSTOP - 5. (child) If still around then return -1 - 6. (parent - returning from wait) If child was stopped then return - kill the child and return success, otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - printf("About to stop child\n"); - raise(SIGSTOP); - printf("Child has continued\n"); - exit(0); -} - -int main() -{ - pid_t pid; - if ((pid = fork()) == 0) { - /* child */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXFSZ) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_UNRESOLVED; - } else { - int s; - - /* parent */ - if (waitpid(pid, &s, WUNTRACED) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (WIFSTOPPED(s)) { - printf("Test PASSED\n"); - kill(pid, SIGKILL); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-53.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-53.c deleted file mode 100644 index f5644869e7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-53.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGABRT will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGABRT, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-54.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-54.c deleted file mode 100644 index 70eae15d15..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-54.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGALRM will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGALRM, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-55.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-55.c deleted file mode 100644 index 6575a19d2f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-55.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGBUS will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGBUS, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-56.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-56.c deleted file mode 100644 index 02909cccba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-56.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGCHLD will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGCHLD, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-57.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-57.c deleted file mode 100644 index 3037f1dfd6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-57.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGCONT will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGCONT, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-58.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-58.c deleted file mode 100644 index 446b362ec8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-58.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGFPE will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGFPE, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-59.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-59.c deleted file mode 100644 index 0e98f02b47..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-59.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGHUP will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGHUP, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-6.c deleted file mode 100644 index b1aa0b08ac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-6.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGFPE with SIGKILL added to - the signal mask - 4. (child) raise SIGFPE - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGFPE) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-60.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-60.c deleted file mode 100644 index 201af6f218..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-60.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGILL will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGILL, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-61.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-61.c deleted file mode 100644 index 3573b4e5c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-61.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGINT will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGINT, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-62.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-62.c deleted file mode 100644 index 6e1f2d65eb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-62.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGPIPE will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGPIPE, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-63.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-63.c deleted file mode 100644 index fe9d934b6c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-63.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGQUIT will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGQUIT, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-64.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-64.c deleted file mode 100644 index 855e938e5f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-64.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGSEGV will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGSEGV, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-65.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-65.c deleted file mode 100644 index 81543d3285..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-65.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGTERM will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGTERM, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-66.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-66.c deleted file mode 100644 index 22c1879274..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-66.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGTSTP will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGTSTP, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-67.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-67.c deleted file mode 100644 index 446cf55097..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-67.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGTTIN will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGTTIN, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-68.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-68.c deleted file mode 100644 index 064879df6e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-68.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGTTOU will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGTTOU, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-69.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-69.c deleted file mode 100644 index 1741cda06d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-69.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGUSR1 will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGUSR1, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-7.c deleted file mode 100644 index a89451164d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-7.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGHUP with SIGKILL added to - the signal mask - 4. (child) raise SIGHUP - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGHUP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-70.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-70.c deleted file mode 100644 index 8fd99cc9b2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-70.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGUSR2 will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGUSR2, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-71.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-71.c deleted file mode 100644 index 433e49a570..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-71.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGPOLL will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGPOLL, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-72.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-72.c deleted file mode 100644 index f1a582f227..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-72.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGPROF will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGPROF, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-73.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-73.c deleted file mode 100644 index 7b0f184faa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-73.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGSYS will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGSYS, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-74.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-74.c deleted file mode 100644 index aa2033a9e0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-74.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGTRAP will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGTRAP, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-75.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-75.c deleted file mode 100644 index a0018ca7fe..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-75.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGURG will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGURG, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-76.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-76.c deleted file mode 100644 index d84dcabb88..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-76.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGVTALRM will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-77.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-77.c deleted file mode 100644 index f6105a203e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-77.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGXCPU will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGXCPU, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-78.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-78.c deleted file mode 100644 index 364c2a1529..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-78.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL to the signal mask of SIGXFSZ will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-79.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-79.c deleted file mode 100644 index 84834283c5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-79.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGABRT will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGABRT, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-8.c deleted file mode 100644 index 4b381cdb49..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-8.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGILL with SIGKILL added to - the signal mask - 4. (child) raise SIGILL - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGILL) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-80.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-80.c deleted file mode 100644 index 2fee0c0aa9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-80.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGALRM will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGALRM, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-81.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-81.c deleted file mode 100644 index cea69dfada..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-81.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGBUS will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGBUS, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-82.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-82.c deleted file mode 100644 index 6e6d03c500..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-82.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGCHLD will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGCHLD, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-83.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-83.c deleted file mode 100644 index 5fef2e73bd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-83.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGCONT will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGCONT, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-84.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-84.c deleted file mode 100644 index f36cc69371..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-84.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGFPE will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGFPE, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-85.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-85.c deleted file mode 100644 index 36f2e7ac27..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-85.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGHUP will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGHUP, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-86.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-86.c deleted file mode 100644 index 5f7d2e3ae4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-86.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGILL will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGILL, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-87.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-87.c deleted file mode 100644 index 062516cd0b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-87.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGINT will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGINT, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-88.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-88.c deleted file mode 100644 index c60f9d511f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-88.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGPIPE will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGPIPE, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-89.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-89.c deleted file mode 100644 index 0f9e9ee065..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-89.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGQUIT will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGQUIT, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-9.c deleted file mode 100644 index 570c861755..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-9.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGKILL can not be added to the signal mask - for a signal handler. - - Steps: - 1. Fork a new process - 2. (parent) wait for child - 3. (child) Setup a signal handler for SIGINT with SIGKILL added to - the signal mask - 4. (child) raise SIGINT - 5. (child, signal handler) raise SIGKILL - 5. (child) If still alive then exit -1 - 6. (parent - returning from wait) If child was killed then return success, - otherwise fail. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - raise(SIGKILL); - exit(0); -} - -int main() -{ - if (fork() == 0) { - /* child */ - - /* - * NOTE: This block of code will return 0 for error - * and anything else for success. - */ - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGKILL); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_PASS; - } - - if (raise(SIGINT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - } - - return PTS_PASS; - } else { - int s; - - /* parent */ - if (wait(&s) == -1) { - perror("Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (!WIFEXITED(s)) { - printf("Test PASSED\n"); - return PTS_PASS; - } - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-90.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-90.c deleted file mode 100644 index 5cac9caecf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-90.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGSEGV will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGSEGV, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-91.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-91.c deleted file mode 100644 index 8d5a36c3bf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-91.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGTERM will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTERM, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-92.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-92.c deleted file mode 100644 index 2670b4ef9c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-92.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGTSTP will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTSTP, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-93.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-93.c deleted file mode 100644 index 2ddd96d622..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-93.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGTTIN will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTTIN, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-94.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-94.c deleted file mode 100644 index 36ed8f0311..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-94.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGTTOU will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTTOU, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-95.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-95.c deleted file mode 100644 index c532a5459c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-95.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGUSR1 will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGUSR1, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-96.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-96.c deleted file mode 100644 index eac325a849..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-96.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGUSR2 will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGUSR2, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-97.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-97.c deleted file mode 100644 index 9daa3ea3b6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-97.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGPOLL will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGPOLL, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-98.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-98.c deleted file mode 100644 index 578f2d932b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-98.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGPROF will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGPROF, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-99.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-99.c deleted file mode 100644 index 8fa5fc1e20..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/4-99.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #4 of the sigaction system call that shows - that attempting to add SIGSTOP to the signal mask of SIGSYS will - not result in sigaction returning -1 -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ -} - -int main() -{ - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGSYS, &act, 0) == -1) { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-1.c deleted file mode 100644 index d6237cc168..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGABRT will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGABRT, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGABRT) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-10.c deleted file mode 100644 index 566ff6243b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-10.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGPIPE will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGPIPE, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPIPE) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-11.c deleted file mode 100644 index ee046636be..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-11.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGQUIT will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGQUIT, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGQUIT) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-12.c deleted file mode 100644 index 0bf607e51d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-12.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGSEGV will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGSEGV, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSEGV) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-13.c deleted file mode 100644 index 8f19dd9e38..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-13.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGTERM will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTERM, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTERM) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-14.c deleted file mode 100644 index 2485d54381..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-14.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGTSTP will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTSTP, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTSTP) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-15.c deleted file mode 100644 index 0b74c13212..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-15.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGTTIN will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTTIN, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTIN) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-16.c deleted file mode 100644 index 305c183f70..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-16.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGTTOU will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTTOU, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTTOU) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-17.c deleted file mode 100644 index 5aff5deb9e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-17.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGUSR1 will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGUSR1, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR1) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-18.c deleted file mode 100644 index 279bcfadf1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-18.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGUSR2 will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGUSR2, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGUSR2) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-19.c deleted file mode 100644 index d54bcf559f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-19.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGPOLL will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGPOLL, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPOLL) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-2.c deleted file mode 100644 index 3bfb714ff3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGALRM will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGALRM, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGALRM) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-20.c deleted file mode 100644 index 13331f9fa7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-20.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGPROF will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGPROF, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGPROF) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-21.c deleted file mode 100644 index 76c74e280c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-21.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGSYS will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGSYS, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGSYS) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-22.c deleted file mode 100644 index f76b63b88b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-22.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGTRAP will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGTRAP, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGTRAP) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-23.c deleted file mode 100644 index 80195a1faf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-23.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGURG will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGURG, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGURG) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-24.c deleted file mode 100644 index 68d806f99d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-24.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGVTALRM will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGVTALRM) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-25.c deleted file mode 100644 index bc6fb30746..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-25.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGXCPU will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGXCPU, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXCPU) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-26.c deleted file mode 100644 index 1e18792bfa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-26.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGXFSZ will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGXFSZ) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-3.c deleted file mode 100644 index be75773768..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-3.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGBUS will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGBUS, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGBUS) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-4.c deleted file mode 100644 index 35566cd696..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-4.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGCHLD will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGCHLD, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCHLD) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-5.c deleted file mode 100644 index 0ad61ab542..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-5.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGCONT will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGCONT, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGCONT) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-6.c deleted file mode 100644 index 0382a201f1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-6.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGFPE will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGFPE, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGFPE) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-7.c deleted file mode 100644 index 3f3e28d2a9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-7.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGHUP will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGHUP, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGHUP) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-8.c deleted file mode 100644 index 7e96f2cbdf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-8.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGILL will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGILL, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGILL) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-9.c deleted file mode 100644 index d3fe07b17e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/6-9.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #5 of the sigaction system call that verifies - setting the SA_INFO bit in the signal mask for SIGINT will result - in sa_sigaction identifying the signal-catching function. -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - handler_called = 1; -} - -int main() -{ - struct sigaction act; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSTOP); - if (sigaction(SIGINT, &act, 0) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (raise(SIGINT) == -1) { - printf("Unexpected error while attempting to setup test " - "pre-conditions\n"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("Test PASSED\n"); - return PTS_PASS; - } - - printf("Test FAILED\n"); - return PTS_FAIL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-1.c deleted file mode 100644 index b015a986d2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGXFSZ_count = 0; - -void SIGXFSZ_handler(int signo) -{ - SIGXFSZ_count++; - printf("Caught SIGXFSZ\n"); -} - -void SIGABRT_handler(int signo) -{ - printf("Caught SIGABRT\n"); - raise(SIGXFSZ); - if (SIGXFSZ_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGABRT_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGXFSZ); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGXFSZ_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-10.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-10.c deleted file mode 100644 index f0389782e4..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-10.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGINT_count = 0; - -void SIGINT_handler(int signo) -{ - SIGINT_count++; - printf("Caught SIGINT\n"); -} - -void SIGPIPE_handler(int signo) -{ - printf("Caught SIGPIPE\n"); - raise(SIGINT); - if (SIGINT_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGPIPE_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGINT); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGINT_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGPIPE) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-11.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-11.c deleted file mode 100644 index e1762cdb87..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-11.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGPIPE_count = 0; - -void SIGPIPE_handler(int signo) -{ - SIGPIPE_count++; - printf("Caught SIGPIPE\n"); -} - -void SIGQUIT_handler(int signo) -{ - printf("Caught SIGQUIT\n"); - raise(SIGPIPE); - if (SIGPIPE_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGQUIT_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGPIPE); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGPIPE_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPIPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGQUIT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-12.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-12.c deleted file mode 100644 index 395bb510b1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-12.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGQUIT_count = 0; - -void SIGQUIT_handler(int signo) -{ - SIGQUIT_count++; - printf("Caught SIGQUIT\n"); -} - -void SIGSEGV_handler(int signo) -{ - printf("Caught SIGSEGV\n"); - raise(SIGQUIT); - if (SIGQUIT_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGSEGV_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGQUIT); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGQUIT_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGQUIT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGSEGV) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-13.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-13.c deleted file mode 100644 index 2f09eb248a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-13.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGSEGV_count = 0; - -void SIGSEGV_handler(int signo) -{ - SIGSEGV_count++; - printf("Caught SIGSEGV\n"); -} - -void SIGTERM_handler(int signo) -{ - printf("Caught SIGTERM\n"); - raise(SIGSEGV); - if (SIGSEGV_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGTERM_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSEGV); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGSEGV_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSEGV, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGTERM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-14.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-14.c deleted file mode 100644 index d416a72ecb..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-14.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGTERM_count = 0; - -void SIGTERM_handler(int signo) -{ - SIGTERM_count++; - printf("Caught SIGTERM\n"); -} - -void SIGTSTP_handler(int signo) -{ - printf("Caught SIGTSTP\n"); - raise(SIGTERM); - if (SIGTERM_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGTSTP_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGTERM); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGTERM_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTERM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGTSTP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-15.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-15.c deleted file mode 100644 index c069a9d1d2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-15.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGTSTP_count = 0; - -void SIGTSTP_handler(int signo) -{ - SIGTSTP_count++; - printf("Caught SIGTSTP\n"); -} - -void SIGTTIN_handler(int signo) -{ - printf("Caught SIGTTIN\n"); - raise(SIGTSTP); - if (SIGTSTP_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGTTIN_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGTSTP); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGTSTP_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTSTP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGTTIN) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-16.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-16.c deleted file mode 100644 index 44eefca98f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-16.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGTTIN_count = 0; - -void SIGTTIN_handler(int signo) -{ - SIGTTIN_count++; - printf("Caught SIGTTIN\n"); -} - -void SIGTTOU_handler(int signo) -{ - printf("Caught SIGTTOU\n"); - raise(SIGTTIN); - if (SIGTTIN_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGTTOU_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGTTIN); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGTTIN_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTIN, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGTTOU) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-17.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-17.c deleted file mode 100644 index b12c9f6fd9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-17.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGTTOU_count = 0; - -void SIGTTOU_handler(int signo) -{ - SIGTTOU_count++; - printf("Caught SIGTTOU\n"); -} - -void SIGUSR1_handler(int signo) -{ - printf("Caught SIGUSR1\n"); - raise(SIGTTOU); - if (SIGTTOU_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGUSR1_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGTTOU); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGTTOU_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTTOU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGUSR1) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-18.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-18.c deleted file mode 100644 index 03fbc9e7ba..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-18.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGUSR1_count = 0; - -void SIGUSR1_handler(int signo) -{ - SIGUSR1_count++; - printf("Caught SIGUSR1\n"); -} - -void SIGUSR2_handler(int signo) -{ - printf("Caught SIGUSR2\n"); - raise(SIGUSR1); - if (SIGUSR1_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGUSR2_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGUSR1); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGUSR1_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGUSR2) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-19.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-19.c deleted file mode 100644 index 96991eb965..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-19.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGUSR2_count = 0; - -void SIGUSR2_handler(int signo) -{ - SIGUSR2_count++; - printf("Caught SIGUSR2\n"); -} - -void SIGPOLL_handler(int signo) -{ - printf("Caught SIGPOLL\n"); - raise(SIGUSR2); - if (SIGUSR2_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGPOLL_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGUSR2); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGUSR2_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGUSR2, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGPOLL) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-2.c deleted file mode 100644 index ca6d3d11cf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-2.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGABRT_count = 0; - -void SIGABRT_handler(int signo) -{ - SIGABRT_count++; - printf("Caught SIGABRT\n"); -} - -void SIGALRM_handler(int signo) -{ - printf("Caught SIGALRM\n"); - raise(SIGABRT); - if (SIGABRT_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGALRM_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGABRT); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGABRT_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGABRT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGALRM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-20.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-20.c deleted file mode 100644 index 8d9a9a3e42..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-20.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGPOLL_count = 0; - -void SIGPOLL_handler(int signo) -{ - SIGPOLL_count++; - printf("Caught SIGPOLL\n"); -} - -void SIGPROF_handler(int signo) -{ - printf("Caught SIGPROF\n"); - raise(SIGPOLL); - if (SIGPOLL_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGPROF_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGPOLL); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGPOLL_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPOLL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGPROF) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-21.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-21.c deleted file mode 100644 index 005ff33763..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-21.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGPROF_count = 0; - -void SIGPROF_handler(int signo) -{ - SIGPROF_count++; - printf("Caught SIGPROF\n"); -} - -void SIGSYS_handler(int signo) -{ - printf("Caught SIGSYS\n"); - raise(SIGPROF); - if (SIGPROF_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGSYS_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGPROF); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGPROF_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGPROF, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGSYS) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-22.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-22.c deleted file mode 100644 index 0c8ee4bfbe..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-22.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGSYS_count = 0; - -void SIGSYS_handler(int signo) -{ - SIGSYS_count++; - printf("Caught SIGSYS\n"); -} - -void SIGTRAP_handler(int signo) -{ - printf("Caught SIGTRAP\n"); - raise(SIGSYS); - if (SIGSYS_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGTRAP_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGSYS); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGSYS_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGSYS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGTRAP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-23.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-23.c deleted file mode 100644 index e29f13b19a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-23.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGTRAP_count = 0; - -void SIGTRAP_handler(int signo) -{ - SIGTRAP_count++; - printf("Caught SIGTRAP\n"); -} - -void SIGURG_handler(int signo) -{ - printf("Caught SIGURG\n"); - raise(SIGTRAP); - if (SIGTRAP_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGURG_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGTRAP); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGTRAP_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGTRAP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGURG) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-24.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-24.c deleted file mode 100644 index 4b73137bb0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-24.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGURG_count = 0; - -void SIGURG_handler(int signo) -{ - SIGURG_count++; - printf("Caught SIGURG\n"); -} - -void SIGVTALRM_handler(int signo) -{ - printf("Caught SIGVTALRM\n"); - raise(SIGURG); - if (SIGURG_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGVTALRM_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGURG); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGURG_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGURG, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGVTALRM) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-25.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-25.c deleted file mode 100644 index c2efdef6ab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-25.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGVTALRM_count = 0; - -void SIGVTALRM_handler(int signo) -{ - SIGVTALRM_count++; - printf("Caught SIGVTALRM\n"); -} - -void SIGXCPU_handler(int signo) -{ - printf("Caught SIGXCPU\n"); - raise(SIGVTALRM); - if (SIGVTALRM_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGXCPU_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGVTALRM); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGVTALRM_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGVTALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGXCPU) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-26.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-26.c deleted file mode 100644 index d83bb80280..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-26.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGXCPU_count = 0; - -void SIGXCPU_handler(int signo) -{ - SIGXCPU_count++; - printf("Caught SIGXCPU\n"); -} - -void SIGXFSZ_handler(int signo) -{ - printf("Caught SIGXFSZ\n"); - raise(SIGXCPU); - if (SIGXCPU_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGXFSZ_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGXCPU); - if (sigaction(SIGXFSZ, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGXCPU_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGXCPU, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGXFSZ) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-3.c deleted file mode 100644 index ecd979129b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-3.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGALRM_count = 0; - -void SIGALRM_handler(int signo) -{ - SIGALRM_count++; - printf("Caught SIGALRM\n"); -} - -void SIGBUS_handler(int signo) -{ - printf("Caught SIGBUS\n"); - raise(SIGALRM); - if (SIGALRM_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGBUS_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGALRM); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGALRM_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGALRM, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGBUS) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-4.c deleted file mode 100644 index 672b411fc9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-4.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGBUS_count = 0; - -void SIGBUS_handler(int signo) -{ - SIGBUS_count++; - printf("Caught SIGBUS\n"); -} - -void SIGCHLD_handler(int signo) -{ - printf("Caught SIGCHLD\n"); - raise(SIGBUS); - if (SIGBUS_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGCHLD_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGBUS); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGBUS_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGBUS, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGCHLD) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-5.c deleted file mode 100644 index e9619c3728..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-5.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGCHLD_count = 0; - -void SIGCHLD_handler(int signo) -{ - SIGCHLD_count++; - printf("Caught SIGCHLD\n"); -} - -void SIGCONT_handler(int signo) -{ - printf("Caught SIGCONT\n"); - raise(SIGCHLD); - if (SIGCHLD_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGCONT_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGCHLD); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGCHLD_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCHLD, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGCONT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-6.c deleted file mode 100644 index a26cc25320..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-6.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGCONT_count = 0; - -void SIGCONT_handler(int signo) -{ - SIGCONT_count++; - printf("Caught SIGCONT\n"); -} - -void SIGFPE_handler(int signo) -{ - printf("Caught SIGFPE\n"); - raise(SIGCONT); - if (SIGCONT_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGFPE_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGCONT); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGCONT_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGCONT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGFPE) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-7.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-7.c deleted file mode 100644 index 6a97037f0c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-7.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGFPE_count = 0; - -void SIGFPE_handler(int signo) -{ - SIGFPE_count++; - printf("Caught SIGFPE\n"); -} - -void SIGHUP_handler(int signo) -{ - printf("Caught SIGHUP\n"); - raise(SIGFPE); - if (SIGFPE_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGHUP_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGFPE); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGFPE_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGFPE, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGHUP) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-8.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-8.c deleted file mode 100644 index 350cdd9ba5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-8.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGHUP_count = 0; - -void SIGHUP_handler(int signo) -{ - SIGHUP_count++; - printf("Caught SIGHUP\n"); -} - -void SIGILL_handler(int signo) -{ - printf("Caught SIGILL\n"); - raise(SIGHUP); - if (SIGHUP_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGILL_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGHUP); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGHUP_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGHUP, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGILL) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-9.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-9.c deleted file mode 100644 index 18382c57d9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/8-9.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: rusty.lynch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test case for assertion #8 of the sigaction system call that verifies - that if signals in the sa_mask (passed in the sigaction struct of the - sigaction function call) are added to the process signal mask during - execution of the signal-catching function. -*/ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int SIGILL_count = 0; - -void SIGILL_handler(int signo) -{ - SIGILL_count++; - printf("Caught SIGILL\n"); -} - -void SIGINT_handler(int signo) -{ - printf("Caught SIGINT\n"); - raise(SIGILL); - if (SIGILL_count) { - printf("Test FAILED\n"); - exit(-1); - } -} - -int main() -{ - struct sigaction act; - - act.sa_handler = SIGINT_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, SIGILL); - if (sigaction(SIGINT, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - act.sa_handler = SIGILL_handler; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - if (sigaction(SIGILL, &act, 0) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - if (raise(SIGINT) == -1) { - perror("Unexpected error while attempting to " - "setup test pre-conditions"); - return PTS_UNRESOLVED; - } - - - printf("Test PASSED\n"); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/9-1.c deleted file mode 100644 index 7d1af1c8e1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/9-1.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. - * Created by: Rusty.Lnch REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - Test assertion #9 by verifying that SIGCHLD signals are not sent when - the parent has setup a SIGCHLD signal handler with the SA_NOCLDSTOP flag set - * 12/18/02 - Adding in include of sys/time.h per - * rodrigc REMOVE-THIS AT attbi DOT com input that it needs - * to be included whenever the timeval struct is used. - * -*/ - - /* - * adam.li@intel.com: 2004-05-26: select should block child - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define NUMSTOPS 10 - -volatile int child_stopped = 0; - -void handler(int signo, siginfo_t *info, void *context) -{ - if (info && info->si_code == CLD_STOPPED) { - printf("Child has been stopped\n"); - child_stopped++; - } -} - - -int main() -{ - pid_t pid; - struct sigaction act; - struct timeval tv; - - act.sa_sigaction = handler; - act.sa_flags = SA_SIGINFO | SA_NOCLDSTOP; - sigemptyset(&act.sa_mask); - sigaction(SIGCHLD, &act, 0); - - if ((pid = fork()) == 0) { - /* child */ - /* wait forever, or until we are - interrupted by a signal */ - select(0, NULL, NULL, NULL, NULL); - return 0; - } else { - /* parent */ - int s; - int i; - - for (i = 0; i < NUMSTOPS; i++) { - printf("--> Sending SIGSTOP\n"); - kill(pid, SIGSTOP); - - /* - If we send a bunch of SIGSTOP/SIGCONT - signals one after the other then it is - perfectly OK for the OS to not send - the SIGSTOP/SIGCONT combination as an - optimization. - - I can't think of any POSIX method to determine - if a process has been stopped, so I'm - going to punt with a one second sleep and - assume the child process gets put to sleep - within that time period. This will be problem - when this test is run on a really stressed - system. (Although since we are sending multiple - SIGSTOP's then maybe in practice this will - cause any problems.) - */ - tv.tv_sec = 1; - tv.tv_usec = 0; - select(0, NULL, NULL, NULL, &tv); - - printf("--> Sending SIGCONT\n"); - kill(pid, SIGCONT); - } - - /* POSIX specifies default action to be abnormal termination */ - kill(pid, SIGHUP); - waitpid(pid, &s, 0); - } - - if (child_stopped == 0) { - printf("Test PASSED\n"); - return 0; - } - - printf("Test FAILED\n"); - return -1; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/README b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/README deleted file mode 100644 index 3ec09ff135..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/README +++ /dev/null @@ -1,20 +0,0 @@ -<< First, an explaination for the perl script and the stuff >> -<< in the template directoy >> - -I have added a cheezy perl script for generating a bunch of test cases -where I want to do the same simple operation on each signal. - -Templates are in the templates directory, and are of the form -template_ASSERTIONID-count.in - -gentest.pl will generate a ASSERTIONID-COUNT.c for each signal specified -in the POSIX definition of required signals where %%MYSIG%% is replaced -with the signal name. - -<< Misc thoughts >> - -* Assertion #5: Since almost all of the test cases in this directory assume - that this assertion is true, I haven't bothered adding - a test case that just test assertion #5. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/assertions.xml deleted file mode 100644 index ab36d7fb00..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/assertions.xml +++ /dev/null @@ -1,145 +0,0 @@ - - -If the argument "act" is not a null pointer, it points to a structure -specifying the action to be associated with the specified signal. - - -If the argument "oact" is not a null pointer, the action previously -associated with the signal is stored in the location pointed to by -the argument "oact". - - -If the argument "act" is a null pointer, signal handling is unchanged. - - -The SIGKILL and SIGSTOP signals shall not be added to the signal mask -using sigaction(), but will not result in sigaction reporting a failure. - - -If the SA_SIGINFO flag is cleared in the sa_flags field of the sigaction -structure, the sa_handler field indentifies the action to be associated -with the specified signal. - - -If the SA_SIGINFO flag is set in the sa_flags field, and the implementation -supports the Realtime Signals Extension option or the XSI Extension option, -the sa_sigaction field specifies a signal catching function. - - -If the SA_SIGINFO bit is cleared and the sa_handler field specifies a -signal catching function, or if the SA_SIGINFO bit is set, the sa_mask -field indentifies a set of signals that shall be added to the signal mask -of the thread before the signal-catching function is invoked. - - -If the sa_handler field specifies a signal-catching function, the sa_mask -field indentifies a set of signals that shall be added to the process' -signal mask before the signal-catching function is invoked. - - -If the SA_NOCLDSTOP bit is set in the sa_flags field when calling sigaction -on SIGCHLD, then the SIGCHLD signal will not be generated when children stop -or stopped children continue. - - -If sig is SIGCHLD and the SA_NOCLDSTOP flag is not set in sa_flags, and the -implementation supports the SIGCHLD signal, then a SIGCHLD signal shall be -generated for the calling process whenever any of its child processes -stop. - - -Not setting the SA_NOCLDSTOP flag on the SIGCHLD signal will result in a -SIGCHLD signal being generated for the parent process whenever any of it's -stopped children are continued. - - -If the SA_ONSTACK flag is set in sa_flags, and an alternate signal stack has -been declared with sigaltstack(), the signal shall be delivered to the calling -process on the stack. Otherwise, the signal shall be delivered on the current -stack. - - -If the SA_ONSTACK flag is not set in sa_flags, the signal shall be delivered -on the current stack. - - -If the SA_RESETHAND flag is set in sa_flags, then the disposition of the signal -shall be reset to SIG_DFL and the SA_SIGINFO flag shall be cleared on entry -to the signal handler. The routine behaves as if SA_NODEFER was also set. - - -If the SA_RESETHAND flag is not set in sa_flags, the disposition of the signal -shall not be modified on entry to the signal handler. - - -Interruptable functions (functions specified to fail with errno set to [EINTR] -when interrupted by a signal) shall restart and shall not fail with [EINTR] -if the SA_RESTART flag is set in sa_flags. - - -If the SA_RESTART flag is not set in sa_flags, then interruptable functions -will fail with with errno set to [EINTR]. - - -If the SA_SIGINFO flag is not set for a signal and the signal is caught then -the signal-catching function shall be entered as "void func(int signo);". - - -If the SA_SIGINFO flag is set for a signal and the signal is caught then -the signal -catching function shall be entered as -"void func(int signo, siginfo_t *info, void *context);" - - -If the SA_NOCLDWAIT flag is set and sig equals SIGCHLD, then child processes -of the calling process shall not be trasformed into zombie processes when -they terminate. - - -If a process has set the SA_NOCLDWAIT flag on SIGCHLD and subseqeunetly waits -for a its children, and the process has not unwaited-for children that were -trasformed into zombie processes, it shall block until all of its children -terminate, and wait(), waitid(), and waitpid() shall fail and set errno to -[ECHILD]. - - -If the SA_NODEFER flag is set for a signal and the signal is caught, the signal -shall not be added to the process' signal mask on entry to the signal handler -unless it is included in sa_mask. - - -If the SA_NODEFER flag is not set for a signal and the signal is caught, the -signal shall be added to the process' signal mask on entry to the signal -handler. - - -When a signal-catching function installed by sigaction() is entered, a new -signal mask is calculated and installed for the duration of the signal-catching -function (or until a call to either sigprocmask() or sigsuspend() is made.) - - -The new signal mask installed on entry to a signal-catching function installed -by sigaction shall be calculated as the union of the current signal mask -and the value of sa_mask for the signal being delivered (unless SA_NODEFER -or SA_RESETHAND is set) and then including the signal being delivered. - - -If and when the user's signal handler returns normally, the original signal -mask is restored. - - -If sigaction fails, no new signal handler is installed. - - -If the signal action was set with the signal() function, getting it into oact -then reinstalling it with act must be valid. - - -If SA_SIGINFO is set and realtime signals extension is supported, queueable -signals generated by sigqueue or some other functions are delivered in FIFO -order. - - -sigaction returns -1 and errno is set to EINVAL if signal number is invalid -or an attempt to do an operation which is not allowed is made. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/coverage.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/coverage.txt deleted file mode 100644 index c019831f23..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/coverage.txt +++ /dev/null @@ -1,29 +0,0 @@ -This document defines the coverage for function sigaction(). - -Assertion Covered? -1 YES -2 YES -3 YES -4 YES -5 NOT DONE YET -6 YES -7 NOT DONE YET -8 YES -9 YES -10 YES -11 NOT DONE YET -12 YES -13 YES -14 NOT DONE YET -15 NOT DONE YET -16 WON'T test. Not aware of any function that can easily be interrupted in the middle. -17 YES -18 NOT DONE YET -19 NOT DONE YET -20 NOT DONE YET -21 YES -22 YES -23 NOT DONE YET -24 NOT DONE YET -25 YES -26 NOT DONE YET diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/gentests.pl b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/gentests.pl deleted file mode 100755 index d76c24704a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigaction/gentests.pl +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright (c) 2002-2003, Intel Corporation. All rights reserved. -# Created by: rusty.lynch REMOVE-THIS AT intel DOT com -# This file is licensed under the GPL license. For the full content -# of this license, see the COPYING file at the top level of this -# source tree. - - - -my (@signals) = ("SIGABRT", "SIGALRM", "SIGBUS", "SIGCHLD", "SIGCONT", - "SIGFPE", "SIGHUP", "SIGILL", "SIGINT", "SIGPIPE", - "SIGQUIT", "SIGSEGV", "SIGTERM", "SIGTSTP", "SIGTTIN", - "SIGTTOU", "SIGUSR1", "SIGUSR2", "SIGPOLL", "SIGPROF", - "SIGSYS", "SIGTRAP", "SIGURG", "SIGVTALRM", "SIGXCPU", - "SIGXFSZ"); - -my (%testcases, $prev); - -$prev = "SIGALRM"; - -open (LIST, "ls ./templates/*.in|") or die "Could not get listing"; -while () { - my ($fname) = $_; - chomp $fname; - - if ($fname =~ /template_([0-9]*)-.*\.in/) { - my ($assertion) = $1; - - open (TEMPLATE, "$fname") or die "Could not open $fname"; - my (@t) =