owners.sh 1.21 KB
Newer Older
1
#!/usr/bin/env bash
2

3 4 5 6
# Copyright (c) 2012 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.

7 8 9 10 11 12 13 14 15 16 17
set -e

. ./test-lib.sh

setup_initsvn
setup_gitsvn

(

  set -e
  cd git-svn
18
  git config rietveld.server localhost:10000
19
  export GIT_EDITOR=$(which true)
20 21 22 23 24 25 26 27 28 29 30 31 32

  git checkout -q -b work
  echo "ben@chromium.org" > OWNERS
  cat <<END > PRESUBMIT.py
def CheckChangeOnCommit(input_api, output_api):
  return input_api.canned_checks.CheckOwners(input_api, output_api)

CheckChangeOnUpload = CheckChangeOnCommit
END

  git add OWNERS PRESUBMIT.py ; git commit -q -m "add OWNERS"

  test_expect_success "upload succeeds (needs a server running on localhost)" \
33
    "$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
34 35

  test_expect_success "git-cl status has a suggested reviewer" \
36
    "$GIT_CL_STATUS | grep -q 'R=ben@chromium.org'"
37 38

  test_expect_failure "git-cl dcommit fails w/ missing LGTM" \
39
    "$GIT_CL dcommit -f --no-oauth2"
40 41

  test_expect_success "git-cl dcommit --tbr succeeds" \
42
    "$GIT_CL dcommit --tbr -f --no-oauth2 | grep -q -- '--tbr was specified'"
43 44 45 46 47 48 49 50
)
SUCCESS=$?

cleanup

if [ $SUCCESS == 0 ]; then
  echo PASS
fi