head	1.2;
access;
symbols
	OPT_20031204:1.1.1.1 OPEN_POSIX_TESTSUITE:1.1.1;
locks; strict;
comment	@# @;


1.2
date	2004.01.01.11.31.05;	author mtm;	state Exp;
branches;
next	1.1;

1.1
date	2003.12.31.09.14.34;	author mtm;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2003.12.31.09.14.34;	author mtm;	state Exp;
branches;
next	;


desc
@@


1.2
log
@o FreeBSD find(1) does not have a -printf option (it's -print)
o specify -E switch to sed(1) when using Extended REs
@
text
@#! /bin/sh
# 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.

# Added FreeBSD compatibility changes by Craig Rodrigues
#
# $FreeBSD$

usage()
{
    cat <<EOF 
Usage: $(basename $0) [OPTIONs] DIRECTORY

Lists the tests (source/binary) available from the DIRECTORY directory
and down.

  --buildable     List only tests that require building
  --execs         List only tests that are executable
                  If you just want to build a test, but not run it,
                  do not include a main function into the .c file or
                  name it something including the "-buildonly" string.
  --fmake         Find functional makefiles.
  --smake         Find stress makefiles.
  --frun          Find functional run.sh files.
  --srun          Find stress run.sh files.
  --help          Show this help and exit

Filenames need to follow some standarized format for them to be picked
up by this tool. This might change in the future. So far, the ones
picked up are:

NUMBER-NUMBER.c     [requires compilation]
NUMBER-NUMBER.sh    [does not require compilation]
NUMBER-buildonly.c  [requires compilation]
NAME.sh             [does not require compilation]

Note that the [requires compilation] tags will mean that the actual
test name for TEST.c after compiling will be TEST. Currently it does
not support TESTs compiled from many different sources.

EOF
}

buildable="";
execs=""
print_execs=0

# Go through the cmd line options
while true
do
  case "$1" in
      "--buildable")
          buildable="( -name [0-9]*-*.c ! -name [0-9]*-[0-9]*.sh )";
          shift;
          ;;
      "--execs")
          print_execs=1;
          execs="( ( -name [0-9]*-[0-9]*.c -o -name [0-9]*-[0-9]*.sh ) -a ! -name *-buildonly* )";
          shift;
          ;;
      "--fmake")
          find functional/ -type f -maxdepth 2 -mindepth 2 -name "Makefile" -print
          exit 0;
          ;;
      "--frun")
          find functional/ -type f -maxdepth 2 -mindepth 2 -name "run.sh" -print
          exit 0;
          ;;
      "--smake")
          find stress/ -type f -maxdepth 2 -mindepth 2 -name "Makefile" -print
          exit 0;
          ;;
      "--srun")
          find stress/ -type f -maxdepth 2 -mindepth 2 -name "run.sh" -print
          exit 0;
          ;;
      "--help")
          usage;
          exit 0;
          ;; 
      --*)
          echo "Unknown option $1" 1>&2;
          usage 1>&2;
          exit 1;
          ;;
      *)
          break 2;
          ;;
  esac
done

# Need the DIRECTORY arg ...
if [ -z "$1" ]
then
    echo "Error: no root directory specified" 1>&2
    usage 1>&2;
    exit 1;
fi

# Simple version right now, just locate all:
WHERE="$1"

# Force something .c or .sh
# Avoid .o, backups
# IF --execs, force it has no "-buildonly"
# If --buildable, remove the .sh files
find "$WHERE" -type f \
    \( \
       \( -name "[0-9]*-*.c" -o -name "[0-9]*-[0-9]*.sh" \) \
       ! -name \*.o ! -name \*~ \
    \) \
    $buildable $execs \
    | if [ $print_execs -eq 1 ]
        then
	    # Will not deal with the speculative directory automatically
            sed -E 's/\.(c|sh)$/\.test/g' | grep -v speculative
        else
            cat
        fi


@


1.1
log
@Initial revision
@
text
@d9 2
d65 1
a65 1
          find functional/ -type f -maxdepth 2 -mindepth 2 -name "Makefile" -printf "%h\n"
d69 1
a69 1
          find functional/ -type f -maxdepth 2 -mindepth 2 -name "run.sh" -printf "%h\n"
d73 1
a73 1
          find stress/ -type f -maxdepth 2 -mindepth 2 -name "Makefile" -printf "%h\n"
d77 1
a77 1
          find stress/ -type f -maxdepth 2 -mindepth 2 -name "run.sh" -printf "%h\n"
d119 1
a119 1
            sed 's/\.\(sh\|c\)$/.test/' | grep -v speculative
@


1.1.1.1
log
@Initial import of the Open Posix Test Suite (http://posixtest.sourceforge.net).
@
text
@@
