mirror of
https://github.com/google/googletest.git
synced 2026-07-30 16:26:24 +08:00
Compare commits
7 Commits
aed7cff1d3
...
6686833fca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6686833fca | ||
|
|
3ff51c3e80 | ||
|
|
c6f04243ed | ||
|
|
af4c3cfcb3 | ||
|
|
ecb18f0b03 | ||
|
|
1269db9643 | ||
|
|
2075c62111 |
34
.github/workflows/build_release.yml
vendored
Normal file
34
.github/workflows/build_release.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
name: Build Source Release
|
||||
|
||||
# Trigger whenever a release is created
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: clone the repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create the Debian and RPM package
|
||||
run: |
|
||||
cmake -B build -DCMAKE_INSTALL_PREFIX=/usr
|
||||
cmake --build build
|
||||
cd build
|
||||
cpack -G DEB
|
||||
cpack -G RPM
|
||||
|
||||
- name: Upload debian and rpm package to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.event.release.tag_name }}
|
||||
files: |
|
||||
./build/*.deb
|
||||
./build/*.rpm
|
||||
|
||||
@ -34,3 +34,6 @@ if(BUILD_GMOCK)
|
||||
else()
|
||||
add_subdirectory( googletest )
|
||||
endif()
|
||||
|
||||
# Include CPack
|
||||
include(CPackConfig.txt)
|
||||
38
CPackConfig.txt
Normal file
38
CPackConfig.txt
Normal file
@ -0,0 +1,38 @@
|
||||
set(CPACK_PACKAGE_NAME "libgtest-dev")
|
||||
set(CPACK_PACKAGE_CONTACT "Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "Description: Google's framework for writing C++ tests
|
||||
Google's framework for writing C++ tests on a variety of platforms. Based on
|
||||
the xUnit architecture. Supports automatic test discovery, a rich set of
|
||||
assertions, user-defined assertions, death tests, fatal and non-fatal failures,
|
||||
value- and type-parameterized tests, various options for running the tests, and
|
||||
XML test report generation.")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Google's framework for writing C++ tests")
|
||||
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/google/googletest")
|
||||
set(CPACK_STRIP_FILES false)
|
||||
set(CPACK_PACKAGE_ARCHITECTURE "amd64")
|
||||
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
|
||||
set(CPACK_PACKAGE_ARCHITECTURE "arm64")
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_VERSION "${GOOGLETEST_VERSION}")
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_PACKAGE_ARCHITECTURE}")
|
||||
|
||||
# Copy over documentation (Debian, probably same for rpm and mac?)
|
||||
# install(DIRECTORY "${CMAKE_SOURCE_DIR}/LICENSES" DESTINATION "/usr/share/doc/libcapstone-dev")
|
||||
# install(FILES "${CMAKE_SOURCE_DIR}/ChangeLog" DESTINATION "/usr/share/doc/libcapstone-dev")
|
||||
# install(FILES "${CMAKE_SOURCE_DIR}/README.md" DESTINATION "/usr/share/doc/libcapstone-dev")
|
||||
|
||||
# Set Debian-specific package variables
|
||||
set(CPACK_DEBIAN_PACKAGE_SOURCE "googletest")
|
||||
set(CPACK_DEBIAN_PACKAGE_ORIGINAL_MAINTAINER "Steve M. Robbins <smr@debian.org>")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.2.5)")
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "universe/libdevel")
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
set(CPACK_DEBIAN_PACKAGE_MULTIARCH "same")
|
||||
|
||||
# RPM package settings
|
||||
set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "libc6 >= 2.2.5")
|
||||
|
||||
# Include CPack
|
||||
include(CPack)
|
||||
@ -30,6 +30,8 @@
|
||||
// Tests that Google Mock constructs can be used in a large number of
|
||||
// threads concurrently.
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@ -188,7 +190,7 @@ TEST(StressTest, CanUseGMockWithThreads) {
|
||||
&TestPartiallyOrderedExpectationsWithThreads,
|
||||
};
|
||||
|
||||
const int kRoutines = sizeof(test_routines) / sizeof(test_routines[0]);
|
||||
const int kRoutines = std::size(test_routines);
|
||||
const int kCopiesOfEachRoutine = kMaxTestThreads / kRoutines;
|
||||
const int kTestThreads = kCopiesOfEachRoutine * kRoutines;
|
||||
ThreadWithParam<Dummy>* threads[kTestThreads] = {};
|
||||
|
||||
@ -39,6 +39,8 @@
|
||||
|
||||
#include "sample2.h"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
namespace {
|
||||
// In this example, we test the MyString class (a simple string).
|
||||
@ -78,7 +80,7 @@ const char kHelloString[] = "Hello, world!";
|
||||
TEST(MyString, ConstructorFromCString) {
|
||||
const MyString s(kHelloString);
|
||||
EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));
|
||||
EXPECT_EQ(sizeof(kHelloString) / sizeof(kHelloString[0]) - 1, s.Length());
|
||||
EXPECT_EQ(std::size(kHelloString) - 1, s.Length());
|
||||
}
|
||||
|
||||
// Tests the copy c'tor.
|
||||
|
||||
@ -587,7 +587,7 @@ class GTEST_API_ UnitTestImpl {
|
||||
// total_test_suite_count() - 1. If i is not in that range, returns NULL.
|
||||
const TestSuite* GetTestSuite(int i) const {
|
||||
const int index = GetElementOr(test_suite_indices_, i, -1);
|
||||
return index < 0 ? nullptr : test_suites_[static_cast<size_t>(i)];
|
||||
return index < 0 ? nullptr : test_suites_[static_cast<size_t>(index)];
|
||||
}
|
||||
|
||||
// Legacy API is deprecated but still available
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
// This file verifies Google Test event listeners receive events at the
|
||||
// right times.
|
||||
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -498,8 +499,7 @@ int main(int argc, char** argv) {
|
||||
"1st.OnTestProgramEnd"};
|
||||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||
|
||||
VerifyResults(events, expected_events,
|
||||
sizeof(expected_events) / sizeof(expected_events[0]));
|
||||
VerifyResults(events, expected_events, std::size(expected_events));
|
||||
|
||||
// We need to check manually for ad hoc test failures that happen after
|
||||
// RUN_ALL_TESTS finishes.
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest-spi.h"
|
||||
@ -149,7 +150,7 @@ TEST(LoggingTest, InterleavingLoggingAndAssertions) {
|
||||
static const int a[4] = {3, 9, 2, 6};
|
||||
|
||||
printf("(expecting 2 failures on (3) >= (a[i]))\n");
|
||||
for (int i = 0; i < static_cast<int>(sizeof(a) / sizeof(*a)); i++) {
|
||||
for (int i = 0; i < static_cast<int>(std::size(a)); i++) {
|
||||
printf("i == %d\n", i);
|
||||
EXPECT_GE(3, a[i]);
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
@ -737,10 +738,7 @@ const int test_generation_params[] = {36, 42, 72};
|
||||
|
||||
class TestGenerationTest : public TestWithParam<int> {
|
||||
public:
|
||||
enum {
|
||||
PARAMETER_COUNT =
|
||||
sizeof(test_generation_params) / sizeof(test_generation_params[0])
|
||||
};
|
||||
enum { PARAMETER_COUNT = std::size(test_generation_params) };
|
||||
|
||||
typedef TestGenerationEnvironment<PARAMETER_COUNT> Environment;
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include <deque>
|
||||
#include <forward_list>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <map>
|
||||
@ -1784,7 +1785,7 @@ TEST(IsValidUTF8Test, IllFormedUTF8) {
|
||||
// too.
|
||||
{"\xEE\x80\x80", "\"\\xEE\\x80\\x80\"\n As Text: \"\""}};
|
||||
|
||||
for (int i = 0; i < int(sizeof(kTestdata) / sizeof(kTestdata[0])); ++i) {
|
||||
for (int i = 0; i < int(std::size(kTestdata)); ++i) {
|
||||
EXPECT_PRINT_TO_STRING_(kTestdata[i][0], kTestdata[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
// Verifies that the command line flag variables can be accessed in
|
||||
// code once "gtest.h" has been #included.
|
||||
// Do not move it after other gtest #includes.
|
||||
@ -5853,9 +5855,8 @@ class ParseFlagsTest : public Test {
|
||||
// to specify the array sizes.
|
||||
|
||||
#define GTEST_TEST_PARSING_FLAGS_(argv1, argv2, expected, should_print_help) \
|
||||
TestParsingFlags(sizeof(argv1) / sizeof(*argv1) - 1, argv1, \
|
||||
sizeof(argv2) / sizeof(*argv2) - 1, argv2, expected, \
|
||||
should_print_help)
|
||||
TestParsingFlags(std::size(argv1) - 1, argv1, std::size(argv2) - 1, argv2, \
|
||||
expected, should_print_help)
|
||||
};
|
||||
|
||||
// Tests parsing an empty command line.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user