summaryrefslogtreecommitdiffstats
path: root/googletest/scripts
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-10-23 18:09:41 (GMT)
committerGennadiy Civil <misterg@google.com>2019-10-23 19:54:45 (GMT)
commit37f322783175a66c11785d17fc153477b0777753 (patch)
tree150b5f66287ef6a7bd1d381e9de61af5b0dea952 /googletest/scripts
parent1110c471cadf9cf40cb735890d67f135d6313471 (diff)
downloadgoogletest-37f322783175a66c11785d17fc153477b0777753.zip
googletest-37f322783175a66c11785d17fc153477b0777753.tar.gz
googletest-37f322783175a66c11785d17fc153477b0777753.tar.bz2
Googletest export
Add a matcher `testing::ReturnRoundRobin` which, on each call, returns the next element in the sequence, restarting at the beginning once it has reached the end. PiperOrigin-RevId: 276312136
Diffstat (limited to 'googletest/scripts')
-rw-r--r--googletest/scripts/README.md5
-rwxr-xr-xgoogletest/scripts/gen_gtest_pred_impl.py14
-rwxr-xr-xgoogletest/scripts/pump.py30
-rwxr-xr-xgoogletest/scripts/run_with_path.py32
-rwxr-xr-xgoogletest/scripts/upload.py35
5 files changed, 86 insertions, 30 deletions
diff --git a/googletest/scripts/README.md b/googletest/scripts/README.md
new file mode 100644
index 0000000..fa359fe
--- /dev/null
+++ b/googletest/scripts/README.md
@@ -0,0 +1,5 @@
+# Please Note:
+
+Files in this directory are no longer supported by the maintainers. They
+represent mosty historical artifacts and supported by the community only. There
+is no guarantee whatsoever that these scripts still work.
diff --git a/googletest/scripts/gen_gtest_pred_impl.py b/googletest/scripts/gen_gtest_pred_impl.py
index b43efdf..7294277 100755
--- a/googletest/scripts/gen_gtest_pred_impl.py
+++ b/googletest/scripts/gen_gtest_pred_impl.py
@@ -111,6 +111,8 @@ def HeaderPreamble(n):
// '%(command)s'. DO NOT EDIT BY HAND!
//
// Implements a family of generic predicate assertion macros.
+// GOOGLETEST_CM0001 DO NOT DELETE
+
#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
@@ -246,8 +248,10 @@ AssertionResult AssertPred%(n)sHelper(const char* pred_text""" % DEFS
impl += ' << ") evaluates to false, where"'
- impl += Iter(n, """
- << "\\n" << e%s << " evaluates to " << v%s""")
+ impl += Iter(
+ n, """
+ << "\\n" << e%s << " evaluates to " << ::testing::PrintToString(v%s)"""
+ )
impl += """;
}
@@ -510,7 +514,7 @@ struct PredFormatFunctor%(n)s {
class Predicate%(n)sTest : public testing::Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
expected_to_finish_ = true;
finished_ = false;""" % DEFS
@@ -520,7 +524,7 @@ class Predicate%(n)sTest : public testing::Test {
"""
tests += """
- virtual void TearDown() {
+ void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated
// exactly once."""
@@ -588,7 +592,7 @@ typedef Predicate%(n)sTest ASSERT_PRED%(n)sTest;
if use_assert:
assrt = 'ASSERT' # 'assert' is reserved, so we cannot use
- # that identifier here.
+ # that identifier here.
else:
assrt = 'EXPECT'
diff --git a/googletest/scripts/pump.py b/googletest/scripts/pump.py
index 5efb653..66e3217 100755
--- a/googletest/scripts/pump.py
+++ b/googletest/scripts/pump.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.7
#
# Copyright 2008, Google Inc.
# All rights reserved.
@@ -62,7 +62,7 @@ GRAMMAR:
EXPRESSION has Python syntax.
"""
-__author__ = 'wan@google.com (Zhanyong Wan)'
+from __future__ import print_function
import os
import re
@@ -246,7 +246,7 @@ def ParseToken(lines, pos, regex, token_type):
if m and not m.start():
return MakeToken(lines, pos, pos + m.end(), token_type)
else:
- print 'ERROR: %s expected at %s.' % (token_type, pos)
+ print('ERROR: %s expected at %s.' % (token_type, pos))
sys.exit(1)
@@ -453,8 +453,8 @@ def PushFront(a_list, elem):
def PopToken(a_list, token_type=None):
token = PopFront(a_list)
if token_type is not None and token.token_type != token_type:
- print 'ERROR: %s expected at %s' % (token_type, token.start)
- print 'ERROR: %s found instead' % (token,)
+ print('ERROR: %s expected at %s' % (token_type, token.start))
+ print('ERROR: %s found instead' % (token,))
sys.exit(1)
return token
@@ -616,16 +616,16 @@ class Env:
if identifier == var:
return value
- print 'ERROR: meta variable %s is undefined.' % (identifier,)
+ print('ERROR: meta variable %s is undefined.' % (identifier,))
sys.exit(1)
def EvalExp(self, exp):
try:
result = eval(exp.python_exp)
- except Exception, e:
- print 'ERROR: caught exception %s: %s' % (e.__class__.__name__, e)
- print ('ERROR: failed to evaluate meta expression %s at %s' %
- (exp.python_exp, exp.token.start))
+ except Exception as e: # pylint: disable=broad-except
+ print('ERROR: caught exception %s: %s' % (e.__class__.__name__, e))
+ print('ERROR: failed to evaluate meta expression %s at %s' %
+ (exp.python_exp, exp.token.start))
sys.exit(1)
return result
@@ -634,7 +634,7 @@ class Env:
if identifier == var:
return (lower, upper)
- print 'ERROR: range %s is undefined.' % (identifier,)
+ print('ERROR: range %s is undefined.' % (identifier,))
sys.exit(1)
@@ -694,8 +694,8 @@ def RunAtomicCode(env, node, output):
elif isinstance(node, CodeNode):
RunCode(env.Clone(), node, output)
else:
- print 'BAD'
- print node
+ print('BAD')
+ print(node)
sys.exit(1)
@@ -830,7 +830,7 @@ def ConvertFromPumpSource(src_text):
def main(argv):
if len(argv) == 1:
- print __doc__
+ print(__doc__)
sys.exit(1)
file_path = argv[-1]
@@ -840,7 +840,7 @@ def main(argv):
else:
output_file_path = '-'
if output_file_path == '-':
- print output_str,
+ print(output_str,)
else:
output_file = file(output_file_path, 'w')
output_file.write('// This file was GENERATED by command:\n')
diff --git a/googletest/scripts/run_with_path.py b/googletest/scripts/run_with_path.py
new file mode 100755
index 0000000..d46ab4d
--- /dev/null
+++ b/googletest/scripts/run_with_path.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+#
+# Copyright 2010 Google Inc. All Rights Reserved.
+
+"""Runs program specified in the command line with the substituted PATH.
+
+ This script is needed for to support building under Pulse which is unable
+ to override the existing PATH variable.
+"""
+
+import os
+import subprocess
+import sys
+
+SUBST_PATH_ENV_VAR_NAME = "SUBST_PATH"
+
+def main():
+ if SUBST_PATH_ENV_VAR_NAME in os.environ:
+ os.environ["PATH"] = os.environ[SUBST_PATH_ENV_VAR_NAME]
+
+ exit_code = subprocess.Popen(sys.argv[1:]).wait()
+
+ # exit_code is negative (-signal) if the process has been terminated by
+ # a signal. Returning negative exit code is not portable and so we return
+ # 100 instead.
+ if exit_code < 0:
+ exit_code = 100
+
+ sys.exit(exit_code)
+
+if __name__ == "__main__":
+ main()
diff --git a/googletest/scripts/upload.py b/googletest/scripts/upload.py
index c852e4c..eba5711 100755
--- a/googletest/scripts/upload.py
+++ b/googletest/scripts/upload.py
@@ -1,18 +1,33 @@
#!/usr/bin/env python
#
-# Copyright 2007 Google Inc.
+# Copyright 2007, Google Inc.
+# All rights reserved.
#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Tool for uploading diffs from a version control system to the codereview app.