summaryrefslogtreecommitdiffstats
path: root/lldb/test/plugins/darwin.py
blob: 1f10d86ab9533f4fcbe8e702c4032e8692e0b634 (plain)
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
"""
If the build* function is passed the compiler argument, for example, 'llvm-gcc',
it is passed as a make variable to the make command.  Otherwise, we check the
LLDB_CC environment variable; if it is defined, it is passed as a make variable
to the make command.

If neither the compiler keyword argument nor the LLDB_CC environment variable is
specified, no CC make variable is passed to the make command.  The Makefile gets
to define the default CC being used.
"""

import os
import lldbtest

#print "Hello, darwin plugin!"

def getCCSpec(compiler):
    """
    Helper function to return the key-value pair string to specify the compiler
    used for the make system.
    """
    cc = compiler if compiler else None
    if not cc and "LLDB_CC" in os.environ:
        cc = os.environ["LLDB_CC"]

    # Note the leading space character.
    return (" CC=" + cc) if cc else ""


def buildDefault(compiler=None):
    """Build the binaries the default way."""
    lldbtest.system(["/bin/sh", "-c",
                     "make clean; make" + getCCSpec(compiler)])

    # True signifies that we can handle building default.
    return True

def buildDsym(compiler=None):
    """Build the binaries with dsym debug info."""
    lldbtest.system(["/bin/sh", "-c",
                     "make clean; make MAKE_DSYM=YES" + getCCSpec(compiler)])

    # True signifies that we can handle building dsym.
    return True

def buildDwarf(compiler=None):
    """Build the binaries with dwarf debug info."""
    lldbtest.system(["/bin/sh", "-c",
                     "make clean; make MAKE_DSYM=NO" + getCCSpec(compiler)])

    # True signifies that we can handle building dsym.
    return True

def cleanup():
    """Do class-wide cleanup after the test."""
    if os.path.isfile("Makefile"):
        lldbtest.system(["/bin/sh", "-c", "make clean"])

    # True signifies that we can handle building dsym.
    return True
OpenPOWER on IntegriCloud