Skip to content

Commit

Permalink
ovs-dev.py: Support running the clang binaries.
Browse files Browse the repository at this point in the history
They have slightly different support characteristics, so it's nice to
easily switch between them for testing.

Signed-off-by: Ethan Jackson <[email protected]>
Acked-by: Daniele Di Proietto <[email protected]>
  • Loading branch information
ejj committed Sep 17, 2014
1 parent 1bcf46c commit 97695cf
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions utilities/ovs-dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
ROOT = HOME + "/root"
BUILD_GCC = OVS_SRC + "/_build-gcc"
BUILD_CLANG = OVS_SRC + "/_build-clang"
PATH = "%(ovs)s/utilities:%(ovs)s/ovsdb:%(ovs)s/vswitchd" % {"ovs": BUILD_GCC}

ENV["PATH"] = PATH + ":" + ENV["PATH"]

options = None
parser = None
commands = []

def set_path(build):
PATH = "%(ovs)s/utilities:%(ovs)s/ovsdb:%(ovs)s/vswitchd" % {"ovs": build}

ENV["PATH"] = PATH + ":" + ENV["PATH"]

def _sh(*args, **kwargs):
print "------> " + " ".join(args)
Expand Down Expand Up @@ -236,7 +237,8 @@ def run():
_sh("ovs-vsctl --no-wait set Open_vSwitch %s ovs_version=%s"
% (root_uuid, version))

cmd = [BUILD_GCC + "/vswitchd/ovs-vswitchd"]
build = BUILD_CLANG if options.clang else BUILD_GCC
cmd = [build + "/vswitchd/ovs-vswitchd"]

if options.dpdk:
cmd.append("--dpdk")
Expand Down Expand Up @@ -387,6 +389,9 @@ def main():
group.add_option("--dpdk", dest="dpdk", action="callback",
callback=parse_subargs,
help="run ovs-vswitchd with dpdk subopts (ended by --)")
group.add_option("--clang", dest="clang", action="store_true",
help="Use binaries built by clang")

parser.add_option_group(group)

options, args = parser.parse_args()
Expand All @@ -396,6 +401,11 @@ def main():
print "Unknown argument " + arg
doc()

if options.clang:
set_path(BUILD_CLANG)
else:
set_path(BUILD_GCC)

try:
os.chdir(OVS_SRC)
except OSError:
Expand Down

0 comments on commit 97695cf

Please sign in to comment.