1132720Skan#!/bin/sh
2132720Skan
3132720Skan# Constructs lists of source files (full pathnames) to test.  Two
4132720Skan# files are constructed: testsuite_files, which is used to test with
5132720Skan# the default dg-runtest command, and testsuite_files_interactive,
6132720Skan# which is used to test cases that require input to be entered. In
7132720Skan# addition, both lists are pruned of wchar_t tests if the toolchain
8132720Skan# under test does not support wchar_t functionality.
9132720Skan#
10132720Skan# We mimic the mkcheck script in that the first time this is run, all
11132720Skan# existing files are listed in "testsuite_files" in the output
12132720Skan# directory.  Subsequent runs pull the list from that file, allowing
13132720Skan# users to trim the list down to problematic tests, or just run
14132720Skan# paticular directories or sub-directories of tests.
15132720Skan#
16132720Skan# Selecting individual tests can also be done with RUNTESTFLAGS, but
17132720Skan# that doesn't really do all that we are trying to accomplish here.
18132720Skan
19132720SkanLC_ALL=C
20132720Skanexport LC_ALL
21132720Skan
22132720Skan# Both of these are in the appropriate testsuite subdirectories.
23132720Skansrcdir="$1"
24132720Skanoutdir="$2"
25132720Skan
26132720Skantmp="${TMPDIR:-/tmp}/ctt$$"
27132720Skantests_file_normal="$outdir/testsuite_files"
28132720Skantests_file_inter="$outdir/testsuite_files_interactive"
29132720Skantests_file_perf="$outdir/testsuite_files_performance"
30132720Skan
31132720Skancd $srcdir
32132720Skan# This is the ugly version of "everything but the current directory".  It's
33132720Skan# what has to happen when find(1) doesn't support -mindepth, or -xtype.
34132720Skandlist=`echo [0-9][0-9]*`
35169691Skandlist="$dlist abi backward ext performance thread tr1"
36169691Skanfind $dlist "(" -type f -o -type l ")" -name "*.cc" -print > $tmp.01
37169691Skanfind $dlist "(" -type f -o -type l ")" -name "*.c" -print > $tmp.02
38169691Skancat  $tmp.01 $tmp.02 | sort > $tmp.1
39132720Skanif test ! -s "$tmp.1"; then
40132720Skan  exit 1
41132720Skanfi
42132720Skan
43132720Skan# Now filter out classes of tests.  These classes are run using special rules.
44169691Skangrep _xin $tmp.1 > $tests_file_inter
45169691Skangrep -v _xin $tmp.1 > $tmp.4
46132720Skan
47169691Skangrep performance $tmp.4 > $tests_file_perf
48169691Skangrep -v performance $tmp.4 > $tmp.5
49132720Skan
50132720Skan# ...more filters go here.
51169691Skancp $tmp.5 $tests_file_normal
52132720Skan
53132720Skanrm $tmp*
54132720Skanexit 0
55