History log of /external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e2d32e4c57b4a83841288c4010a653885fdb9606 12-Nov-2015 Jan Stancek <jstancek@redhat.com> open_posix_testsuite: add set_affinity_single()

Couple testcases rely on set_affinity(), to limit usage of CPUs
to a single one. However they hardcode CPU number to "0", which
is causing problems on systems where CPU0 is not available (for
example it's offline, etc.)

This patch adds set_affinity_single() (which sets affinity to
first single online CPU) and replaces all calls to set_affinity(0).

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
520f02a0cb9200cca5b837b78079be7e4727004b 29-Oct-2015 Cyril Hrubis <chrubis@suse.cz> include/affinity.h: define _GNU_SOURCE on Linux

Otherwise the affinity cannot be used.

This is better than setting _GNU_SOURCE in the testcases
unconditionally, the affinity.h header must be include first though.

Another option would be compiling the affinity function into object file
and linking it with testcases (which wouldn't need to expose the GNU
extensions in the testcases).

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
efddf81c171823091af8777b22e6386abc05a7ee 03-Oct-2013 Jan Stancek <jstancek@redhat.com> pthread_attr_setschedpolicy/2-1.c: bind threads to single CPU

To make sure that threads are blocked on mutex, bind all to single CPU.
Because they all use SCHED_FIFO policy with main thread having the lowest
priority, main will progress only after three created threads block on
mutex.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
a2b2b352c9af90c27b58a5e6bcc4dfb8022f3b1a 03-Oct-2013 Jan Stancek <jstancek@redhat.com> pthread_attr_setschedpolicy/2-1.c: fix race at thread startup

Test can hang during startup in following scenario:

main new thread
--------------------------------------------------+-------------------------------------
int create_thread(int prio, pthread_t * tid) |
... |
pthread_create(tid, &attr, thread_func, NULL);|
while (!thread_started) { |
| void *thread_func(void *data)
| thread_started = 1;
| pthread_cond_signal(&cond);
pthread_mutex_lock(&c_mutex); |
132: pthread_cond_wait(&cond, &c_mutex); |
|65: pthread_mutex_lock(&mutex);
|

(gdb) bt
#0 0x00007fd588808f6d in __lll_lock_wait () from /lib64/libpthread.so.0
#1 0x00007fd588804d31 in _L_lock_790 () from /lib64/libpthread.so.0
#2 0x00007fd588804c37 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3 0x0000000000400bba in thread_func (data=0x0) at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:65
#4 0x00007fd588802de3 in start_thread () from /lib64/libpthread.so.0
#5 0x00007fd5885300dd in clone () from /lib64/libc.so.6
(gdb) t 2
(gdb) bt
#0 0x00007fd5888066f5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000400d9b in create_thread (prio=5, tid=0x7fffdb562678) at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:132
#2 0x0000000000400e82 in main () at ../../../conformance/interfaces/pthread_attr_setschedpolicy/2-1.c:174

Fix this by using same c_mutex in thread_func for updating
thread_started and signalling cond.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
683835e0b151b3d0b7998cc15f0e615820b6d07f 03-Oct-2013 Jan Stancek <jstancek@redhat.com> pthread_attr_setschedpolicy/2-1.c: simplify error handling

Remove all gotos and if there's error in any of pthread
functions exit immediately.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
354ebb48db8e66a853a58379a4808d5dcd1ceac3 07-Dec-2012 Wanlong Gao <gaowanlong@cn.fujitsu.com> cleanup code indent

Cleanup the code indent using:

find . -name *.c -exec Lindent {} \;

It's really a big change, but can fix almost all of
the indent problem in C code, although we can't
ensure all of the changes are right, but the error
changes are really few.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
4548c6cf9bcdd96d8303caa4130ab638b61f8a30 19-Oct-2012 Wanlong Gao <gaowanlong@cn.fujitsu.com> Update FSF address

find . -type f -exec sed -i 's/675 Mass Ave, Cambridge, MA 02139, USA/51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA/g' {} \;
find . -type f -exec sed -i 's/59 Temple Place, Suite 330, Boston, MA 02111-1307 USA/51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA/g' {} \;

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
37550cf5a86c7ca7424a2a318dd64e550f13f5df 18-Oct-2012 Chris Dearman <chris@mips.com> Remove whitespace at end of line

This is a scripted change done using the following command:

find . -type d -name .git -prune -o \
-type f \! -name \*\~ \! -name .\#\* \
\! -name \*.gz \! -name \*.pdf \! -name \*.patch -print0 | \
xargs -0 sed -i -e 's/[\t ]*$//'

Signed-off-by: Chris Dearman <chris@mips.com>
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
de55e5ac14dc3e683117ae84bad34944fa7c38c6 19-Aug-2011 Cyril Hrubis <chrubis@suse.cz> Unify the test passed messages.

Some of the tests printed "Test PASS" and some "Test PASSED" let's unify
this on "Test PASSED".

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
789758169a47e9b2fb2314646ad9ec19016e08b1 25-May-2011 Peter W Morreale <pmorreale@novell.com> Add mutex test

Assertion 2 states that threads at different scheduling priorities will
obtain a mutex in priority order. Test that.

Signed-off-by: Peter W. Morreale <pmorreale@novell.com>
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c