~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/gtest/src/gtest-typed-test.cc

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-08-23 15:37:30 UTC
  • mfrom: (1.7.6)
  • Revision ID: package-import@ubuntu.com-20120823153730-c499sefj7btu4386
Tags: 9.0~git20120821.c1114c61-0ubuntu1
* Merge from unreleased debian git.
  - Includes support for ATI Trinity PCI IDs (LP: #1009089)
* rules, control, libgl1-mesa-swx11*: Remove swx11 support.
* Refresh patches:
  - drop 115_llvm_dynamic_linking.diff,
    117_nullptr_check_in_query_version.patch, and
    118_glsl_initialize_samplers.patch, all upstream
  - disable 116_use_shared_galliumcore.diff until it's reviewed and
    reworked to apply
* not-installed, libegl1-mesa-drivers-install.linux.in: Updated to
  match the single-pass build.
* libgl1-mesa-dri.*install.in: Drop libglsl.so, it's included in
  libdricore.so now.
* rules: Don't disable GLU on the common flags, we need to build it
  on the dri target.
* libglu*install.in: Fix the source file paths to match the build target.
  Drop the static lib from -dev since only shared libs get built.
* libgl1-mesa-dev.install.in: Fix the source file paths to match the
  build target.
* libgl1-mesa-dri.install.linux.in: Don't try to install libgallium.so,
  which isn't built yet.
* rules: Enable llvmpipe on armhf to see if it works or not.
* rules: Remove bin/install-sh on clean, and don't create a symlink for
  it.
* control: Add Pre-Depends on dpkg-dev due to the binaries using xz
  compression.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2008 Google Inc.
 
2
// All Rights Reserved.
 
3
//
 
4
// Redistribution and use in source and binary forms, with or without
 
5
// modification, are permitted provided that the following conditions are
 
6
// met:
 
7
//
 
8
//     * Redistributions of source code must retain the above copyright
 
9
// notice, this list of conditions and the following disclaimer.
 
10
//     * Redistributions in binary form must reproduce the above
 
11
// copyright notice, this list of conditions and the following disclaimer
 
12
// in the documentation and/or other materials provided with the
 
13
// distribution.
 
14
//     * Neither the name of Google Inc. nor the names of its
 
15
// contributors may be used to endorse or promote products derived from
 
16
// this software without specific prior written permission.
 
17
//
 
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
19
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
20
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
21
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 
22
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
23
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
24
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
25
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
26
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
27
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
28
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
29
//
 
30
// Author: wan@google.com (Zhanyong Wan)
 
31
 
 
32
#include "gtest/gtest-typed-test.h"
 
33
#include "gtest/gtest.h"
 
34
 
 
35
namespace testing {
 
36
namespace internal {
 
37
 
 
38
#if GTEST_HAS_TYPED_TEST_P
 
39
 
 
40
// Skips to the first non-space char in str. Returns an empty string if str
 
41
// contains only whitespace characters.
 
42
static const char* SkipSpaces(const char* str) {
 
43
  while (IsSpace(*str))
 
44
    str++;
 
45
  return str;
 
46
}
 
47
 
 
48
// Verifies that registered_tests match the test names in
 
49
// defined_test_names_; returns registered_tests if successful, or
 
50
// aborts the program otherwise.
 
51
const char* TypedTestCasePState::VerifyRegisteredTestNames(
 
52
    const char* file, int line, const char* registered_tests) {
 
53
  typedef ::std::set<const char*>::const_iterator DefinedTestIter;
 
54
  registered_ = true;
 
55
 
 
56
  // Skip initial whitespace in registered_tests since some
 
57
  // preprocessors prefix stringizied literals with whitespace.
 
58
  registered_tests = SkipSpaces(registered_tests);
 
59
 
 
60
  Message errors;
 
61
  ::std::set<String> tests;
 
62
  for (const char* names = registered_tests; names != NULL;
 
63
       names = SkipComma(names)) {
 
64
    const String name = GetPrefixUntilComma(names);
 
65
    if (tests.count(name) != 0) {
 
66
      errors << "Test " << name << " is listed more than once.\n";
 
67
      continue;
 
68
    }
 
69
 
 
70
    bool found = false;
 
71
    for (DefinedTestIter it = defined_test_names_.begin();
 
72
         it != defined_test_names_.end();
 
73
         ++it) {
 
74
      if (name == *it) {
 
75
        found = true;
 
76
        break;
 
77
      }
 
78
    }
 
79
 
 
80
    if (found) {
 
81
      tests.insert(name);
 
82
    } else {
 
83
      errors << "No test named " << name
 
84
             << " can be found in this test case.\n";
 
85
    }
 
86
  }
 
87
 
 
88
  for (DefinedTestIter it = defined_test_names_.begin();
 
89
       it != defined_test_names_.end();
 
90
       ++it) {
 
91
    if (tests.count(*it) == 0) {
 
92
      errors << "You forgot to list test " << *it << ".\n";
 
93
    }
 
94
  }
 
95
 
 
96
  const String& errors_str = errors.GetString();
 
97
  if (errors_str != "") {
 
98
    fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
 
99
            errors_str.c_str());
 
100
    fflush(stderr);
 
101
    posix::Abort();
 
102
  }
 
103
 
 
104
  return registered_tests;
 
105
}
 
106
 
 
107
#endif  // GTEST_HAS_TYPED_TEST_P
 
108
 
 
109
}  // namespace internal
 
110
}  // namespace testing