#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

""" Utilities for ASAN,TSAN,etc. build steps. """

from default_build_step_utils import DefaultBuildStepUtils
from utils import shell_utils

import os

LLVM_PATH = '/home/chrome-bot/llvm-3.4/Release+Asserts/bin/'

class XsanBuildStepUtils(DefaultBuildStepUtils):
  def Compile(self, target):
    # Run the xsan_build script.
    os.environ['PATH'] = LLVM_PATH + ':' + os.environ['PATH']
    shell_utils.run(['which', 'clang'])
    shell_utils.run(['clang', '--version'])
    os.environ['GYP_DEFINES'] = self._step.args['gyp_defines']
    print 'GYP_DEFINES="%s"' % os.environ['GYP_DEFINES']
    cmd = [
        os.path.join('tools', 'xsan_build'),
        self._step.args['sanitizer'],
        target,
        'BUILDTYPE=%s' % self._step.configuration,
    ]

    cmd.extend(self._step.default_make_flags)
    cmd.extend(self._step.make_flags)
    shell_utils.run(cmd)

  def RunFlavoredCmd(self, app, args):
    os.environ['TSAN_OPTIONS'] = 'suppressions=tools/tsan.supp'
    return shell_utils.run([self._PathToBinary(app)] + args)

@@ -338,70 +338,8 @@
 os%0A%0A
-LLVM_PATH = '/home/chrome-bot/llvm-3.4/Release+Asserts/bin/'%0A%0A
 clas
@@ -449,154 +449,8 @@
 pt.%0A
-    os.environ%5B'PATH'%5D = LLVM_PATH + ':' + os.environ%5B'PATH'%5D%0A    shell_utils.run(%5B'which', 'clang'%5D)%0A    shell_utils.run(%5B'clang', '--version'%5D)%0A
     
@@ -883,16 +883,188 @@
  args):%0A
+    # New versions of ASAN run LSAN by default.  We're not yet clean for that.%0A    os.environ%5B'ASAN_OPTIONS'%5D = 'detect_leaks=0'%0A    # Point TSAN at our suppressions file.%0A
     os.e

Update xsan flavor now that they're running on GCE bots.