xref: /aosp_15_r20/external/ltp/testcases/open_posix_testsuite/bin/run-posix-option-group-test.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1#! /bin/sh
2# Copyright (c) Linux Test Project, 2010-2022
3# Copyright (c) 2002, Intel Corporation. All rights reserved.
4# Created by:  julie.n.fleischer REMOVE-THIS AT intel DOT com
5# This file is licensed under the GPL license.  For the full content
6# of this license, see the COPYING file at the top level of this
7# source tree.
8#
9# Use to build and run tests for a specific area
10
11TESTPATH=""
12
13BASEDIR="$(dirname "$0")/../${TESTPATH}/conformance/interfaces"
14
15usage()
16{
17    cat <<EOF
18usage: $(basename "$0") [AIO|MEM|MSG|SEM|SIG|THR|TMR|TPS]
19
20Build and run the tests for POSIX area specified by the 3 letter tag
21in the POSIX spec
22
23EOF
24}
25
26run_option_group_tests()
27{
28	local list_of_tests
29
30	list_of_tests=`find $1 -name '*.run-test' | sort`
31
32	if [ -z "$list_of_tests" ]; then
33		echo ".run-test files not found under $1, have been the tests compiled?"
34		exit 1
35	fi
36
37	for test_script in $list_of_tests; do
38		(cd "$(dirname "$test_script")" && ./$(basename "$test_script"))
39	done
40}
41
42case $1 in
43AIO)
44	echo "Executing asynchronous I/O tests"
45	run_option_group_tests "$BASEDIR/aio_*"
46	run_option_group_tests "$BASEDIR/lio_listio"
47	;;
48SIG)
49	echo "Executing signals tests"
50	run_option_group_tests "$BASEDIR/sig*"
51	run_option_group_tests $BASEDIR/raise
52	run_option_group_tests $BASEDIR/kill
53	run_option_group_tests $BASEDIR/killpg
54	run_option_group_tests $BASEDIR/pthread_kill
55	run_option_group_tests $BASEDIR/pthread_sigmask
56	;;
57SEM)
58	echo "Executing semaphores tests"
59	run_option_group_tests "$BASEDIR/sem*"
60	;;
61THR)
62	echo "Executing threads tests"
63	run_option_group_tests "$BASEDIR/pthread_*"
64	;;
65TMR)
66	echo "Executing timers and clocks tests"
67	run_option_group_tests "$BASEDIR/time*"
68	run_option_group_tests "$BASEDIR/*time"
69	run_option_group_tests "$BASEDIR/clock*"
70	run_option_group_tests $BASEDIR/nanosleep
71	;;
72MSG)
73	echo "Executing message queues tests"
74	run_option_group_tests "$BASEDIR/mq_*"
75	;;
76TPS)
77	echo "Executing process and thread scheduling tests"
78	run_option_group_tests "$BASEDIR/*sched*"
79	;;
80MEM)
81	echo "Executing mapped, process and shared memory tests"
82	run_option_group_tests "$BASEDIR/m*lock*"
83	run_option_group_tests "$BASEDIR/m*map"
84	run_option_group_tests "$BASEDIR/shm_*"
85	;;
86*)
87	usage
88	exit 1
89	;;
90esac
91
92echo "****Tests Complete****"
93