This file is indexed.

/usr/share/deal.ii/scripts/run_test.sh is in libdeal.ii-dev 8.4.2-2+b1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
## ---------------------------------------------------------------------
##
## Copyright (C) 2015 by the deal.II authors
##
## This file is part of the deal.II library.
##
## The deal.II library is free software; you can use it, redistribute
## it, and/or modify it under the terms of the GNU Lesser General
## Public License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
## The full text of the license can be found in the file LICENSE at
## the top level of the deal.II distribution.
##
## ---------------------------------------------------------------------

#
# Helper script used in testsuite targets to run ("run") and compare
# ("diff") individual tests.
#
# Usage:
#   run_test.sh run TEST_FULL RUN_COMMAND
#
#   run_test.sh diff TEST_FULL DIFF_EXECUTABLE DIFF_EXECUTABLE COMPARISON_FILE
#

set -u

STAGE="$1"
TEST_FULL="$2"
RUN_COMMAND="$3"
NUMDIFF_EXECUTABLE="$4"
DIFF_EXECUTABLE="$5"
COMPARISON_FILE="$6"

# Ensure uniform sorting for pathname expansion
export LC_ALL=C

#
# Add a top level target to run and compare the test:
#

run(){
  rm -f failing_output
  rm -f output
  rm -f stdout

  ${RUN_COMMAND} > stdout 2>&1
  RETURN_VALUE=$?

  [ -f output ] || mv stdout output

  if [ $RETURN_VALUE -ne 0 ]; then
    mv output failing_output
    echo "${TEST_FULL}: BUILD successful."
    echo "${TEST_FULL}: RUN failed. ------ Return code $RETURN_VALUE"
    echo "${TEST_FULL}: RUN failed. ------ Result: `pwd`/failing_output"
    echo "${TEST_FULL}: RUN failed. ------ Partial output:"
    cat failing_output
    if [ -f stdout ]; then
      echo ""
      echo "${TEST_FULL}: RUN failed. ------ Additional output on stdout/stderr:"
      echo ""
      cat stdout
    fi
    exit 1
  fi
}

diff() {
  rm -f failing_diff*
  rm -f diff*
  touch diff

  test_successful=false

  #
  # Pick up main comparison file and all variants. A valid variant name is
  # of the form [...].output.[STRING]
  #
  for file in "${COMPARISON_FILE}"*; do
    # determine variant name (empty string for main comparison file):
    variant=${file#*.output}

    #
    # Run diff or numdiff (if available) to determine whether files are the
    # same. Create a diff file "diff${variant}" for each variant file that
    # is found (including the main comparison file).
    #
    case ${NUMDIFF_EXECUTABLE} in
      *numdiff*)
        ${NUMDIFF_EXECUTABLE} -a 1e-6 -r 1e-8 -s ' \t\n:<>=,;' \
                              "${file}" output > diff${variant}
        ;;
      *)
        "${DIFF_EXECUTABLE}" "${file}" output > diff${variant}
        ;;
    esac

    if [ $? -eq 0 ]; then
      #
      # Ensure that only a single diff file with no contents remains
      # (numdiff has the bad habit of being very verbose...):
      #
      rm -f diff*
      touch diff

      if [ -n "${variant}" ]; then
        #
        # In case of a successful comparison against a variant, store the
        # fact that we compared against a variant in the diff file.
        #
        echo "${TEST_FULL}: DIFF successful. - Variant: ${file}" > diff
      fi

      test_successful=true
      break
    fi
  done

  #
  # If none of the diffs succeeded, use the diff against the main comparison
  # file. Output the first few lines of the output of numdiff, followed by
  # the results of regular diff since the latter is just more readable.
  #
  if [ $test_successful = false ] ; then
    for file in diff*; do
      mv "$file" failing_"$file"
    done
    echo "${TEST_FULL}: BUILD successful."
    echo "${TEST_FULL}: RUN successful."
    echo "${TEST_FULL}: DIFF failed. ------ Source: ${COMPARISON_FILE}"
    echo "${TEST_FULL}: DIFF failed. ------ Result: `pwd`/output"
    echo "Check `pwd`/output ${COMPARISON_FILE}"
    echo "${TEST_FULL}: DIFF failed. ------ Diff:   `pwd`/failing_diff"
    echo "${TEST_FULL}: DIFF failed. ------ First 8 lines of numdiff/diff output:"
    cat failing_diff | head -n 8
    echo "${TEST_FULL}: DIFF failed. ------ First 50 lines diff output:"
    "${DIFF_EXECUTABLE}" -c "${COMPARISON_FILE}" output | head -n 50
    exit 1
  fi
  exit 0
}

case $STAGE in
  run)
    run;;
  diff)
    diff;;
  *)
    exit 1;;
esac