File: getprop.awk

package info (click to toggle)
opm-simulators 2025.10%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 21,552 kB
  • sloc: cpp: 193,037; sh: 1,807; python: 1,704; lisp: 1,108; makefile: 31; awk: 10
file content (35 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download | duplicates (3)
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
# Extract test property values from CTestTestfile.cmake
#
# User must initialise two awk variables, typically through the "-v" option,
# when invoking this script
#
#   search: Search pattern.  Typically a string such as
#      set_tests_properties($test_name
#
#   prop: Property name, for instance DIRNAME or SIMULATOR.
#
# Property value will be printed to the standard output stream.
#
# The script assumes that $1 on candidate lines is suitable for matching
# against 'search', and that $2 of the matching lines is the word
# 'PROPERTIES'.
#
# Example:
#   # Get value of SIMULATOR property in test named by shell variable
#   # $failed_test and assign this to shell variable 'binary'.
#
#   binary=$(awk -v search="set_tests_properties\\\($failed_test" \
#            -v prop="SIMULATOR" \
#            -f getprop.awk \
#            CTestTestfile.cmake)

$1 ~ search {
    for (i = 3; i <= NF; ++i) {
        if ($i == prop) {
            val = $(i + 1)
            gsub(/"/, "", val)
            print val
            exit
        }
    }
}