Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B003A200C2E for ; Sun, 29 Jan 2017 03:08:17 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id AE734160B5F; Sun, 29 Jan 2017 02:08:17 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8D108160B65 for ; Sun, 29 Jan 2017 03:08:15 +0100 (CET) Received: (qmail 67709 invoked by uid 500); 29 Jan 2017 02:08:14 -0000 Mailing-List: contact commits-help@quickstep.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@quickstep.incubator.apache.org Delivered-To: mailing list commits@quickstep.incubator.apache.org Received: (qmail 67648 invoked by uid 99); 29 Jan 2017 02:08:14 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Jan 2017 02:08:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 83955189ACA for ; Sun, 29 Jan 2017 02:08:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -5.719 X-Spam-Level: X-Spam-Status: No, score=-5.719 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id jZwETOXyCtpc for ; Sun, 29 Jan 2017 02:07:57 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 7157D60CF4 for ; Sun, 29 Jan 2017 02:07:37 +0000 (UTC) Received: (qmail 65036 invoked by uid 99); 29 Jan 2017 02:07:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Jan 2017 02:07:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 62A34DFCDD; Sun, 29 Jan 2017 02:07:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zuyuz@apache.org To: commits@quickstep.incubator.apache.org Date: Sun, 29 Jan 2017 02:08:13 -0000 Message-Id: In-Reply-To: <0e7c1667ae81415abc1359d113034fa6@git.apache.org> References: <0e7c1667ae81415abc1359d113034fa6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [39/52] [partial] incubator-quickstep git commit: Make the third party directory leaner. archived-at: Sun, 29 Jan 2017 02:08:17 -0000 http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/gflags/test/gflags_unittest.cc ---------------------------------------------------------------------- diff --git a/third_party/gflags/test/gflags_unittest.cc b/third_party/gflags/test/gflags_unittest.cc deleted file mode 100644 index 80f7398..0000000 --- a/third_party/gflags/test/gflags_unittest.cc +++ /dev/null @@ -1,1536 +0,0 @@ -// Copyright (c) 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * 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. -// -// 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. - -// --- -// -// For now, this unit test does not cover all features of -// gflags.cc - -#include "config_for_unittests.h" -#include - -#include // for isinf() and isnan() -#include -#include -#include -#ifdef HAVE_UNISTD_H -# include // for unlink() -#endif -#include -#include -#include "util.h" -TEST_INIT -EXPECT_DEATH_INIT - -// I don't actually use this header file, but #include it under the -// old location to make sure that the include-header-forwarding -// works. But don't bother on windows; the windows port is so new -// it never had the old location-names. -#ifndef _MSC_VER -#include -void (*unused_fn)() = &GFLAGS_NAMESPACE::HandleCommandLineCompletions; -#endif - -using std::string; -using std::vector; -using GFLAGS_NAMESPACE::int32; -using GFLAGS_NAMESPACE::FlagRegisterer; -using GFLAGS_NAMESPACE::StringFromEnv; -using GFLAGS_NAMESPACE::RegisterFlagValidator; -using GFLAGS_NAMESPACE::CommandLineFlagInfo; -using GFLAGS_NAMESPACE::GetAllFlags; - -DEFINE_string(test_tmpdir, "", "Dir we use for temp files"); -DEFINE_string(srcdir, StringFromEnv("SRCDIR", "."), "Source-dir root, needed to find gflags_unittest_flagfile"); - -DECLARE_string(tryfromenv); // in gflags.cc - -DEFINE_bool(test_bool, false, "tests bool-ness"); -DEFINE_int32(test_int32, -1, ""); -DEFINE_int64(test_int64, -2, ""); -DEFINE_uint64(test_uint64, 2, ""); -DEFINE_double(test_double, -1.0, ""); -DEFINE_string(test_string, "initial", ""); - -// -// The below ugliness gets some additional code coverage in the -helpxml -// and -helpmatch test cases having to do with string lengths and formatting -// -DEFINE_bool(test_bool_with_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_long_name, - false, - "extremely_extremely_extremely_extremely_extremely_extremely_extremely_extremely_long_meaning"); - -DEFINE_string(test_str1, "initial", ""); -DEFINE_string(test_str2, "initial", ""); -DEFINE_string(test_str3, "initial", ""); - -// This is used to test setting tryfromenv manually -DEFINE_string(test_tryfromenv, "initial", ""); - -// Don't try this at home! -static int changeable_var = 12; -DEFINE_int32(changeable_var, ++changeable_var, ""); - -static int changeable_bool_var = 8008; -DEFINE_bool(changeable_bool_var, ++changeable_bool_var == 8009, ""); - -static int changeable_string_var = 0; -static string ChangeableString() { - char r[] = {static_cast('0' + ++changeable_string_var), '\0'}; - return r; -} -DEFINE_string(changeable_string_var, ChangeableString(), ""); - -// These are never used in this unittest, but can be used by -// gflags_unittest.sh when it needs to specify flags -// that are legal for gflags_unittest but don't need to -// be a particular value. -DEFINE_bool(unused_bool, true, "unused bool-ness"); -DEFINE_int32(unused_int32, -1001, ""); -DEFINE_int64(unused_int64, -2001, ""); -DEFINE_uint64(unused_uint64, 2000, ""); -DEFINE_double(unused_double, -1000.0, ""); -DEFINE_string(unused_string, "unused", ""); - -// These flags are used by gflags_unittest.sh -DEFINE_bool(changed_bool1, false, "changed"); -DEFINE_bool(changed_bool2, false, "changed"); -DEFINE_bool(long_helpstring, false, - "This helpstring goes on forever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever. This is the end of a long helpstring"); - - -static bool AlwaysFail(const char* flag, bool value) { return value == false; } -DEFINE_bool(always_fail, false, "will fail to validate when you set it"); -DEFINE_validator(always_fail, AlwaysFail); - -// See the comment by GetAllFlags in gflags.h -static bool DeadlockIfCantLockInValidators(const char* flag, bool value) { - if (!value) { - return true; - } - vector dummy; - GetAllFlags(&dummy); - return true; -} -DEFINE_bool(deadlock_if_cant_lock, - false, - "will deadlock if set to true and " - "if locking of registry in validators fails."); -DEFINE_validator(deadlock_if_cant_lock, DeadlockIfCantLockInValidators); - -#define MAKEFLAG(x) DEFINE_int32(test_flag_num##x, x, "Test flag") - -// Define 10 flags -#define MAKEFLAG10(x) \ - MAKEFLAG(x##0); \ - MAKEFLAG(x##1); \ - MAKEFLAG(x##2); \ - MAKEFLAG(x##3); \ - MAKEFLAG(x##4); \ - MAKEFLAG(x##5); \ - MAKEFLAG(x##6); \ - MAKEFLAG(x##7); \ - MAKEFLAG(x##8); \ - MAKEFLAG(x##9) - -// Define 100 flags -#define MAKEFLAG100(x) \ - MAKEFLAG10(x##0); \ - MAKEFLAG10(x##1); \ - MAKEFLAG10(x##2); \ - MAKEFLAG10(x##3); \ - MAKEFLAG10(x##4); \ - MAKEFLAG10(x##5); \ - MAKEFLAG10(x##6); \ - MAKEFLAG10(x##7); \ - MAKEFLAG10(x##8); \ - MAKEFLAG10(x##9) - -// Define a bunch of command-line flags. Each occurrence of the MAKEFLAG100 -// macro defines 100 integer flags. This lets us test the effect of having -// many flags on startup time. -MAKEFLAG100(1); -MAKEFLAG100(2); -MAKEFLAG100(3); -MAKEFLAG100(4); -MAKEFLAG100(5); -MAKEFLAG100(6); -MAKEFLAG100(7); -MAKEFLAG100(8); -MAKEFLAG100(9); -MAKEFLAG100(10); -MAKEFLAG100(11); -MAKEFLAG100(12); -MAKEFLAG100(13); -MAKEFLAG100(14); -MAKEFLAG100(15); - -#undef MAKEFLAG100 -#undef MAKEFLAG10 -#undef MAKEFLAG - -// This is a pseudo-flag -- we want to register a flag with a filename -// at the top level, but there is no way to do this except by faking -// the filename. -namespace fLI { - static const int32 FLAGS_nonotldflag1 = 12; - int32 FLAGS_tldflag1 = FLAGS_nonotldflag1; - int32 FLAGS_notldflag1 = FLAGS_nonotldflag1; - static FlagRegisterer o_tldflag1( - "tldflag1", "int32", - "should show up in --helpshort", "gflags_unittest.cc", - &FLAGS_tldflag1, &FLAGS_notldflag1); -} -using fLI::FLAGS_tldflag1; - -namespace fLI { - static const int32 FLAGS_nonotldflag2 = 23; - int32 FLAGS_tldflag2 = FLAGS_nonotldflag2; - int32 FLAGS_notldflag2 = FLAGS_nonotldflag2; - static FlagRegisterer o_tldflag2( - "tldflag2", "int32", - "should show up in --helpshort", "gflags_unittest.", - &FLAGS_tldflag2, &FLAGS_notldflag2); -} -using fLI::FLAGS_tldflag2; - -namespace GFLAGS_NAMESPACE { - -namespace { - - -static string TmpFile(const string& basename) { -#ifdef _MSC_VER - return FLAGS_test_tmpdir + "\\" + basename; -#else - return FLAGS_test_tmpdir + "/" + basename; -#endif -} - -// Returns the definition of the --flagfile flag to be used in the tests. -// Must be called after ParseCommandLineFlags(). -static const char* GetFlagFileFlag() { -#ifdef _MSC_VER - static const string flagfile = FLAGS_srcdir + "\\gflags_unittest_flagfile"; -#else - static const string flagfile = FLAGS_srcdir + "/gflags_unittest_flagfile"; -#endif - static const string flagfile_flag = string("--flagfile=") + flagfile; - return flagfile_flag.c_str(); -} - - -// Defining a variable of type CompileAssertTypesEqual will cause a -// compiler error iff T1 and T2 are different types. -template -struct CompileAssertTypesEqual; - -template -struct CompileAssertTypesEqual { -}; - - -template -void AssertIsType(Actual& x) { - CompileAssertTypesEqual(); -} - -// Verify all the flags are the right type. -TEST(FlagTypes, FlagTypes) { - AssertIsType(FLAGS_test_bool); - AssertIsType(FLAGS_test_int32); - AssertIsType(FLAGS_test_int64); - AssertIsType(FLAGS_test_uint64); - AssertIsType(FLAGS_test_double); - AssertIsType(FLAGS_test_string); -} - -#ifdef GTEST_HAS_DEATH_TEST -// Death tests for "help" options. -// -// The help system automatically calls gflags_exitfunc(1) when you specify any of -// the help-related flags ("-helpmatch", "-helpxml") so we can't test -// those mainline. - -// Tests that "-helpmatch" causes the process to die. -TEST(ReadFlagsFromStringDeathTest, HelpMatch) { - EXPECT_DEATH(ReadFlagsFromString("-helpmatch=base", GetArgv0(), true), - ""); -} - - -// Tests that "-helpxml" causes the process to die. -TEST(ReadFlagsFromStringDeathTest, HelpXml) { - EXPECT_DEATH(ReadFlagsFromString("-helpxml", GetArgv0(), true), - ""); -} -#endif - - -// A subroutine needed for testing reading flags from a string. -void TestFlagString(const string& flags, - const string& expected_string, - bool expected_bool, - int32 expected_int32, - double expected_double) { - EXPECT_TRUE(ReadFlagsFromString(flags, - GetArgv0(), - // errors are fatal - true)); - - EXPECT_EQ(expected_string, FLAGS_test_string); - EXPECT_EQ(expected_bool, FLAGS_test_bool); - EXPECT_EQ(expected_int32, FLAGS_test_int32); - EXPECT_DOUBLE_EQ(expected_double, FLAGS_test_double); -} - - -// Tests reading flags from a string. -TEST(FlagFileTest, ReadFlagsFromString) { - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "-test_bool=true\n" - " -test_int32=1\n" - "-test_double=0.0\n", - // Expected values - "continued", - true, - 1, - 0.0); - - TestFlagString( - // Flag string - "# let's make sure it can update values\n" - "-test_string=initial\n" - "-test_bool=false\n" - "-test_int32=123\n" - "-test_double=123.0\n", - // Expected values - "initial", - false, - 123, - 123.0); -} - -// Tests the filename part of the flagfile -TEST(FlagFileTest, FilenamesOurfileLast) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "not_our_filename\n" - "-test_bool=true\n" - " -test_int32=1\n" - "gflags_unittest\n" - "-test_double=1000.0\n", - // Expected values - "continued", - false, - -1, - 1000.0); -} - -TEST(FlagFileTest, FilenamesOurfileFirst) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "gflags_unittest\n" - "-test_bool=true\n" - " -test_int32=1\n" - "not_our_filename\n" - "-test_double=1000.0\n", - // Expected values - "continued", - true, - 1, - -1.0); -} - -#if defined(HAVE_FNMATCH_H) || defined(HAVE_SHLWAPI_H) // otherwise glob isn't supported -TEST(FlagFileTest, FilenamesOurfileGlob) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "*flags*\n" - "-test_bool=true\n" - " -test_int32=1\n" - "flags\n" - "-test_double=1000.0\n", - // Expected values - "continued", - true, - 1, - -1.0); -} - -TEST(FlagFileTest, FilenamesOurfileInBigList) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "*first* *flags* *third*\n" - "-test_bool=true\n" - " -test_int32=1\n" - "flags\n" - "-test_double=1000.0\n", - // Expected values - "continued", - true, - 1, - -1.0); -} -#endif // defined(HAVE_FNMATCH_H) || defined(HAVE_SHLWAPI_H) - -// Tests that a failed flag-from-string read keeps flags at default values -TEST(FlagFileTest, FailReadFlagsFromString) { - FLAGS_test_int32 = 119; - string flags("# let's make sure it can update values\n" - "-test_string=non_initial\n" - "-test_bool=false\n" - "-test_int32=123\n" - "-test_double=illegal\n"); - - EXPECT_FALSE(ReadFlagsFromString(flags, - GetArgv0(), - // errors are fatal - false)); - - EXPECT_EQ(119, FLAGS_test_int32); - EXPECT_EQ("initial", FLAGS_test_string); -} - -// Tests that flags can be set to ordinary values. -TEST(SetFlagValueTest, OrdinaryValues) { - EXPECT_EQ("initial", FLAGS_test_str1); - - SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str1); // set; was default - - SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str1); // already set once - - FLAGS_test_str1 = "initial"; - SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("initial", FLAGS_test_str1); // still already set before - - SetCommandLineOptionWithMode("test_str1", "third", SET_FLAGS_VALUE); - EXPECT_EQ("third", FLAGS_test_str1); // changed value - - SetCommandLineOptionWithMode("test_str1", "fourth", SET_FLAGS_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str1); - // value not changed (already set before) - - EXPECT_EQ("initial", FLAGS_test_str2); - - SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str2); // changed (was default) - - FLAGS_test_str2 = "extra"; - EXPECT_EQ("extra", FLAGS_test_str2); - - FLAGS_test_str2 = "second"; - SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str2); // still changed (was equal to default) - - SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("fourth", FLAGS_test_str2); // changed (was default) - - EXPECT_EQ("initial", FLAGS_test_str3); - - SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str3); // changed - - FLAGS_test_str3 = "third"; - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) - - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) - - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_VALUE); - EXPECT_EQ("fourth", FLAGS_test_str3); // changed value -} - - -// Tests that flags can be set to exceptional values. -// Note: apparently MINGW doesn't parse inf and nan correctly: -// http://www.mail-archive.com/bug-gnulib@gnu.org/msg09573.html -// This url says FreeBSD also has a problem, but I didn't see that. -TEST(SetFlagValueTest, ExceptionalValues) { -#if defined(isinf) && !defined(__MINGW32__) - EXPECT_EQ("test_double set to inf\n", - SetCommandLineOption("test_double", "inf")); - EXPECT_INF(FLAGS_test_double); - - EXPECT_EQ("test_double set to inf\n", - SetCommandLineOption("test_double", "INF")); - EXPECT_INF(FLAGS_test_double); -#endif - - // set some bad values - EXPECT_EQ("", - SetCommandLineOption("test_double", "0.1xxx")); - EXPECT_EQ("", - SetCommandLineOption("test_double", " ")); - EXPECT_EQ("", - SetCommandLineOption("test_double", "")); -#if defined(isinf) && !defined(__MINGW32__) - EXPECT_EQ("test_double set to -inf\n", - SetCommandLineOption("test_double", "-inf")); - EXPECT_INF(FLAGS_test_double); - EXPECT_GT(0, FLAGS_test_double); -#endif - -#if defined(isnan) && !defined(__MINGW32__) - EXPECT_EQ("test_double set to nan\n", - SetCommandLineOption("test_double", "NaN")); - EXPECT_NAN(FLAGS_test_double); -#endif -} - -// Tests that integer flags can be specified in many ways -TEST(SetFlagValueTest, DifferentRadices) { - EXPECT_EQ("test_int32 set to 12\n", - SetCommandLineOption("test_int32", "12")); - - EXPECT_EQ("test_int32 set to 16\n", - SetCommandLineOption("test_int32", "0x10")); - - EXPECT_EQ("test_int32 set to 34\n", - SetCommandLineOption("test_int32", "0X22")); - - // Leading 0 is *not* octal; it's still decimal - EXPECT_EQ("test_int32 set to 10\n", - SetCommandLineOption("test_int32", "010")); -} - -// Tests what happens when you try to set a flag to an illegal value -TEST(SetFlagValueTest, IllegalValues) { - FLAGS_test_bool = true; - FLAGS_test_int32 = 119; - FLAGS_test_int64 = 1191; - FLAGS_test_uint64 = 11911; - - EXPECT_EQ("", - SetCommandLineOption("test_bool", "12")); - - EXPECT_EQ("", - SetCommandLineOption("test_int32", "7000000000000")); - - EXPECT_EQ("", - SetCommandLineOption("test_uint64", "-1")); - - EXPECT_EQ("", - SetCommandLineOption("test_int64", "not a number!")); - - // Test the empty string with each type of input - EXPECT_EQ("", SetCommandLineOption("test_bool", "")); - EXPECT_EQ("", SetCommandLineOption("test_int32", "")); - EXPECT_EQ("", SetCommandLineOption("test_int64", "")); - EXPECT_EQ("", SetCommandLineOption("test_uint64", "")); - EXPECT_EQ("", SetCommandLineOption("test_double", "")); - EXPECT_EQ("test_string set to \n", SetCommandLineOption("test_string", "")); - - EXPECT_TRUE(FLAGS_test_bool); - EXPECT_EQ(119, FLAGS_test_int32); - EXPECT_EQ(1191, FLAGS_test_int64); - EXPECT_EQ(11911, FLAGS_test_uint64); -} - - -// Tests that we only evaluate macro args once -TEST(MacroArgs, EvaluateOnce) { - EXPECT_EQ(13, FLAGS_changeable_var); - // Make sure we don't ++ the value somehow, when evaluating the flag. - EXPECT_EQ(13, FLAGS_changeable_var); - // Make sure the macro only evaluated this var once. - EXPECT_EQ(13, changeable_var); - // Make sure the actual value and default value are the same - SetCommandLineOptionWithMode("changeable_var", "21", SET_FLAG_IF_DEFAULT); - EXPECT_EQ(21, FLAGS_changeable_var); -} - -TEST(MacroArgs, EvaluateOnceBool) { - EXPECT_TRUE(FLAGS_changeable_bool_var); - EXPECT_TRUE(FLAGS_changeable_bool_var); - EXPECT_EQ(8009, changeable_bool_var); - SetCommandLineOptionWithMode("changeable_bool_var", "false", - SET_FLAG_IF_DEFAULT); - EXPECT_FALSE(FLAGS_changeable_bool_var); -} - -TEST(MacroArgs, EvaluateOnceStrings) { - EXPECT_EQ("1", FLAGS_changeable_string_var); - EXPECT_EQ("1", FLAGS_changeable_string_var); - EXPECT_EQ(1, changeable_string_var); - SetCommandLineOptionWithMode("changeable_string_var", "different", - SET_FLAG_IF_DEFAULT); - EXPECT_EQ("different", FLAGS_changeable_string_var); -} - -// Tests that the FooFromEnv does the right thing -TEST(FromEnvTest, LegalValues) { - setenv("BOOL_VAL1", "true", 1); - setenv("BOOL_VAL2", "false", 1); - setenv("BOOL_VAL3", "1", 1); - setenv("BOOL_VAL4", "F", 1); - EXPECT_TRUE(BoolFromEnv("BOOL_VAL1", false)); - EXPECT_FALSE(BoolFromEnv("BOOL_VAL2", true)); - EXPECT_TRUE(BoolFromEnv("BOOL_VAL3", false)); - EXPECT_FALSE(BoolFromEnv("BOOL_VAL4", true)); - EXPECT_TRUE(BoolFromEnv("BOOL_VAL_UNKNOWN", true)); - EXPECT_FALSE(BoolFromEnv("BOOL_VAL_UNKNOWN", false)); - - setenv("INT_VAL1", "1", 1); - setenv("INT_VAL2", "-1", 1); - EXPECT_EQ(1, Int32FromEnv("INT_VAL1", 10)); - EXPECT_EQ(-1, Int32FromEnv("INT_VAL2", 10)); - EXPECT_EQ(10, Int32FromEnv("INT_VAL_UNKNOWN", 10)); - - setenv("INT_VAL3", "1099511627776", 1); - EXPECT_EQ(1, Int64FromEnv("INT_VAL1", 20)); - EXPECT_EQ(-1, Int64FromEnv("INT_VAL2", 20)); - EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL3", 20)); - EXPECT_EQ(20, Int64FromEnv("INT_VAL_UNKNOWN", 20)); - - EXPECT_EQ(1, Uint64FromEnv("INT_VAL1", 30)); - EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL3", 30)); - EXPECT_EQ(30, Uint64FromEnv("INT_VAL_UNKNOWN", 30)); - - // I pick values here that can be easily represented exactly in floating-point - setenv("DOUBLE_VAL1", "0.0", 1); - setenv("DOUBLE_VAL2", "1.0", 1); - setenv("DOUBLE_VAL3", "-1.0", 1); - EXPECT_EQ(0.0, DoubleFromEnv("DOUBLE_VAL1", 40.0)); - EXPECT_EQ(1.0, DoubleFromEnv("DOUBLE_VAL2", 40.0)); - EXPECT_EQ(-1.0, DoubleFromEnv("DOUBLE_VAL3", 40.0)); - EXPECT_EQ(40.0, DoubleFromEnv("DOUBLE_VAL_UNKNOWN", 40.0)); - - setenv("STRING_VAL1", "", 1); - setenv("STRING_VAL2", "my happy string!", 1); - EXPECT_STREQ("", StringFromEnv("STRING_VAL1", "unknown")); - EXPECT_STREQ("my happy string!", StringFromEnv("STRING_VAL2", "unknown")); - EXPECT_STREQ("unknown", StringFromEnv("STRING_VAL_UNKNOWN", "unknown")); -} - -#ifdef GTEST_HAS_DEATH_TEST -// Tests that the FooFromEnv dies on parse-error -TEST(FromEnvDeathTest, IllegalValues) { - setenv("BOOL_BAD1", "so true!", 1); - setenv("BOOL_BAD2", "", 1); - EXPECT_DEATH(BoolFromEnv("BOOL_BAD1", false), "error parsing env variable"); - EXPECT_DEATH(BoolFromEnv("BOOL_BAD2", true), "error parsing env variable"); - - setenv("INT_BAD1", "one", 1); - setenv("INT_BAD2", "100000000000000000", 1); - setenv("INT_BAD3", "0xx10", 1); - setenv("INT_BAD4", "", 1); - EXPECT_DEATH(Int32FromEnv("INT_BAD1", 10), "error parsing env variable"); - EXPECT_DEATH(Int32FromEnv("INT_BAD2", 10), "error parsing env variable"); - EXPECT_DEATH(Int32FromEnv("INT_BAD3", 10), "error parsing env variable"); - EXPECT_DEATH(Int32FromEnv("INT_BAD4", 10), "error parsing env variable"); - - setenv("BIGINT_BAD1", "18446744073709551616000", 1); - EXPECT_DEATH(Int64FromEnv("INT_BAD1", 20), "error parsing env variable"); - EXPECT_DEATH(Int64FromEnv("INT_BAD3", 20), "error parsing env variable"); - EXPECT_DEATH(Int64FromEnv("INT_BAD4", 20), "error parsing env variable"); - EXPECT_DEATH(Int64FromEnv("BIGINT_BAD1", 200), "error parsing env variable"); - - setenv("BIGINT_BAD2", "-1", 1); - EXPECT_DEATH(Uint64FromEnv("INT_BAD1", 30), "error parsing env variable"); - EXPECT_DEATH(Uint64FromEnv("INT_BAD3", 30), "error parsing env variable"); - EXPECT_DEATH(Uint64FromEnv("INT_BAD4", 30), "error parsing env variable"); - EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD1", 30), "error parsing env variable"); - // TODO(csilvers): uncomment this when we disallow negative numbers for uint64 -#if 0 - EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD2", 30), "error parsing env variable"); -#endif - - setenv("DOUBLE_BAD1", "0.0.0", 1); - setenv("DOUBLE_BAD2", "", 1); - EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD1", 40.0), "error parsing env variable"); - EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD2", 40.0), "error parsing env variable"); -} -#endif - - -// Tests that FlagSaver can save the states of string flags. -TEST(FlagSaverTest, CanSaveStringFlagStates) { - // 1. Initializes the flags. - - // State of flag test_str1: - // default value - "initial" - // current value - "initial" - // not set - true - - SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_VALUE); - // State of flag test_str2: - // default value - "initial" - // current value - "second" - // not set - false - - SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); - // State of flag test_str3: - // default value - "second" - // current value - "second" - // not set - true - - // 2. Saves the flag states. - - { - FlagSaver fs; - - // 3. Modifies the flag states. - - SetCommandLineOptionWithMode("test_str1", "second", SET_FLAGS_VALUE); - EXPECT_EQ("second", FLAGS_test_str1); - // State of flag test_str1: - // default value - "second" - // current value - "second" - // not set - true - - SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str2); - // State of flag test_str2: - // default value - "third" - // current value - "second" - // not set - false - - SetCommandLineOptionWithMode("test_str3", "third", SET_FLAGS_VALUE); - EXPECT_EQ("third", FLAGS_test_str3); - // State of flag test_str1: - // default value - "second" - // current value - "third" - // not set - false - - // 4. Restores the flag states. - } - - // 5. Verifies that the states were restored. - - // Verifies that the value of test_str1 was restored. - EXPECT_EQ("initial", FLAGS_test_str1); - // Verifies that the "not set" attribute of test_str1 was restored to true. - SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str1); - - // Verifies that the value of test_str2 was restored. - EXPECT_EQ("second", FLAGS_test_str2); - // Verifies that the "not set" attribute of test_str2 was restored to false. - SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str2); - - // Verifies that the value of test_str3 was restored. - EXPECT_EQ("second", FLAGS_test_str3); - // Verifies that the "not set" attribute of test_str3 was restored to true. - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("fourth", FLAGS_test_str3); -} - - -// Tests that FlagSaver can save the values of various-typed flags. -TEST(FlagSaverTest, CanSaveVariousTypedFlagValues) { - // Initializes the flags. - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_int64 = -2; - FLAGS_test_uint64 = 3; - FLAGS_test_double = 4.0; - FLAGS_test_string = "good"; - - // Saves the flag states. - { - FlagSaver fs; - - // Modifies the flags. - FLAGS_test_bool = true; - FLAGS_test_int32 = -5; - FLAGS_test_int64 = -6; - FLAGS_test_uint64 = 7; - FLAGS_test_double = 8.0; - FLAGS_test_string = "bad"; - - // Restores the flag states. - } - - // Verifies the flag values were restored. - EXPECT_FALSE(FLAGS_test_bool); - EXPECT_EQ(-1, FLAGS_test_int32); - EXPECT_EQ(-2, FLAGS_test_int64); - EXPECT_EQ(3, FLAGS_test_uint64); - EXPECT_DOUBLE_EQ(4.0, FLAGS_test_double); - EXPECT_EQ("good", FLAGS_test_string); -} - -TEST(GetAllFlagsTest, BaseTest) { - vector flags; - GetAllFlags(&flags); - bool found_test_bool = false; - vector::const_iterator i; - for (i = flags.begin(); i != flags.end(); ++i) { - if (i->name == "test_bool") { - found_test_bool = true; - EXPECT_EQ(i->type, "bool"); - EXPECT_EQ(i->default_value, "false"); - EXPECT_EQ(i->flag_ptr, &FLAGS_test_bool); - break; - } - } - EXPECT_TRUE(found_test_bool); -} - -TEST(ShowUsageWithFlagsTest, BaseTest) { - // TODO(csilvers): test this by allowing output other than to stdout. - // Not urgent since this functionality is tested via - // gflags_unittest.sh, though only through use of --help. -} - -TEST(ShowUsageWithFlagsRestrictTest, BaseTest) { - // TODO(csilvers): test this by allowing output other than to stdout. - // Not urgent since this functionality is tested via - // gflags_unittest.sh, though only through use of --helpmatch. -} - -// Note: all these argv-based tests depend on SetArgv being called -// before ParseCommandLineFlags() in main(), below. -TEST(GetArgvsTest, BaseTest) { - vector argvs = GetArgvs(); - EXPECT_EQ(4, argvs.size()); - EXPECT_EQ("/test/argv/for/gflags_unittest", argvs[0]); - EXPECT_EQ("argv 2", argvs[1]); - EXPECT_EQ("3rd argv", argvs[2]); - EXPECT_EQ("argv #4", argvs[3]); -} - -TEST(GetArgvTest, BaseTest) { - EXPECT_STREQ("/test/argv/for/gflags_unittest " - "argv 2 3rd argv argv #4", GetArgv()); -} - -TEST(GetArgv0Test, BaseTest) { - EXPECT_STREQ("/test/argv/for/gflags_unittest", GetArgv0()); -} - -TEST(GetArgvSumTest, BaseTest) { - // This number is just the sum of the ASCII values of all the chars - // in GetArgv(). - EXPECT_EQ(4904, GetArgvSum()); -} - -TEST(ProgramInvocationNameTest, BaseTest) { - EXPECT_STREQ("/test/argv/for/gflags_unittest", - ProgramInvocationName()); -} - -TEST(ProgramInvocationShortNameTest, BaseTest) { - EXPECT_STREQ("gflags_unittest", ProgramInvocationShortName()); -} - -TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to ParseCommandLineFlags() - EXPECT_STREQ("/test/argv/for/gflags_unittest: " - " [...]\nDoes something useless.\n", - ProgramUsage()); -} - -TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) { - string value("will be changed"); - bool r = GetCommandLineOption("test_bool", &value); - EXPECT_TRUE(r); - EXPECT_EQ("false", value); - - r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("-1", value); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) { - FLAGS_test_int32 = 400; - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("400", value); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasSet) { - SetCommandLineOption("test_int32", "700"); - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("700", value); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) { - // This doesn't set the flag's value, but rather its default value. - // is_default is still true, but the 'default' value returned has changed! - SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT); - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("800", value); - EXPECT_TRUE(GetCommandLineFlagInfoOrDie("test_int32").is_default); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) { - SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT); - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("900", value); -} - -TEST(GetCommandLineOptionTest, NameDoesNotExist) { - string value("will not be changed"); - const bool r = GetCommandLineOption("test_int3210", &value); - EXPECT_FALSE(r); - EXPECT_EQ("will not be changed", value); -} - -TEST(GetCommandLineFlagInfoTest, FlagExists) { - CommandLineFlagInfo info; - bool r = GetCommandLineFlagInfo("test_int32", &info); - EXPECT_TRUE(r); - EXPECT_EQ("test_int32", info.name); - EXPECT_EQ("int32", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("-1", info.current_value); - EXPECT_EQ("-1", info.default_value); - EXPECT_TRUE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); - - FLAGS_test_bool = true; - r = GetCommandLineFlagInfo("test_bool", &info); - EXPECT_TRUE(r); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("true", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_FALSE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); - - FLAGS_test_bool = false; - r = GetCommandLineFlagInfo("test_bool", &info); - EXPECT_TRUE(r); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("false", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_FALSE(info.is_default); // value is same, but flag *was* modified - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); -} - -TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) { - CommandLineFlagInfo info; - // Set to some random values that GetCommandLineFlagInfo should not change - info.name = "name"; - info.type = "type"; - info.current_value = "curr"; - info.default_value = "def"; - info.filename = "/"; - info.is_default = false; - info.has_validator_fn = true; - info.flag_ptr = NULL; - bool r = GetCommandLineFlagInfo("test_int3210", &info); - EXPECT_FALSE(r); - EXPECT_EQ("name", info.name); - EXPECT_EQ("type", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("curr", info.current_value); - EXPECT_EQ("def", info.default_value); - EXPECT_EQ("/", info.filename); - EXPECT_FALSE(info.is_default); - EXPECT_TRUE(info.has_validator_fn); - EXPECT_EQ(NULL, info.flag_ptr); -} - -TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) { - CommandLineFlagInfo info; - info = GetCommandLineFlagInfoOrDie("test_int32"); - EXPECT_EQ("test_int32", info.name); - EXPECT_EQ("int32", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("-1", info.current_value); - EXPECT_EQ("-1", info.default_value); - EXPECT_TRUE(info.is_default); - EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); - info = GetCommandLineFlagInfoOrDie("test_bool"); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("false", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_TRUE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); -} - -TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) { - FLAGS_test_int32 = 400; - CommandLineFlagInfo info; - info = GetCommandLineFlagInfoOrDie("test_int32"); - EXPECT_EQ("test_int32", info.name); - EXPECT_EQ("int32", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("400", info.current_value); - EXPECT_EQ("-1", info.default_value); - EXPECT_FALSE(info.is_default); - EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); - FLAGS_test_bool = true; - info = GetCommandLineFlagInfoOrDie("test_bool"); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("true", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_FALSE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(GetCommandLineFlagInfoOrDieDeathTest, FlagDoesNotExist) { - EXPECT_DEATH(GetCommandLineFlagInfoOrDie("test_int3210"), - ".*: flag test_int3210 does not exist"); -} -#endif - - -// These are lightly tested because they're deprecated. Basically, -// the tests are meant to cover how existing users use these functions, -// but not necessarily how new users could use them. -TEST(DeprecatedFunctionsTest, CommandlineFlagsIntoString) { - string s = CommandlineFlagsIntoString(); - EXPECT_NE(string::npos, s.find("--test_bool=")); -} - -TEST(DeprecatedFunctionsTest, AppendFlagsIntoFile) { - FLAGS_test_int32 = 10; // just to make the test more interesting - string filename(TmpFile("flagfile")); - unlink(filename.c_str()); // just to be safe - const bool r = AppendFlagsIntoFile(filename, "not the real argv0"); - EXPECT_TRUE(r); - - FILE* fp; - EXPECT_EQ(0, SafeFOpen(&fp, filename.c_str(), "r")); - EXPECT_TRUE(fp != NULL); - char line[8192]; - EXPECT_TRUE(fgets(line, sizeof(line)-1, fp) != NULL); // get the first line - // First line should be progname. - EXPECT_STREQ("not the real argv0\n", line); - - bool found_bool = false, found_int32 = false; - while (fgets(line, sizeof(line)-1, fp)) { - line[sizeof(line)-1] = '\0'; // just to be safe - if (strcmp(line, "--test_bool=false\n") == 0) - found_bool = true; - if (strcmp(line, "--test_int32=10\n") == 0) - found_int32 = true; - } - EXPECT_TRUE(found_int32); - EXPECT_TRUE(found_bool); - fclose(fp); -} - -TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) { - FLAGS_test_int32 = -10; // just to make the test more interesting - string filename(TmpFile("flagfile2")); - unlink(filename.c_str()); // just to be safe - bool r = AppendFlagsIntoFile(filename, GetArgv0()); - EXPECT_TRUE(r); - - FLAGS_test_int32 = -11; - r = ReadFromFlagsFile(filename, GetArgv0(), true); - EXPECT_TRUE(r); - EXPECT_EQ(-10, FLAGS_test_int32); -} // unnamed namespace - -TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) { - FLAGS_test_int32 = -20; - string filename(TmpFile("flagfile3")); - FILE* fp; - EXPECT_EQ(0, SafeFOpen(&fp, filename.c_str(), "w")); - EXPECT_TRUE(fp != NULL); - // Note the error in the bool assignment below... - fprintf(fp, "%s\n--test_int32=-21\n--test_bool=not_a_bool!\n", GetArgv0()); - fclose(fp); - - FLAGS_test_int32 = -22; - const bool r = ReadFromFlagsFile(filename, GetArgv0(), false); - EXPECT_FALSE(r); - EXPECT_EQ(-22, FLAGS_test_int32); // the -21 from the flagsfile didn't take -} - -TEST(FlagsSetBeforeInitTest, TryFromEnv) { - EXPECT_EQ("pre-set", FLAGS_test_tryfromenv); -} - -// The following test case verifies that ParseCommandLineFlags() and -// ParseCommandLineNonHelpFlags() uses the last definition of a flag -// in case it's defined more than once. - -DEFINE_int32(test_flag, -1, "used for testing gflags.cc"); - -// Parses and returns the --test_flag flag. -// If with_help is true, calls ParseCommandLineFlags; otherwise calls -// ParseCommandLineNonHelpFlags. -int32 ParseTestFlag(bool with_help, int argc, const char** const_argv) { - FlagSaver fs; // Restores the flags before returning. - - // Makes a copy of the input array s.t. it can be reused - // (ParseCommandLineFlags() will alter the array). - char** const argv_save = new char*[argc + 1]; - char** argv = argv_save; - memcpy(argv, const_argv, sizeof(*argv)*(argc + 1)); - - if (with_help) { - ParseCommandLineFlags(&argc, &argv, true); - } else { - ParseCommandLineNonHelpFlags(&argc, &argv, true); - } - - delete[] argv_save; - return FLAGS_test_flag; -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedTwiceOnCommandLine) { - const char* argv[] = { - "my_test", - "--test_flag=1", - "--test_flag=2", - NULL, - }; - - EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedTwiceInFlagFile) { - const char* argv[] = { - "my_test", - GetFlagFileFlag(), - NULL, - }; - - EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedInCommandLineAndThenFlagFile) { - const char* argv[] = { - "my_test", - "--test_flag=0", - GetFlagFileFlag(), - NULL, - }; - - EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedInFlagFileAndThenCommandLine) { - const char* argv[] = { - "my_test", - GetFlagFileFlag(), - "--test_flag=3", - NULL, - }; - - EXPECT_EQ(3, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(3, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedInCommandLineAndFlagFileAndThenCommandLine) { - const char* argv[] = { - "my_test", - "--test_flag=0", - GetFlagFileFlag(), - "--test_flag=3", - NULL, - }; - - EXPECT_EQ(3, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(3, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgFirst) { - const char* argv[] = { - "my_test", - "--", - "--test_flag=0", - NULL, - }; - - EXPECT_EQ(-1, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(-1, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgMiddle) { - const char* argv[] = { - "my_test", - "--test_flag=7", - "--", - "--test_flag=0", - NULL, - }; - - EXPECT_EQ(7, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(7, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsAndDashArgs, OneDashArg) { - const char* argv[] = { - "my_test", - "-", - "--test_flag=0", - NULL, - }; - - EXPECT_EQ(0, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(0, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(ParseCommandLineFlagsUnknownFlagDeathTest, - FlagIsCompletelyUnknown) { - const char* argv[] = { - "my_test", - "--this_flag_does_not_exist", - NULL, - }; - - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "unknown command line flag.*"); - EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), - "unknown command line flag.*"); -} - -TEST(ParseCommandLineFlagsUnknownFlagDeathTest, - BoolFlagIsCompletelyUnknown) { - const char* argv[] = { - "my_test", - "--nothis_flag_does_not_exist", - NULL, - }; - - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "unknown command line flag.*"); - EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), - "unknown command line flag.*"); -} - -TEST(ParseCommandLineFlagsUnknownFlagDeathTest, - FlagIsNotABool) { - const char* argv[] = { - "my_test", - "--notest_string", - NULL, - }; - - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "boolean value .* specified for .* command line flag"); - EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), - "boolean value .* specified for .* command line flag"); -} -#endif - -TEST(ParseCommandLineFlagsWrongFields, - DescriptionIsInvalid) { - // These must not be automatic variables, since command line flags - // aren't unregistered and gUnit uses FlagSaver to save and restore - // command line flags' values. If these are on the stack, then when - // later tests attempt to save and restore their values, the stack - // addresses of these variables will be overwritten... Stack smash! - static bool current_storage; - static bool defvalue_storage; - FlagRegisterer fr("flag_name", "bool", 0, "filename", - ¤t_storage, &defvalue_storage); - CommandLineFlagInfo fi; - EXPECT_TRUE(GetCommandLineFlagInfo("flag_name", &fi)); - EXPECT_EQ("", fi.description); - EXPECT_EQ(¤t_storage, fi.flag_ptr); -} - -static bool ValidateTestFlagIs5(const char* flagname, int32 flagval) { - if (flagval == 5) - return true; - printf("%s isn't 5!\n", flagname); - return false; -} - -static bool ValidateTestFlagIs10(const char* flagname, int32 flagval) { - return flagval == 10; -} - - -TEST(FlagsValidator, ValidFlagViaArgv) { - const char* argv[] = { - "my_test", - "--test_flag=5", - NULL, - }; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_EQ(5, ParseTestFlag(true, arraysize(argv) - 1, argv)); - // Undo the flag validator setting - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, ValidFlagViaSetDefault) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", - SET_FLAG_IF_DEFAULT)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, ValidFlagViaSetValue) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - FLAGS_test_flag = 100; // doesn't trigger the validator - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", - SET_FLAGS_VALUE)); - EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", - SET_FLAGS_DEFAULT)); - EXPECT_NE("", SetCommandLineOption("test_flag", "5")); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(FlagsValidatorDeathTest, InvalidFlagViaArgv) { - const char* argv[] = { - "my_test", - "--test_flag=50", - NULL, - }; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "ERROR: failed validation of new value '50' for flag 'test_flag'"); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} -#endif - -TEST(FlagsValidator, InvalidFlagViaSetDefault) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", - SET_FLAG_IF_DEFAULT)); - EXPECT_EQ(-1, FLAGS_test_flag); // the setting-to-50 should have failed - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, InvalidFlagViaSetValue) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - FLAGS_test_flag = 100; // doesn't trigger the validator - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", - SET_FLAGS_VALUE)); - EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", - SET_FLAGS_DEFAULT)); - EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); - EXPECT_EQ(100, FLAGS_test_flag); // the setting-to-50 should have failed - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(FlagsValidatorDeathTest, InvalidFlagNeverSet) { - // If a flag keeps its default value, and that default value is - // invalid, we should die at argv-parse time. - const char* argv[] = { - "my_test", - NULL, - }; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "ERROR: --test_flag must be set on the commandline"); -} -#endif - -TEST(FlagsValidator, InvalidFlagPtr) { - int32 dummy; - EXPECT_FALSE(RegisterFlagValidator(NULL, &ValidateTestFlagIs5)); - EXPECT_FALSE(RegisterFlagValidator(&dummy, &ValidateTestFlagIs5)); -} - -TEST(FlagsValidator, RegisterValidatorTwice) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); - EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, CommandLineFlagInfo) { - CommandLineFlagInfo info; - info = GetCommandLineFlagInfoOrDie("test_flag"); - EXPECT_FALSE(info.has_validator_fn); - - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - info = GetCommandLineFlagInfoOrDie("test_flag"); - EXPECT_TRUE(info.has_validator_fn); - - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); - info = GetCommandLineFlagInfoOrDie("test_flag"); - EXPECT_FALSE(info.has_validator_fn); -} - -TEST(FlagsValidator, FlagSaver) { - { - FlagSaver fs; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // fails validation - } - EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // validator is gone - - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - { - FlagSaver fs; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); - EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // no validator - } - EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // validator is back -} - - -} // unnamed namespace - -int main(int argc, char **argv) { - - // Run unit tests only if called without arguments, otherwise this program - // is used by an "external" usage test - const bool run_tests = (argc == 1); - - // We need to call SetArgv before parsing flags, so our "test" argv will - // win out over this executable's real argv. That makes running this - // test with a real --help flag kinda annoying, unfortunately. - const char* test_argv[] = { "/test/argv/for/gflags_unittest", - "argv 2", "3rd argv", "argv #4" }; - SetArgv(arraysize(test_argv), test_argv); - - // The first arg is the usage message, also important for testing. - string usage_message = (string(GetArgv0()) + - ": [...]\nDoes something useless.\n"); - - // We test setting tryfromenv manually, and making sure - // ParseCommandLineFlags still evaluates it. - FLAGS_tryfromenv = "test_tryfromenv"; - setenv("FLAGS_test_tryfromenv", "pre-set", 1); - - // Modify flag values from declared default value in two ways. - // The recommended way: - SetCommandLineOptionWithMode("changed_bool1", "true", SET_FLAGS_DEFAULT); - - // The non-recommended way: - FLAGS_changed_bool2 = true; - - SetUsageMessage(usage_message.c_str()); - SetVersionString("test_version"); - ParseCommandLineFlags(&argc, &argv, true); - MakeTmpdir(&FLAGS_test_tmpdir); - - int exit_status = 0; - if (run_tests) { - fprintf(stdout, "Running the unit tests now...\n\n"); fflush(stdout); - exit_status = RUN_ALL_TESTS(); - } else fprintf(stderr, "\n\nPASS\n"); - ShutDownCommandLineFlags(); - return exit_status; -} - -} // GFLAGS_NAMESPACE - -int main(int argc, char** argv) { - return GFLAGS_NAMESPACE::main(argc, argv); -} - http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/gflags/test/gflags_unittest_flagfile ---------------------------------------------------------------------- diff --git a/third_party/gflags/test/gflags_unittest_flagfile b/third_party/gflags/test/gflags_unittest_flagfile deleted file mode 100644 index f4fa0c4..0000000 --- a/third_party/gflags/test/gflags_unittest_flagfile +++ /dev/null @@ -1,2 +0,0 @@ ---test_flag=1 ---test_flag=2 http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/gflags/test/nc/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/third_party/gflags/test/nc/CMakeLists.txt b/third_party/gflags/test/nc/CMakeLists.txt deleted file mode 100644 index 823fc67..0000000 --- a/third_party/gflags/test/nc/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -## gflags negative compilation tests - -cmake_minimum_required (VERSION 2.8) - -if (NOT TEST_NAME) - message (FATAL_ERROR "Missing TEST_NAME CMake flag") -endif () -string (TOUPPER ${TEST_NAME} TEST_NAME_UPPER) - -project (gflags_nc_${TEST_NAME}) - -find_package (gflags REQUIRED) -include_directories (${gflags_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/..") -link_libraries (gflags_nothreads) -add_definitions (-DTEST_${TEST_NAME_UPPER}) -add_executable (gflags_nc_${TEST_NAME} gflags_nc.cc) http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/gflags/test/nc/gflags_nc.cc ---------------------------------------------------------------------- diff --git a/third_party/gflags/test/nc/gflags_nc.cc b/third_party/gflags/test/nc/gflags_nc.cc deleted file mode 100644 index 23398f2..0000000 --- a/third_party/gflags/test/nc/gflags_nc.cc +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2009, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * 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. -// -// 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. - -// --- -// -// A negative comiple test for gflags. - -#include - -#if defined(TEST_SWAPPED_ARGS) - -DEFINE_bool(some_bool_flag, - "the default value should go here, not the description", - false); - - -#elif defined(TEST_INT_INSTEAD_OF_BOOL) - -DEFINE_bool(some_bool_flag_2, - 0, - "should have been an int32 flag but mistakenly used bool instead"); - -#elif defined(TEST_BOOL_IN_QUOTES) - - -DEFINE_bool(some_bool_flag_3, - "false", - "false in in quotes, which is wrong"); - -#elif defined(TEST_SANITY) - -DEFINE_bool(some_bool_flag_4, - true, - "this is the correct usage of DEFINE_bool"); - -#elif defined(TEST_DEFINE_STRING_WITH_0) - -DEFINE_string(some_string_flag, - 0, - "Trying to construct a string by passing 0 would cause a crash."); - -#endif - -int main(int, char **) -{ - return 0; -} http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/glog/AUTHORS ---------------------------------------------------------------------- diff --git a/third_party/glog/AUTHORS b/third_party/glog/AUTHORS deleted file mode 100644 index ee92be8..0000000 --- a/third_party/glog/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -opensource@google.com - http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/glog/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/third_party/glog/CMakeLists.txt b/third_party/glog/CMakeLists.txt deleted file mode 100644 index a916b96..0000000 --- a/third_party/glog/CMakeLists.txt +++ /dev/null @@ -1,208 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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 file allows building glog with CMake instead of autotools. glog itself -# is copyright Google, Inc. and is covered by the license described in the -# COPYING file in this directory. - -if(CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare") -endif() - -if (WIN32) - # Windows uses a preprocessed config file and some other wierdness. - set_property( - DIRECTORY - APPEND PROPERTY COMPILE_DEFINITIONS GOOGLE_GLOG_DLL_DECL= - ) - - # Check if snprintf is available. It usually isn't on Windows, but MinGW - # provides it. - include(CheckCXXSymbolExists) - check_cxx_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF) - - # Similarly, check if pid_t is defined in process.h. Usually the answer is no - # on Windows, but MinGW has it. - include(CheckTypeSize) - check_type_size("pid_t" PID_T) - configure_file ( - "${CMAKE_CURRENT_SOURCE_DIR}/src/windows/config_cmake.h.in" - "${CMAKE_CURRENT_BINARY_DIR}/config.h" - ) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) - - include_directories(src/windows) - add_library(glog - src/windows/logging.cc - src/windows/port.cc - src/windows/raw_logging.cc - src/windows/utilities.cc - src/windows/vlog_is_on.cc) -else() - # The big, happy UNIX family (and friends). - - # System headers. - include(CheckIncludeFileCXX) - check_include_file_cxx(dlfcn.h HAVE_DLFCN_H) - check_include_file_cxx(execinfo.h HAVE_EXECINFO_H) - check_include_file_cxx(glob.h HAVE_GLOB_H) - check_include_file_cxx(inttypes.h HAVE_INTTYPES_H) - check_include_file_cxx(libunwind.h HAVE_LIBUNWIND_H) - check_include_file_cxx(memory.h HAVE_MEMORY_H) - check_include_file_cxx(pwd.h HAVE_PWD_H) - check_include_file_cxx(libunwind.h HAVE_LIBUNWIND_H) - check_include_file_cxx(stdint.h HAVE_STDINT_H) - check_include_file_cxx(stdlib.h HAVE_STDLIB_H) - check_include_file_cxx(strings.h HAVE_STRINGS_H) - check_include_file_cxx(string.h HAVE_STRING_H) - check_include_file_cxx(syscall.h HAVE_SYSCALL_H) - check_include_file_cxx(syslog.h HAVE_SYSLOG_H) - check_include_file_cxx(sys/stat.h HAVE_SYS_STAT_H) - check_include_file_cxx(sys/syscall.h HAVE_SYS_SYSCALL_H) - check_include_file_cxx(sys/time.h HAVE_SYS_TIME_H) - check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H) - check_include_file_cxx(sys/ucontext.h HAVE_SYS_UCONTEXT_H) - check_include_file_cxx(sys/utsname.h HAVE_SYS_UTSNAME_H) - check_include_file_cxx(ucontext.h HAVE_UCONTEXT_H) - check_include_file_cxx(unistd.h HAVE_UNISTD_H) - check_include_file_cxx(unwind.h HAVE_UNWIND_H) - - # Check if functions exist. - include(CheckFunctionExists) - check_function_exists(fcntl HAVE_FCNTL) - check_function_exists(sigalstack HAVE_SIGALSTACK) - - # Check if we are using pthreads. - find_package(Threads) - if (CMAKE_HAVE_PTHREAD_H) - set(HAVE_LIBPTHREAD 1) - set(HAVE_PTHREAD 1) - set(HAVE_RWLOCK 1) - endif() - - # Check pointer size. - include(CheckTypeSize) - check_type_size("void*" SIZEOF_VOID_P) - - # Check compiler builtins. - include(CheckCXXSourceCompiles) - - CHECK_CXX_SOURCE_COMPILES(" - int main(int argc, char **argv) { - if (__builtin_expect(argc, 1)) { - return 0; - } else { - return argc; - } - } - " HAVE___BUILTIN_EXPECT) - - CHECK_CXX_SOURCE_COMPILES(" - int numfun(int n) __attribute__((const)); - - int main(int argc, char **argv) { - return numfun(argc); - } - - int numfun(int n) { - return n + 1; - } - " HAVE___ATTRIBUTE__) - - CHECK_CXX_SOURCE_COMPILES(" - int atomicswap(int *ptr, int oldval, int newval) { - return __sync_val_compare_and_swap(ptr, oldval, newval); - } - - int main(int argc, char **argv) { - return atomicswap(&argc, 1, 2); - } - " HAVE___SYNC_VAL_COMPARE_AND_SWAP) - - # Try a bunch of different platform-specific ways to get the program counter - # from a ucontext_t. This particular code snippet is based on Apache-licensed - # code from https://maiter.googlecode.com/svn/trunk/Maiter/cmake/PcFromUcontext.cmake - set(UCONTEXT_INCLUDES) - if (HAVE_SYS_UCONTEXT_H) - set(UCONTEXT_INCLUDES "${UCONTEXT_INCLUDES}\n#include ") - endif() - if (HAVE_UCONTEXT_H) - set(UCONTEXT_INCLUDES "${UCONTEXT_INCLUDES}\n#include ") - endif() - - foreach (pc_field - "uc_mcontext.gregs[REG_EIP]" - "uc_mcontext.gregs[REG_RIP]" - "uc_mcontext.sc_ip" - "uc_mcontext.uc_regs->gregs[PT_NIP]" - "uc_mcontext.gregs[R15]" - "uc_mcontext.arm_pc" - "uc_mcontext.mc_eip" - "uc_mcontext.mc_rip" - "uc_mcontext.__gregs[_REG_EIP]" - "uc_mcontext.__gregs[_REG_RIP]" - "uc_mcontext->ss.eip" - "uc_mcontext->__ss.__eip" - "uc_mcontext->ss.rip" - "uc_mcontext->__ss.__rip" - "uc_mcontext->ss.srr0" - "uc_mcontext->__ss.__srr0") - message(STATUS "Checking program counter fetch from ucontext_t member: ${pc_field}") - - CHECK_CXX_SOURCE_COMPILES(" - ${UCONTEXT_INCLUDES} - int main(int argc, char **argv) { - ucontext_t ctx; - return ctx.${pc_field} == 0; - } - " PC_FROM_UCONTEXT_COMPILES) - - if (PC_FROM_UCONTEXT_COMPILES) - unset(PC_FROM_UCONTEXT_COMPILES CACHE) - message(STATUS "Found program counter field in ucontext_t: ${pc_field}") - set(PC_FROM_UCONTEXT ${pc_field}) - break() - else() - unset(PC_FROM_UCONTEXT_COMPILES CACHE) - endif() - endforeach() - - if (NOT PC_FROM_UCONTEXT) - message(WARNING "Unable to find program counter field in ucontext_t. GLOG " - "signal handler will not be able to report precise PC " - "position.") - endif() - - # Generate config.h - configure_file ( - "${CMAKE_CURRENT_SOURCE_DIR}/src/config_cmake.h.in" - "${CMAKE_CURRENT_BINARY_DIR}/config.h" - ) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) - include_directories(${CMAKE_CURRENT_BINARY_DIR}/..) - - include_directories(src) - add_library(glog - src/demangle.cc - src/logging.cc - src/raw_logging.cc - src/signalhandler.cc - src/symbolize.cc - src/utilities.cc - src/vlog_is_on.cc) - target_link_libraries(glog ${CMAKE_THREAD_LIBS_INIT}) -endif() http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/glog/COPYING ---------------------------------------------------------------------- diff --git a/third_party/glog/COPYING b/third_party/glog/COPYING deleted file mode 100644 index 38396b5..0000000 --- a/third_party/glog/COPYING +++ /dev/null @@ -1,65 +0,0 @@ -Copyright (c) 2008, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * 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. - -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. - - -A function gettimeofday in utilities.cc is based on - -http://www.google.com/codesearch/p?hl=en#dR3YEbitojA/COPYING&q=GetSystemTimeAsFileTime%20license:bsd - -The license of this code is: - -Copyright (c) 2003-2008, Jouni Malinen and contributors -All Rights Reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name(s) of the above-listed copyright holder(s) nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -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. http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/glog/ChangeLog ---------------------------------------------------------------------- diff --git a/third_party/glog/ChangeLog b/third_party/glog/ChangeLog deleted file mode 100644 index d1b4248..0000000 --- a/third_party/glog/ChangeLog +++ /dev/null @@ -1,84 +0,0 @@ -2013-02-01 Google Inc. - - * google-glog: version 0.3.3 - * Add --disable-rtti option for configure. - * Visual Studio build and test fix. - * QNX build fix (thanks vanuan). - * Reduce warnings. - * Fixed LOG_SYSRESULT (thanks ukai). - * FreeBSD build fix (thanks yyanagisawa). - * Clang build fix. - * Now users can re-initialize glog after ShutdownGoogleLogging. - * Color output support by GLOG_colorlogtostderr (thanks alexs). - * Now glog's ABI around flags are compatible with gflags. - * Document mentions how to modify flags from user programs. - -2012-01-12 Google Inc. - - * google-glog: version 0.3.2 - * Clang support. - * Demangler and stacktrace improvement for newer GCCs. - * Now fork(2) doesn't mess up log files. - * Make valgrind happier. - * Reduce warnings for more -W options. - * Provide a workaround for ERROR defined by windows.h. - -2010-06-15 Google Inc. - - * google-glog: version 0.3.1 - * GLOG_* environment variables now work even when gflags is installed. - * Snow leopard support. - * Now we can build and test from out side tree. - * Add DCHECK_NOTNULL. - * Add ShutdownGoogleLogging to close syslog (thanks DGunchev) - * Fix --enable-frame-pointers option (thanks kazuki.ohta) - * Fix libunwind detection (thanks giantchen) - -2009-07-30 Google Inc. - - * google-glog: version 0.3.0 - * Fix a deadlock happened when user uses glog with recent gflags. - * Suppress several unnecessary warnings (thanks keir). - * NetBSD and OpenBSD support. - * Use Win32API GetComputeNameA properly (thanks magila). - * Fix user name detection for Windows (thanks ademin). - * Fix several minor bugs. - -2009-04-10 Google Inc. - * google-glog: version 0.2.1 - * Fix timestamps of VC++ version. - * Add pkg-config support (thanks Tomasz) - * Fix build problem when building with gtest (thanks Michael) - * Add --with-gflags option for configure (thanks Michael) - * Fixes for GCC 4.4 (thanks John) - -2009-01-23 Google Inc. - * google-glog: version 0.2 - * Add initial Windows VC++ support. - * Google testing/mocking frameworks integration. - * Link pthread library automatically. - * Flush logs in signal handlers. - * Add macros LOG_TO_STRING, LOG_AT_LEVEL, DVLOG, and LOG_TO_SINK_ONLY. - * Log microseconds. - * Add --log_backtrace_at option. - * Fix some minor bugs. - -2008-11-18 Google Inc. - * google-glog: version 0.1.2 - * Add InstallFailureSignalHandler(). (satorux) - * Re-organize the way to produce stacktraces. - * Don't define unnecessary macro DISALLOW_EVIL_CONSTRUCTORS. - -2008-10-15 Google Inc. - * google-glog: version 0.1.1 - * Support symbolize for MacOSX 10.5. - * BUG FIX: --vmodule didn't work with gflags. - * BUG FIX: symbolize_unittest failed with GCC 4.3. - * Several fixes on the document. - -2008-10-07 Google Inc. - - * google-glog: initial release: - The glog package contains a library that implements application-level - logging. This library provides logging APIs based on C++-style - streams and various helper macros. http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/glog/INSTALL ---------------------------------------------------------------------- diff --git a/third_party/glog/INSTALL b/third_party/glog/INSTALL deleted file mode 100644 index 0babe24..0000000 --- a/third_party/glog/INSTALL +++ /dev/null @@ -1,297 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006, 2007 Free Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Glog-Specific Install Notes -================================ - -*** NOTE FOR 64-BIT LINUX SYSTEMS - -The glibc built-in stack-unwinder on 64-bit systems has some problems -with the glog libraries. (In particular, if you are using -InstallFailureSignalHandler(), the signal may be raised in the middle -of malloc, holding some malloc-related locks when they invoke the -stack unwinder. The built-in stack unwinder may call malloc -recursively, which may require the thread to acquire a lock it already -holds: deadlock.) - -For that reason, if you use a 64-bit system and you need -InstallFailureSignalHandler(), we strongly recommend you install -libunwind before trying to configure or install google glog. -libunwind can be found at - - http://download.savannah.nongnu.org/releases/libunwind/libunwind-snap-070410.tar.gz - -Even if you already have libunwind installed, you will probably still -need to install from the snapshot to get the latest version. - -CAUTION: if you install libunwind from the URL above, be aware that -you may have trouble if you try to statically link your binary with -glog: that is, if you link with 'gcc -static -lgcc_eh ...'. This -is because both libunwind and libgcc implement the same C++ exception -handling APIs, but they implement them differently on some platforms. -This is not likely to be a problem on ia64, but may be on x86-64. - -Also, if you link binaries statically, make sure that you add --Wl,--eh-frame-hdr to your linker options. This is required so that -libunwind can find the information generated by the compiler required -for stack unwinding. - -Using -static is rare, though, so unless you know this will affect you -it probably won't. - -If you cannot or do not wish to install libunwind, you can still try -to use two kinds of stack-unwinder: 1. glibc built-in stack-unwinder -and 2. frame pointer based stack-unwinder. - -1. As we already mentioned, glibc's unwinder has a deadlock issue. -However, if you don't use InstallFailureSignalHandler() or you don't -worry about the rare possibilities of deadlocks, you can use this -stack-unwinder. If you specify no options and libunwind isn't -detected on your system, the configure script chooses this unwinder by -default. - -2. The frame pointer based stack unwinder requires that your -application, the glog library, and system libraries like libc, all be -compiled with a frame pointer. This is *not* the default for x86-64. - -If you are on x86-64 system, know that you have a set of system -libraries with frame-pointers enabled, and compile all your -applications with -fno-omit-frame-pointer, then you can enable the -frame pointer based stack unwinder by passing the ---enable-frame-pointers flag to configure. - - -Basic Installation -================== - -Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 6. Often, you can also type `make uninstall' to remove the installed - files again. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/glog/NEWS ---------------------------------------------------------------------- diff --git a/third_party/glog/NEWS b/third_party/glog/NEWS deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/glog/README ---------------------------------------------------------------------- diff --git a/third_party/glog/README b/third_party/glog/README deleted file mode 100644 index 77efd37..0000000 --- a/third_party/glog/README +++ /dev/null @@ -1,5 +0,0 @@ -This repository contains a C++ implementation of the Google logging -module. Documentation for the implementation is in doc/. - -See INSTALL for (generic) installation instructions for C++: basically - ./configure && make && make install http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9661f956/third_party/glog/README.windows ---------------------------------------------------------------------- diff --git a/third_party/glog/README.windows b/third_party/glog/README.windows deleted file mode 100644 index 74ff690..0000000 --- a/third_party/glog/README.windows +++ /dev/null @@ -1,26 +0,0 @@ -This project has begun being ported to Windows. A working solution -file exists in this directory: - google-glog.sln - -You can load this solution file into VC++ 9.0 (Visual Studio -2008). You may also be able to use this solution file with older -Visual Studios by converting the solution file. - -Note that stack tracing and some unittests are not ported -yet. - -You can also link glog code in statically -- see the example project -libglog_static and logging_unittest_static, which does this. For this -to work, you'll need to add "/D GOOGLE_GLOG_DLL_DECL=" to the compile -line of every glog's .cc file. - -I have little experience with Windows programming, so there may be -better ways to set this up than I've done! If you run across any -problems, please post to the google-glog Google Group, or report -them on the google-glog Google Code site: - http://groups.google.com/group/google-glog - http://code.google.com/p/google-glog/issues/list - --- Shinichiro Hamaji - -Last modified: 23 January 2009