File: lto-object-files-only-have-line-tables.test-sh

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (59 lines) | stat: -rwxr-xr-x 1,851 bytes parent folder | download
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
#!/usr/bin/env bash

# This test makes sure that if lto is enabled:
#
# 1. We have lto object files for swift in our build tree. We swift and libswiftdemangle.
# 2. These lto output files all have line tables in the swift include directory,
#    but do not have full debug info. To check for the latter case, we look for
#    SmallVector a commonly used data type.
# 3. We use swift-demangle since it is a much smaller executable than all of
#    swift.

set -e
set -u

# REQUIRES: lto
# REQUIRES: OS=macosx
# REQUIRES: tools-debuginfo
# RUN: rm -rf %t
# RUN: mkdir -p %t
# RUN: %s %swift_obj_root %t %llvm-dwarfdump

OBJECT_ROOT=$1
TEMP_DIR=$2
DWARFDUMP=$3

SWIFT_DEMANGLE_LTO_OBJECT_FILE=$(find ${OBJECT_ROOT} -path '*/swift-demangle/swift-demangle*-lto.o' | head -1)

# Check that we have a temporary lto file for swift.
if [[ -z "${SWIFT_DEMANGLE_LTO_OBJECT_FILE}" ]]; then
   echo "Failed to find a temporary debug file for swift-demangle?!"
   exit 1
else
    echo "Found swift-demangle LTO object!"
fi

${DWARFDUMP} --debug-line ${SWIFT_DEMANGLE_LTO_OBJECT_FILE} > ${TEMP_DIR}/line.info

# Make sure that we found a line table.
if [[ -z "$(sed -n "/include_directories.*=.*include\/swift/{p;q;}" ${TEMP_DIR}/line.info)" ]] ; then
  echo "Failed to find line table information for swift-demangle?!"
  exit 1
else
  echo "Found line table information for swift-demangle in swift LTO object"
fi

${DWARFDUMP} -apple-types ${SWIFT_DEMANGLE_LTO_OBJECT_FILE} > ${TEMP_DIR}/types.info

# And that it does not have full debug info
if [[ -n "$(sed -n '/Name:.*SmallVector<..*>/{p;q;}' ${TEMP_DIR}/types.info)" ]] ; then
  echo "Found full debug info in the swift-demangle lto object?!"
  exit 1
else
  echo "Did not find full debug info for swift-demangle lto object!"
fi

echo "The swift-demangle binary only has line table debug info!"

set +u
set +e