quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbdeshm...@apache.org
Subject [06/51] [abbrv] [partial] incubator-quickstep git commit: Added shell script to download prerequisite third party libs
Date Thu, 19 Jan 2017 20:06:43 GMT
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/heap-profiler_unittest.cc
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/heap-profiler_unittest.cc b/third_party/gperftools/src/tests/heap-profiler_unittest.cc
deleted file mode 100644
index c71e56b..0000000
--- a/third_party/gperftools/src/tests/heap-profiler_unittest.cc
+++ /dev/null
@@ -1,164 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
-// 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.
-
-// ---
-// Author: Craig Silverstein
-//
-// A small program that just exercises our heap profiler by allocating
-// memory and letting the heap-profiler emit a profile.  We don't test
-// threads (TODO).  By itself, this unittest tests that the heap-profiler
-// doesn't crash on simple programs, but its output can be analyzed by
-// another testing script to actually verify correctness.  See, eg,
-// heap-profiler_unittest.sh.
-
-#include "config_for_unittests.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>                  // for mkdir()
-#include <sys/stat.h>               // for mkdir() on freebsd and os x
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>                 // for fork()
-#endif
-#include <sys/wait.h>               // for wait()
-#include <string>
-#include "base/basictypes.h"
-#include "base/logging.h"
-#include <gperftools/heap-profiler.h>
-
-using std::string;
-
-static const int kMaxCount = 100000;
-int* g_array[kMaxCount];              // an array of int-vectors
-
-static ATTRIBUTE_NOINLINE void Allocate(int start, int end, int size) {
-  for (int i = start; i < end; ++i) {
-    if (i < kMaxCount)
-      g_array[i] = new int[size];
-  }
-}
-
-static ATTRIBUTE_NOINLINE void Allocate2(int start, int end, int size) {
-  for (int i = start; i < end; ++i) {
-    if (i < kMaxCount)
-      g_array[i] = new int[size];
-  }
-}
-
-static void Deallocate(int start, int end) {
-  for (int i = start; i < end; ++i) {
-    delete[] g_array[i];
-    g_array[i] = 0;
-  }
-}
-
-static void TestHeapProfilerStartStopIsRunning() {
-  // If you run this with whole-program heap-profiling on, than
-  // IsHeapProfilerRunning should return true.
-  if (!IsHeapProfilerRunning()) {
-    const char* tmpdir = getenv("TMPDIR");
-    if (tmpdir == NULL)
-      tmpdir = "/tmp";
-    mkdir(tmpdir, 0755);     // if necessary
-    HeapProfilerStart((string(tmpdir) + "/start_stop").c_str());
-    CHECK(IsHeapProfilerRunning());
-
-    Allocate(0, 40, 100);
-    Deallocate(0, 40);
-
-    HeapProfilerStop();
-    CHECK(!IsHeapProfilerRunning());
-  }
-}
-
-static void TestDumpHeapProfiler() {
-  // If you run this with whole-program heap-profiling on, than
-  // IsHeapProfilerRunning should return true.
-  if (!IsHeapProfilerRunning()) {
-    const char* tmpdir = getenv("TMPDIR");
-    if (tmpdir == NULL)
-      tmpdir = "/tmp";
-    mkdir(tmpdir, 0755);     // if necessary
-    HeapProfilerStart((string(tmpdir) + "/dump").c_str());
-    CHECK(IsHeapProfilerRunning());
-
-    Allocate(0, 40, 100);
-    Deallocate(0, 40);
-
-    char* output = GetHeapProfile();
-    free(output);
-    HeapProfilerStop();
-  }
-}
-
-
-int main(int argc, char** argv) {
-  if (argc > 2 || (argc == 2 && argv[1][0] == '-')) {
-    printf("USAGE: %s [number of children to fork]\n", argv[0]);
-    exit(0);
-  }
-  int num_forks = 0;
-  if (argc == 2) {
-    num_forks = atoi(argv[1]);
-  }
-
-  TestHeapProfilerStartStopIsRunning();
-  TestDumpHeapProfiler();
-
-  Allocate(0, 40, 100);
-  Deallocate(0, 40);
-
-  Allocate(0, 40, 100);
-  Allocate(0, 40, 100);
-  Allocate2(40, 400, 1000);
-  Allocate2(400, 1000, 10000);
-  Deallocate(0, 1000);
-
-  Allocate(0, 100, 100000);
-  Deallocate(0, 10);
-  Deallocate(10, 20);
-  Deallocate(90, 100);
-  Deallocate(20, 90);
-
-  while (num_forks-- > 0) {
-    switch (fork()) {
-      case -1:
-        printf("FORK failed!\n");
-        return 1;
-      case 0:             // child
-        return execl(argv[0], argv[0], NULL);   // run child with no args
-      default:
-        wait(NULL);       // we'll let the kids run one at a time
-    }
-  }
-
-  printf("DONE.\n");
-
-  return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/heap-profiler_unittest.sh
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/heap-profiler_unittest.sh b/third_party/gperftools/src/tests/heap-profiler_unittest.sh
deleted file mode 100755
index b4c2e9f..0000000
--- a/third_party/gperftools/src/tests/heap-profiler_unittest.sh
+++ /dev/null
@@ -1,150 +0,0 @@
-#!/bin/sh
-
-# 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.
-
-# ---
-# Author: Craig Silverstein
-#
-# Runs the heap-profiler unittest and makes sure the profile looks appropriate.
-#
-# We run under the assumption that if $HEAP_PROFILER is run with --help,
-# it prints a usage line of the form
-#   USAGE: <actual executable being run> [...]
-#
-# This is because libtool sometimes turns the 'executable' into a
-# shell script which runs an actual binary somewhere else.
-
-# We expect BINDIR and PPROF_PATH to be set in the environment.
-# If not, we set them to some reasonable values
-BINDIR="${BINDIR:-.}"
-PPROF_PATH="${PPROF_PATH:-$BINDIR/src/pprof}"
-
-if [ "x$1" = "x-h" -o "x$1" = "x--help" ]; then
-  echo "USAGE: $0 [unittest dir] [path to pprof]"
-  echo "       By default, unittest_dir=$BINDIR, pprof_path=$PPROF_PATH"
-  exit 1
-fi
-
-HEAP_PROFILER="${1:-$BINDIR/heap-profiler_unittest}"
-PPROF="${2:-$PPROF_PATH}"
-TEST_TMPDIR=/tmp/heap_profile_info
-
-# It's meaningful to the profiler, so make sure we know its state
-unset HEAPPROFILE
-
-rm -rf "$TEST_TMPDIR"
-mkdir "$TEST_TMPDIR" || exit 2
-
-num_failures=0
-
-# Given one profile (to check the contents of that profile) or two
-# profiles (to check the diff between the profiles), and a function
-# name, verify that the function name takes up at least 90% of the
-# allocated memory.  The function name is actually specified first.
-VerifyMemFunction() {
-  function="$1"
-  shift
-
-  # get program name.  Note we have to unset HEAPPROFILE so running
-  # help doesn't overwrite existing profiles.
-  exec=`unset HEAPPROFILE; $HEAP_PROFILER --help | awk '{print $2; exit;}'`
-
-  if [ $# = 2 ]; then
-    [ -f "$1" ] || { echo "Profile not found: $1"; exit 1; }
-    [ -f "$2" ] || { echo "Profile not found: $2"; exit 1; }
-    $PPROF --base="$1" $exec "$2" >"$TEST_TMPDIR/output.pprof" 2>&1
-  else
-    [ -f "$1" ] || { echo "Profile not found: $1"; exit 1; }
-    $PPROF $exec "$1" >"$TEST_TMPDIR/output.pprof" 2>&1
-  fi
-
-  cat "$TEST_TMPDIR/output.pprof" \
-      | tr -d % | awk '$6 ~ /^'$function'$/ && $2 > 90 {exit 1;}'
-  if [ $? != 1 ]; then
-    echo
-    echo "--- Test failed for $function: didn't account for 90% of executable memory"
-    echo "--- Program output:"
-    cat "$TEST_TMPDIR/output"
-    echo "--- pprof output:"
-    cat "$TEST_TMPDIR/output.pprof"
-    echo "---"
-    num_failures=`expr $num_failures + 1`
-  fi
-}
-
-VerifyOutputContains() {
-  text="$1"
-
-  if ! grep "$text" "$TEST_TMPDIR/output" >/dev/null 2>&1; then
-    echo "--- Test failed: output does not contain '$text'"
-    echo "--- Program output:"
-    cat "$TEST_TMPDIR/output"
-    echo "---"
-    num_failures=`expr $num_failures + 1`
-  fi
-}
-
-HEAPPROFILE="$TEST_TMPDIR/test"
-HEAP_PROFILE_INUSE_INTERVAL="10240"   # need this to be 10Kb
-HEAP_PROFILE_ALLOCATION_INTERVAL="$HEAP_PROFILE_INUSE_INTERVAL"
-HEAP_PROFILE_DEALLOCATION_INTERVAL="$HEAP_PROFILE_INUSE_INTERVAL"
-export HEAPPROFILE
-export HEAP_PROFILE_INUSE_INTERVAL
-export HEAP_PROFILE_ALLOCATION_INTERVAL
-export HEAP_PROFILE_DEALLOCATION_INTERVAL
-
-# We make the unittest run a child process, to test that the child
-# process doesn't try to write a heap profile as well and step on the
-# parent's toes.  If it does, we expect the parent-test to fail.
-$HEAP_PROFILER 1 >$TEST_TMPDIR/output 2>&1     # run program, with 1 child proc
-
-VerifyMemFunction Allocate2 "$HEAPPROFILE.1329.heap"
-VerifyMemFunction Allocate "$HEAPPROFILE.1448.heap" "$HEAPPROFILE.1548.heap"
-
-# Check the child process got to emit its own profile as well.
-VerifyMemFunction Allocate2 "$HEAPPROFILE"_*.1329.heap
-VerifyMemFunction Allocate "$HEAPPROFILE"_*.1448.heap "$HEAPPROFILE"_*.1548.heap
-
-# Make sure we logged both about allocating and deallocating memory
-VerifyOutputContains "62 MB allocated"
-VerifyOutputContains "62 MB freed"
-
-# Now try running without --heap_profile specified, to allow
-# testing of the HeapProfileStart/Stop functionality.
-$HEAP_PROFILER >"$TEST_TMPDIR/output2" 2>&1
-
-rm -rf $TMPDIR      # clean up
-
-if [ $num_failures = 0 ]; then
-  echo "PASS"
-else
-  echo "Tests finished with $num_failures failures"
-fi
-exit $num_failures

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/large_heap_fragmentation_unittest.cc
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/large_heap_fragmentation_unittest.cc b/third_party/gperftools/src/tests/large_heap_fragmentation_unittest.cc
deleted file mode 100644
index 0886599..0000000
--- a/third_party/gperftools/src/tests/large_heap_fragmentation_unittest.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
-// 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.
-
-// This is a unit test for exercising fragmentation of large (over 1
-// meg) page spans. It makes sure that allocations/releases of
-// increasing memory chunks do not blowup memory
-// usage. See also https://code.google.com/p/gperftools/issues/detail?id=368
-
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "base/logging.h"
-#include "common.h"
-#include <gperftools/malloc_extension.h>
-
-
-int main (int argc, char** argv) {
-  for (int pass = 1; pass <= 3; pass++) {
-    size_t size = 100*1024*1024;
-    while (size < 500*1024*1024) {
-      void *ptr = malloc(size);
-      free(ptr);
-      size += 20000;
-
-      size_t heap_size = static_cast<size_t>(-1);
-      MallocExtension::instance()->GetNumericProperty("generic.heap_size",
-                                                      &heap_size);
-
-
-      CHECK_LT(heap_size, 1*1024*1024*1024);
-    }
-  }
-
-  printf("PASS\n");
-  return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/low_level_alloc_unittest.cc
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/low_level_alloc_unittest.cc b/third_party/gperftools/src/tests/low_level_alloc_unittest.cc
deleted file mode 100644
index e3cb555..0000000
--- a/third_party/gperftools/src/tests/low_level_alloc_unittest.cc
+++ /dev/null
@@ -1,197 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
-/* Copyright (c) 2006, 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 test for low_level_alloc.cc
-
-#include <stdio.h>
-#include <map>
-#include "base/low_level_alloc.h"
-#include "base/logging.h"
-#include <gperftools/malloc_hook.h>
-
-using std::map;
-
-// a block of memory obtained from the allocator
-struct BlockDesc {
-  char *ptr;      // pointer to memory
-  int len;        // number of bytes
-  int fill;       // filled with data starting with this
-};
-
-// Check that the pattern placed in the block d
-// by RandomizeBlockDesc is still there.
-static void CheckBlockDesc(const BlockDesc &d) {
-  for (int i = 0; i != d.len; i++) {
-    CHECK((d.ptr[i] & 0xff) == ((d.fill + i) & 0xff));
-  }
-}
-
-// Fill the block "*d" with a pattern
-// starting with a random byte.
-static void RandomizeBlockDesc(BlockDesc *d) {
-  d->fill = rand() & 0xff;
-  for (int i = 0; i != d->len; i++) {
-    d->ptr[i] = (d->fill + i) & 0xff;
-  }
-}
-
-// Use to indicate to the malloc hooks that
-// this calls is from LowLevelAlloc.
-static bool using_low_level_alloc = false;
-
-// n times, toss a coin, and based on the outcome
-// either allocate a new block or deallocate an old block.
-// New blocks are placed in a map with a random key
-// and initialized with RandomizeBlockDesc().
-// If keys conflict, the older block is freed.
-// Old blocks are always checked with CheckBlockDesc()
-// before being freed.  At the end of the run,
-// all remaining allocated blocks are freed.
-// If use_new_arena is true, use a fresh arena, and then delete it.
-// If call_malloc_hook is true and user_arena is true,
-// allocations and deallocations are reported via the MallocHook
-// interface.
-static void Test(bool use_new_arena, bool call_malloc_hook, int n) {
-  typedef map<int, BlockDesc> AllocMap;
-  AllocMap allocated;
-  AllocMap::iterator it;
-  BlockDesc block_desc;
-  int rnd;
-  LowLevelAlloc::Arena *arena = 0;
-  if (use_new_arena) {
-    int32 flags = call_malloc_hook?  LowLevelAlloc::kCallMallocHook :  0;
-    arena = LowLevelAlloc::NewArena(flags, LowLevelAlloc::DefaultArena());
-  }
-  for (int i = 0; i != n; i++) {
-    if (i != 0 && i % 10000 == 0) {
-      printf(".");
-      fflush(stdout);
-    }
-
-    switch(rand() & 1) {      // toss a coin
-    case 0:     // coin came up heads: add a block
-      using_low_level_alloc = true;
-      block_desc.len = rand() & 0x3fff;
-      block_desc.ptr =
-        reinterpret_cast<char *>(
-                        arena == 0
-                        ? LowLevelAlloc::Alloc(block_desc.len)
-                        : LowLevelAlloc::AllocWithArena(block_desc.len, arena));
-      using_low_level_alloc = false;
-      RandomizeBlockDesc(&block_desc);
-      rnd = rand();
-      it = allocated.find(rnd);
-      if (it != allocated.end()) {
-        CheckBlockDesc(it->second);
-        using_low_level_alloc = true;
-        LowLevelAlloc::Free(it->second.ptr);
-        using_low_level_alloc = false;
-        it->second = block_desc;
-      } else {
-        allocated[rnd] = block_desc;
-      }
-      break;
-    case 1:     // coin came up tails: remove a block
-      it = allocated.begin();
-      if (it != allocated.end()) {
-        CheckBlockDesc(it->second);
-        using_low_level_alloc = true;
-        LowLevelAlloc::Free(it->second.ptr);
-        using_low_level_alloc = false;
-        allocated.erase(it);
-      }
-      break;
-    }
-  }
-  // remove all remaniing blocks
-  while ((it = allocated.begin()) != allocated.end()) {
-    CheckBlockDesc(it->second);
-    using_low_level_alloc = true;
-    LowLevelAlloc::Free(it->second.ptr);
-    using_low_level_alloc = false;
-    allocated.erase(it);
-  }
-  if (use_new_arena) {
-    CHECK(LowLevelAlloc::DeleteArena(arena));
-  }
-}
-
-// used for counting allocates and frees
-static int32 allocates;
-static int32 frees;
-
-// called on each alloc if kCallMallocHook specified
-static void AllocHook(const void *p, size_t size) {
-  if (using_low_level_alloc) {
-    allocates++;
-  }
-}
-
-// called on each free if kCallMallocHook specified
-static void FreeHook(const void *p) {
-  if (using_low_level_alloc) {
-    frees++;
-  }
-}
-
-int main(int argc, char *argv[]) {
-  // This is needed by maybe_threads_unittest.sh, which parses argv[0]
-  // to figure out what directory low_level_alloc_unittest is in.
-  if (argc != 1) {
-    fprintf(stderr, "USAGE: %s\n", argv[0]);
-    return 1;
-  }
-
-  CHECK(MallocHook::AddNewHook(&AllocHook));
-  CHECK(MallocHook::AddDeleteHook(&FreeHook));
-  CHECK_EQ(allocates, 0);
-  CHECK_EQ(frees, 0);
-  Test(false, false, 50000);
-  CHECK_NE(allocates, 0);   // default arena calls hooks
-  CHECK_NE(frees, 0);
-  for (int i = 0; i != 16; i++) {
-    bool call_hooks = ((i & 1) == 1);
-    allocates = 0;
-    frees = 0;
-    Test(true, call_hooks, 15000);
-    if (call_hooks) {
-      CHECK_GT(allocates, 5000); // arena calls hooks
-      CHECK_GT(frees, 5000);
-    } else {
-      CHECK_EQ(allocates, 0);    // arena doesn't call hooks
-      CHECK_EQ(frees, 0);
-    }
-  }
-  printf("\nPASS\n");
-  CHECK(MallocHook::RemoveNewHook(&AllocHook));
-  CHECK(MallocHook::RemoveDeleteHook(&FreeHook));
-  return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/malloc_extension_c_test.c
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/malloc_extension_c_test.c b/third_party/gperftools/src/tests/malloc_extension_c_test.c
deleted file mode 100644
index 278fdb7..0000000
--- a/third_party/gperftools/src/tests/malloc_extension_c_test.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-/* 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.
- *
- * ---
- * Author: Craig Silverstein
- *
- * This tests the c shims: malloc_extension_c.h and malloc_hook_c.h.
- * Mostly, we'll just care that these shims compile under gcc
- * (*not* g++!)
- *
- * NOTE: this is C code, not C++ code!
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>   /* for size_t */
-#include <gperftools/malloc_extension_c.h>
-#include <gperftools/malloc_hook_c.h>
-
-#define FAIL(msg) do {                          \
-  fprintf(stderr, "FATAL ERROR: %s\n", msg);    \
-  exit(1);                                      \
-} while (0)
-
-static int g_new_hook_calls = 0;
-static int g_delete_hook_calls = 0;
-
-void TestNewHook(const void* ptr, size_t size) {
-  g_new_hook_calls++;
-}
-
-void TestDeleteHook(const void* ptr) {
-  g_delete_hook_calls++;
-}
-
-static
-void *forced_malloc(size_t size)
-{
-  extern void *tc_malloc(size_t);
-  void *rv = tc_malloc(size);
-  if (!rv) {
-    FAIL("malloc is not supposed to fail here");
-  }
-  return rv;
-}
-
-void TestMallocHook(void) {
-  /* TODO(csilvers): figure out why we get:
-   * E0100 00:00:00.000000  7383 malloc_hook.cc:244] RAW: google_malloc section is missing, thus InHookCaller is broken!
-   */
-#if 0
-  void* result[5];
-
-  if (MallocHook_GetCallerStackTrace(result, sizeof(result)/sizeof(*result),
-                                     0) < 2) {  /* should have this and main */
-    FAIL("GetCallerStackTrace failed");
-  }
-#endif
-
-  if (!MallocHook_AddNewHook(&TestNewHook)) {
-    FAIL("Failed to add new hook");
-  }
-  if (!MallocHook_AddDeleteHook(&TestDeleteHook)) {
-    FAIL("Failed to add delete hook");
-  }
-
-  free(forced_malloc(10));
-  free(forced_malloc(20));
-  if (g_new_hook_calls != 2) {
-    FAIL("Wrong number of calls to the new hook");
-  }
-  if (g_delete_hook_calls != 2) {
-    FAIL("Wrong number of calls to the delete hook");
-  }
-  if (!MallocHook_RemoveNewHook(&TestNewHook)) {
-    FAIL("Failed to remove new hook");
-  }
-  if (!MallocHook_RemoveDeleteHook(&TestDeleteHook)) {
-    FAIL("Failed to remove delete hook");
-  }
-
-  free(forced_malloc(10));
-  free(forced_malloc(20));
-  if (g_new_hook_calls != 2) {
-    FAIL("Wrong number of calls to the new hook");
-  }
-
-  MallocHook_SetNewHook(&TestNewHook);
-  MallocHook_SetDeleteHook(&TestDeleteHook);
-
-  free(forced_malloc(10));
-  free(forced_malloc(20));
-  if (g_new_hook_calls != 4) {
-    FAIL("Wrong number of calls to the singular new hook");
-  }
-
-  if (MallocHook_SetNewHook(NULL) == NULL) {
-    FAIL("Failed to set new hook");
-  }
-  if (MallocHook_SetDeleteHook(NULL) == NULL) {
-    FAIL("Failed to set delete hook");
-  }
-}
-
-void TestMallocExtension(void) {
-  int blocks;
-  size_t total;
-  int hist[64];
-  char buffer[200];
-  char* x = (char*)malloc(10);
-
-  MallocExtension_VerifyAllMemory();
-  MallocExtension_VerifyMallocMemory(x);
-  MallocExtension_MallocMemoryStats(&blocks, &total, hist);
-  MallocExtension_GetStats(buffer, sizeof(buffer));
-  if (!MallocExtension_GetNumericProperty("generic.current_allocated_bytes",
-                                          &total)) {
-    FAIL("GetNumericProperty failed for generic.current_allocated_bytes");
-  }
-  if (total < 10) {
-    FAIL("GetNumericProperty had bad return for generic.current_allocated_bytes");
-  }
-  if (!MallocExtension_GetNumericProperty("generic.current_allocated_bytes",
-                                          &total)) {
-    FAIL("GetNumericProperty failed for generic.current_allocated_bytes");
-  }
-  MallocExtension_MarkThreadIdle();
-  MallocExtension_MarkThreadBusy();
-  MallocExtension_ReleaseToSystem(1);
-  MallocExtension_ReleaseFreeMemory();
-  if (MallocExtension_GetEstimatedAllocatedSize(10) < 10) {
-    FAIL("GetEstimatedAllocatedSize returned a bad value (too small)");
-  }
-  if (MallocExtension_GetAllocatedSize(x) < 10) {
-    FAIL("GetEstimatedAllocatedSize returned a bad value (too small)");
-  }
-  if (MallocExtension_GetOwnership(x) != MallocExtension_kOwned) {
-    FAIL("DidAllocatePtr returned a bad value (kNotOwned)");
-  }
-  /* TODO(csilvers): this relies on undocumented behavior that
-     GetOwnership works on stack-allocated variables.  Use a better test. */
-  if (MallocExtension_GetOwnership(hist) != MallocExtension_kNotOwned) {
-    FAIL("DidAllocatePtr returned a bad value (kOwned)");
-  }
-
-  free(x);
-}
-
-int main(int argc, char** argv) {
-  TestMallocHook();
-  TestMallocExtension();
-
-  printf("PASS\n");
-  return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/malloc_extension_test.cc
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/malloc_extension_test.cc b/third_party/gperftools/src/tests/malloc_extension_test.cc
deleted file mode 100644
index 31c4968..0000000
--- a/third_party/gperftools/src/tests/malloc_extension_test.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
-// 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.
-
-// ---
-// Author: Craig Silverstein
-//
-// Simple test of malloc_extension.  Includes test of C shims.
-
-#include "config_for_unittests.h"
-#include <stdio.h>
-#include <sys/types.h>
-#include "base/logging.h"
-#include <gperftools/malloc_extension.h>
-#include <gperftools/malloc_extension_c.h>
-
-int main(int argc, char** argv) {
-  void* a = malloc(1000);
-
-  size_t cxx_bytes_used, c_bytes_used;
-  ASSERT_TRUE(MallocExtension::instance()->GetNumericProperty(
-      "generic.current_allocated_bytes", &cxx_bytes_used));
-  ASSERT_TRUE(MallocExtension_GetNumericProperty(
-      "generic.current_allocated_bytes", &c_bytes_used));
-  ASSERT_GT(cxx_bytes_used, 1000);
-  ASSERT_EQ(cxx_bytes_used, c_bytes_used);
-
-  ASSERT_TRUE(MallocExtension::instance()->VerifyAllMemory());
-  ASSERT_TRUE(MallocExtension_VerifyAllMemory());
-
-  ASSERT_EQ(MallocExtension::kOwned,
-            MallocExtension::instance()->GetOwnership(a));
-  // TODO(csilvers): this relies on undocumented behavior that
-  // GetOwnership works on stack-allocated variables.  Use a better test.
-  ASSERT_EQ(MallocExtension::kNotOwned,
-            MallocExtension::instance()->GetOwnership(&cxx_bytes_used));
-  ASSERT_EQ(MallocExtension::kNotOwned,
-            MallocExtension::instance()->GetOwnership(NULL));
-  ASSERT_GE(MallocExtension::instance()->GetAllocatedSize(a), 1000);
-  // This is just a sanity check.  If we allocated too much, tcmalloc is broken
-  ASSERT_LE(MallocExtension::instance()->GetAllocatedSize(a), 5000);
-  ASSERT_GE(MallocExtension::instance()->GetEstimatedAllocatedSize(1000), 1000);
-
-  for (int i = 0; i < 10; ++i) {
-    void *p = malloc(i);
-    ASSERT_GE(MallocExtension::instance()->GetAllocatedSize(p),
-             MallocExtension::instance()->GetEstimatedAllocatedSize(i));
-    free(p);
-  }
-
-  // Check the c-shim version too.
-  ASSERT_EQ(MallocExtension_kOwned, MallocExtension_GetOwnership(a));
-  ASSERT_EQ(MallocExtension_kNotOwned,
-            MallocExtension_GetOwnership(&cxx_bytes_used));
-  ASSERT_EQ(MallocExtension_kNotOwned, MallocExtension_GetOwnership(NULL));
-  ASSERT_GE(MallocExtension_GetAllocatedSize(a), 1000);
-  ASSERT_LE(MallocExtension_GetAllocatedSize(a), 5000);
-  ASSERT_GE(MallocExtension_GetEstimatedAllocatedSize(1000), 1000);
-
-  free(a);
-
-  // Verify that the .cc file and .h file have the same enum values.
-  ASSERT_EQ(static_cast<int>(MallocExtension::kUnknownOwnership),
-            static_cast<int>(MallocExtension_kUnknownOwnership));
-  ASSERT_EQ(static_cast<int>(MallocExtension::kOwned),
-            static_cast<int>(MallocExtension_kOwned));
-  ASSERT_EQ(static_cast<int>(MallocExtension::kNotOwned),
-            static_cast<int>(MallocExtension_kNotOwned));
-
-  printf("DONE\n");
-  return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/malloc_hook_test.cc
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/malloc_hook_test.cc b/third_party/gperftools/src/tests/malloc_hook_test.cc
deleted file mode 100644
index a5cd860..0000000
--- a/third_party/gperftools/src/tests/malloc_hook_test.cc
+++ /dev/null
@@ -1,367 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
-// Copyright (c) 2011, 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.
-
-// ----
-// Author: llib@google.com (Bill Clarke)
-
-#include "config_for_unittests.h"
-#include <assert.h>
-#include <stdio.h>
-#ifdef HAVE_MMAP
-#include <sys/mman.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>    // for sleep()
-#endif
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <gperftools/malloc_hook.h>
-#include "malloc_hook-inl.h"
-#include "base/logging.h"
-#include "base/simple_mutex.h"
-#include "base/sysinfo.h"
-#include "tests/testutil.h"
-
-// On systems (like freebsd) that don't define MAP_ANONYMOUS, use the old
-// form of the name instead.
-#ifndef MAP_ANONYMOUS
-# define MAP_ANONYMOUS MAP_ANON
-#endif
-
-namespace {
-
-using std::string;
-using std::vector;
-
-vector<void (*)()> g_testlist;  // the tests to run
-
-#define TEST(a, b)                                      \
-  struct Test_##a##_##b {                               \
-    Test_##a##_##b() { g_testlist.push_back(&Run); }    \
-    static void Run();                                  \
-  };                                                    \
-  static Test_##a##_##b g_test_##a##_##b;               \
-  void Test_##a##_##b::Run()
-
-
-static int RUN_ALL_TESTS() {
-  vector<void (*)()>::const_iterator it;
-  for (it = g_testlist.begin(); it != g_testlist.end(); ++it) {
-    (*it)();   // The test will error-exit if there's a problem.
-  }
-  fprintf(stderr, "\nPassed %d tests\n\nPASS\n",
-          static_cast<int>(g_testlist.size()));
-  return 0;
-}
-
-void Sleep(int seconds) {
-#ifdef _MSC_VER
-  _sleep(seconds * 1000);   // Windows's _sleep takes milliseconds argument
-#else
-  sleep(seconds);
-#endif
-}
-
-using std::min;
-using base::internal::kHookListMaxValues;
-
-// Since HookList is a template and is defined in malloc_hook.cc, we can only
-// use an instantiation of it from malloc_hook.cc.  We then reinterpret those
-// values as integers for testing.
-typedef base::internal::HookList<MallocHook::NewHook> TestHookList;
-
-int TestHookList_Traverse(const TestHookList& list, uintptr_t* output_array, int n) {
-  MallocHook::NewHook values_as_hooks[kHookListMaxValues];
-  int result = list.Traverse(values_as_hooks, min(n, kHookListMaxValues));
-  for (int i = 0; i < result; ++i) {
-    output_array[i] = reinterpret_cast<const uintptr_t>(*values_as_hooks[i]);
-  }
-  return result;
-}
-
-bool TestHookList_Add(TestHookList* list, int val) {
-  return list->Add(reinterpret_cast<MallocHook::NewHook>(val));
-}
-
-bool TestHookList_Remove(TestHookList* list, int val) {
-  return list->Remove(reinterpret_cast<MallocHook::NewHook>(val));
-}
-
-// Note that this is almost the same as INIT_HOOK_LIST in malloc_hook.cc without
-// the cast.
-#define INIT_HOOK_LIST(initial_value) { 1, { initial_value } }
-
-TEST(HookListTest, InitialValueExists) {
-  TestHookList list = INIT_HOOK_LIST(69);
-  uintptr_t values[2] = { 0, 0 };
-  EXPECT_EQ(1, TestHookList_Traverse(list, values, 2));
-  EXPECT_EQ(69, values[0]);
-  EXPECT_EQ(1, list.priv_end);
-}
-
-TEST(HookListTest, CanRemoveInitialValue) {
-  TestHookList list = INIT_HOOK_LIST(69);
-  ASSERT_TRUE(TestHookList_Remove(&list, 69));
-  EXPECT_EQ(0, list.priv_end);
-
-  uintptr_t values[2] = { 0, 0 };
-  EXPECT_EQ(0, TestHookList_Traverse(list, values, 2));
-}
-
-TEST(HookListTest, AddAppends) {
-  TestHookList list = INIT_HOOK_LIST(69);
-  ASSERT_TRUE(TestHookList_Add(&list, 42));
-  EXPECT_EQ(2, list.priv_end);
-
-  uintptr_t values[2] = { 0, 0 };
-  EXPECT_EQ(2, TestHookList_Traverse(list, values, 2));
-  EXPECT_EQ(69, values[0]);
-  EXPECT_EQ(42, values[1]);
-}
-
-TEST(HookListTest, RemoveWorksAndWillClearSize) {
-  TestHookList list = INIT_HOOK_LIST(69);
-  ASSERT_TRUE(TestHookList_Add(&list, 42));
-
-  ASSERT_TRUE(TestHookList_Remove(&list, 69));
-  EXPECT_EQ(2, list.priv_end);
-
-  uintptr_t values[2] = { 0, 0 };
-  EXPECT_EQ(1, TestHookList_Traverse(list, values, 2));
-  EXPECT_EQ(42, values[0]);
-
-  ASSERT_TRUE(TestHookList_Remove(&list, 42));
-  EXPECT_EQ(0, list.priv_end);
-  EXPECT_EQ(0, TestHookList_Traverse(list, values, 2));
-}
-
-TEST(HookListTest, AddPrependsAfterRemove) {
-  TestHookList list = INIT_HOOK_LIST(69);
-  ASSERT_TRUE(TestHookList_Add(&list, 42));
-
-  ASSERT_TRUE(TestHookList_Remove(&list, 69));
-  EXPECT_EQ(2, list.priv_end);
-
-  ASSERT_TRUE(TestHookList_Add(&list, 7));
-  EXPECT_EQ(2, list.priv_end);
-
-  uintptr_t values[2] = { 0, 0 };
-  EXPECT_EQ(2, TestHookList_Traverse(list, values, 2));
-  EXPECT_EQ(7, values[0]);
-  EXPECT_EQ(42, values[1]);
-}
-
-TEST(HookListTest, InvalidAddRejected) {
-  TestHookList list = INIT_HOOK_LIST(69);
-  EXPECT_FALSE(TestHookList_Add(&list, 0));
-
-  uintptr_t values[2] = { 0, 0 };
-  EXPECT_EQ(1, TestHookList_Traverse(list, values, 2));
-  EXPECT_EQ(69, values[0]);
-  EXPECT_EQ(1, list.priv_end);
-}
-
-TEST(HookListTest, FillUpTheList) {
-  TestHookList list = INIT_HOOK_LIST(69);
-  int num_inserts = 0;
-  while (TestHookList_Add(&list, ++num_inserts))
-    ;
-  EXPECT_EQ(kHookListMaxValues, num_inserts);
-  EXPECT_EQ(kHookListMaxValues, list.priv_end);
-
-  uintptr_t values[kHookListMaxValues + 1];
-  EXPECT_EQ(kHookListMaxValues, TestHookList_Traverse(list, values,
-                                                      kHookListMaxValues));
-  EXPECT_EQ(69, values[0]);
-  for (int i = 1; i < kHookListMaxValues; ++i) {
-    EXPECT_EQ(i, values[i]);
-  }
-}
-
-void MultithreadedTestThread(TestHookList* list, int shift,
-                             int thread_num) {
-  string message;
-  char buf[64];
-  for (int i = 1; i < 1000; ++i) {
-    // In each loop, we insert a unique value, check it exists, remove it, and
-    // check it doesn't exist.  We also record some stats to log at the end of
-    // each thread.  Each insertion location and the length of the list is
-    // non-deterministic (except for the very first one, over all threads, and
-    // after the very last one the list should be empty).
-    int value = (i << shift) + thread_num;
-    EXPECT_TRUE(TestHookList_Add(list, value));
-    sched_yield();  // Ensure some more interleaving.
-    uintptr_t values[kHookListMaxValues + 1];
-    int num_values = TestHookList_Traverse(*list, values, kHookListMaxValues);
-    EXPECT_LT(0, num_values);
-    int value_index;
-    for (value_index = 0;
-         value_index < num_values && values[value_index] != value;
-         ++value_index)
-      ;
-    EXPECT_LT(value_index, num_values);  // Should have found value.
-    snprintf(buf, sizeof(buf), "[%d/%d; ", value_index, num_values);
-    message += buf;
-    sched_yield();
-    EXPECT_TRUE(TestHookList_Remove(list, value));
-    sched_yield();
-    num_values = TestHookList_Traverse(*list, values, kHookListMaxValues);
-    for (value_index = 0;
-         value_index < num_values && values[value_index] != value;
-         ++value_index)
-      ;
-    EXPECT_EQ(value_index, num_values);  // Should not have found value.
-    snprintf(buf, sizeof(buf), "%d]", num_values);
-    message += buf;
-    sched_yield();
-  }
-  fprintf(stderr, "thread %d: %s\n", thread_num, message.c_str());
-}
-
-static volatile int num_threads_remaining;
-static TestHookList list = INIT_HOOK_LIST(69);
-static Mutex threadcount_lock;
-
-void MultithreadedTestThreadRunner(int thread_num) {
-  // Wait for all threads to start running.
-  {
-    MutexLock ml(&threadcount_lock);
-    assert(num_threads_remaining > 0);
-    --num_threads_remaining;
-
-    // We should use condvars and the like, but for this test, we'll
-    // go simple and busy-wait.
-    while (num_threads_remaining > 0) {
-      threadcount_lock.Unlock();
-      Sleep(1);
-      threadcount_lock.Lock();
-    }
-  }
-
-  // shift is the smallest number such that (1<<shift) > kHookListMaxValues
-  int shift = 0;
-  for (int i = kHookListMaxValues; i > 0; i >>= 1)
-    shift += 1;
-
-  MultithreadedTestThread(&list, shift, thread_num);
-}
-
-
-TEST(HookListTest, MultithreadedTest) {
-  ASSERT_TRUE(TestHookList_Remove(&list, 69));
-  ASSERT_EQ(0, list.priv_end);
-
-  // Run kHookListMaxValues thread, each running MultithreadedTestThread.
-  // First, we need to set up the rest of the globals.
-  num_threads_remaining = kHookListMaxValues;   // a global var
-  RunManyThreadsWithId(&MultithreadedTestThreadRunner, num_threads_remaining,
-                       1 << 15);
-
-  uintptr_t values[kHookListMaxValues + 1];
-  EXPECT_EQ(0, TestHookList_Traverse(list, values, kHookListMaxValues));
-  EXPECT_EQ(0, list.priv_end);
-}
-
-// We only do mmap-hooking on (some) linux systems.
-#if defined(HAVE_MMAP) && defined(__linux) && \
-    (defined(__i386__) || defined(__x86_64__) || defined(__PPC__))
-
-int mmap_calls = 0;
-int mmap_matching_calls = 0;
-int munmap_calls = 0;
-int munmap_matching_calls = 0;
-const int kMmapMagicFd = 1;
-void* const kMmapMagicPointer = reinterpret_cast<void*>(1);
-
-int MmapReplacement(const void* start,
-                     size_t size,
-                     int protection,
-                     int flags,
-                     int fd,
-                     off_t offset,
-                     void** result) {
-  ++mmap_calls;
-  if (fd == kMmapMagicFd) {
-    ++mmap_matching_calls;
-    *result = kMmapMagicPointer;
-    return true;
-  }
-  return false;
-}
-
-int MunmapReplacement(const void* ptr, size_t size, int* result) {
-  ++munmap_calls;
-  if (ptr == kMmapMagicPointer) {
-    ++munmap_matching_calls;
-    *result = 0;
-    return true;
-  }
-  return false;
-}
-
-TEST(MallocMookTest, MmapReplacements) {
-  mmap_calls = mmap_matching_calls = munmap_calls = munmap_matching_calls = 0;
-  MallocHook::SetMmapReplacement(&MmapReplacement);
-  MallocHook::SetMunmapReplacement(&MunmapReplacement);
-  EXPECT_EQ(kMmapMagicPointer, mmap(NULL, 1, PROT_READ, MAP_PRIVATE,
-                                    kMmapMagicFd, 0));
-  EXPECT_EQ(1, mmap_matching_calls);
-
-  char* ptr = reinterpret_cast<char*>(
-      mmap(NULL, 1, PROT_READ | PROT_WRITE,
-           MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
-  EXPECT_EQ(2, mmap_calls);
-  EXPECT_EQ(1, mmap_matching_calls);
-  ASSERT_NE(MAP_FAILED, ptr);
-  *ptr = 'a';
-
-  EXPECT_EQ(0, munmap(kMmapMagicPointer, 1));
-  EXPECT_EQ(1, munmap_calls);
-  EXPECT_EQ(1, munmap_matching_calls);
-
-  EXPECT_EQ(0, munmap(ptr, 1));
-  EXPECT_EQ(2, munmap_calls);
-  EXPECT_EQ(1, munmap_matching_calls);
-
-  // The DEATH test below is flaky, because we've just munmapped the memory,
-  // making it available for mmap()ing again. There is no guarantee that it
-  // will stay unmapped, and in fact it gets reused ~10% of the time.
-  // It the area is reused, then not only we don't die, but we also corrupt
-  // whoever owns that memory now.
-  // EXPECT_DEATH(*ptr = 'a', "SIGSEGV");
-}
-#endif  // #ifdef HAVE_MMAP && linux && ...
-
-}  // namespace
-
-int main(int argc, char** argv) {
-  return RUN_ALL_TESTS();
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/markidle_unittest.cc
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/markidle_unittest.cc b/third_party/gperftools/src/tests/markidle_unittest.cc
deleted file mode 100644
index 827609f..0000000
--- a/third_party/gperftools/src/tests/markidle_unittest.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
-// Copyright (c) 2003, 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.
-
-// ---
-// Author: Sanjay Ghemawat
-//
-// MallocExtension::MarkThreadIdle() testing
-#include <stdio.h>
-
-#include "config_for_unittests.h"
-#include "base/logging.h"
-#include <gperftools/malloc_extension.h>
-#include "tests/testutil.h"   // for RunThread()
-
-// Helper routine to do lots of allocations
-static void TestAllocation() {
-  static const int kNum = 100;
-  void* ptr[kNum];
-  for (int size = 8; size <= 65536; size*=2) {
-    for (int i = 0; i < kNum; i++) {
-      ptr[i] = malloc(size);
-    }
-    for (int i = 0; i < kNum; i++) {
-      free(ptr[i]);
-    }
-  }
-}
-
-// Routine that does a bunch of MarkThreadIdle() calls in sequence
-// without any intervening allocations
-static void MultipleIdleCalls() {
-  for (int i = 0; i < 4; i++) {
-    MallocExtension::instance()->MarkThreadIdle();
-  }
-}
-
-// Routine that does a bunch of MarkThreadIdle() calls in sequence
-// with intervening allocations
-static void MultipleIdleNonIdlePhases() {
-  for (int i = 0; i < 4; i++) {
-    TestAllocation();
-    MallocExtension::instance()->MarkThreadIdle();
-  }
-}
-
-// Get current thread cache usage
-static size_t GetTotalThreadCacheSize() {
-  size_t result;
-  CHECK(MallocExtension::instance()->GetNumericProperty(
-            "tcmalloc.current_total_thread_cache_bytes",
-            &result));
-  return result;
-}
-
-// Check that MarkThreadIdle() actually reduces the amount
-// of per-thread memory.
-static void TestIdleUsage() {
-  const size_t original = GetTotalThreadCacheSize();
-
-  TestAllocation();
-  const size_t post_allocation = GetTotalThreadCacheSize();
-  CHECK_GT(post_allocation, original);
-
-  MallocExtension::instance()->MarkThreadIdle();
-  const size_t post_idle = GetTotalThreadCacheSize();
-  CHECK_LE(post_idle, original);
-
-  // Log after testing because logging can allocate heap memory.
-  VLOG(0, "Original usage: %" PRIuS "\n", original);
-  VLOG(0, "Post allocation: %" PRIuS "\n", post_allocation);
-  VLOG(0, "Post idle: %" PRIuS "\n", post_idle);
-}
-
-int main(int argc, char** argv) {
-  RunThread(&TestIdleUsage);
-  RunThread(&TestAllocation);
-  RunThread(&MultipleIdleCalls);
-  RunThread(&MultipleIdleNonIdlePhases);
-
-  printf("PASS\n");
-  return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/maybe_threads_unittest.sh
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/maybe_threads_unittest.sh b/third_party/gperftools/src/tests/maybe_threads_unittest.sh
deleted file mode 100755
index 77b3b78..0000000
--- a/third_party/gperftools/src/tests/maybe_threads_unittest.sh
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) 2007, 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.
-
-# ---
-# Author: Craig Silverstein
-#
-# maybe_threads.cc was written to allow LD_PRELOAD=libtcmalloc.so to
-# work even on binaries that were not linked with pthreads.  This
-# unittest tests that, by running low_level_alloc_unittest with an
-# LD_PRELOAD.  (low_level_alloc_unittest was chosen because it doesn't
-# link in tcmalloc.)
-#
-# We assume all the .so files are in the same directory as both
-# addressmap_unittest and profiler1_unittest.  The reason we need
-# profiler1_unittest is because it's instrumented to show the directory
-# it's "really" in when run without any args.  In practice this will either
-# be BINDIR, or, when using libtool, BINDIR/.lib.
-
-# We expect BINDIR to be set in the environment.
-# If not, we set them to some reasonable values.
-BINDIR="${BINDIR:-.}"
-
-if [ "x$1" = "x-h" -o "x$1" = "x--help" ]; then
-  echo "USAGE: $0 [unittest dir]"
-  echo "       By default, unittest_dir=$BINDIR"
-  exit 1
-fi
-
-UNITTEST_DIR=${1:-$BINDIR}
-
-# Figure out the "real" unittest directory.  Also holds the .so files.
-UNITTEST_DIR=`$UNITTEST_DIR/low_level_alloc_unittest --help 2>&1 \
-              | awk '{print $2; exit;}' \
-              | xargs dirname`
-
-# Figure out where libtcmalloc lives.   It should be in UNITTEST_DIR,
-# but with libtool it might be in a subdir.
-if [ -r "$UNITTEST_DIR/libtcmalloc_minimal.so" ]; then
-  LIB_PATH="$UNITTEST_DIR/libtcmalloc_minimal.so"
-elif [ -r "$UNITTEST_DIR/.libs/libtcmalloc_minimal.so" ]; then
-  LIB_PATH="$UNITTEST_DIR/.libs/libtcmalloc_minimal.so"
-elif [ -r "$UNITTEST_DIR/libtcmalloc_minimal.dylib" ]; then   # for os x
-  LIB_PATH="$UNITTEST_DIR/libtcmalloc_minimal.dylib"
-elif [ -r "$UNITTEST_DIR/.libs/libtcmalloc_minimal.dylib" ]; then
-  LIB_PATH="$UNITTEST_DIR/.libs/libtcmalloc_minimal.dylib"
-else
-  echo "Cannot run $0: cannot find libtcmalloc_minimal.so"
-  exit 2
-fi
-
-LD_PRELOAD="$LIB_PATH" $UNITTEST_DIR/low_level_alloc_unittest

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/memalign_unittest.cc
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/memalign_unittest.cc b/third_party/gperftools/src/tests/memalign_unittest.cc
deleted file mode 100644
index 309a3df..0000000
--- a/third_party/gperftools/src/tests/memalign_unittest.cc
+++ /dev/null
@@ -1,221 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
-// Copyright (c) 2004, 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.
-
-// ---
-// Author: Sanjay Ghemawat
-//
-// Check memalign related routines.
-//
-// We can't really do a huge amount of checking, but at the very
-// least, the following code checks that return values are properly
-// aligned, and that writing into the objects works.
-
-#include "config_for_unittests.h"
-
-// Complicated ordering requirements.  tcmalloc.h defines (indirectly)
-// _POSIX_C_SOURCE, which it needs so stdlib.h defines posix_memalign.
-// unistd.h, on the other hand, requires _POSIX_C_SOURCE to be unset,
-// at least on Mac OS X, in order to define getpagesize.  The solution
-// is to #include unistd.h first.  This is safe because unistd.h
-// doesn't sub-include stdlib.h, so we'll still get posix_memalign
-// when we #include stdlib.h.  Blah.
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>        // for getpagesize()
-#endif
-#include "tcmalloc.h"      // must come early, to pick up posix_memalign
-#include <assert.h>
-#include <stdlib.h>        // defines posix_memalign
-#include <stdio.h>         // for the printf at the end
-#ifdef HAVE_STDINT_H
-#include <stdint.h>        // for uintptr_t
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>        // for getpagesize()
-#endif
-// Malloc can be in several places on older versions of OS X.
-#if defined(HAVE_MALLOC_H)
-#include <malloc.h>        // for memalign() and valloc()
-#elif defined(HAVE_MALLOC_MALLOC_H)
-#include <malloc/malloc.h>
-#elif defined(HAVE_SYS_MALLOC_H)
-#include <sys/malloc.h>
-#endif
-#include "base/basictypes.h"
-#include "base/logging.h"
-#include "tests/testutil.h"
-
-
-// Return the next interesting size/delta to check.  Returns -1 if no more.
-static int NextSize(int size) {
-  if (size < 100) {
-    return size+1;
-  } else if (size < 1048576) {
-    // Find next power of two
-    int power = 1;
-    while (power < size) {
-      power <<= 1;
-    }
-
-    // Yield (power-1, power, power+1)
-    if (size < power-1) {
-      return power-1;
-    } else if (size == power-1) {
-      return power;
-    } else {
-      assert(size == power);
-      return power+1;
-    }
-  } else {
-    return -1;
-  }
-}
-
-// Shortform for cast
-static uintptr_t Number(void* p) {
-  return reinterpret_cast<uintptr_t>(p);
-}
-
-// Check alignment
-static void CheckAlignment(void* p, int align) {
-  if ((Number(p) & (align-1)) != 0)
-    LOG(FATAL, "wrong alignment; wanted 0x%x; got %p\n", align, p);
-}
-
-// Fill a buffer of the specified size with a predetermined pattern
-static void Fill(void* p, int n, char seed) {
-  unsigned char* buffer = reinterpret_cast<unsigned char*>(p);
-  for (int i = 0; i < n; i++) {
-    buffer[i] = ((seed + i) & 0xff);
-  }
-}
-
-// Check that the specified buffer has the predetermined pattern
-// generated by Fill()
-static bool Valid(const void* p, int n, char seed) {
-  const unsigned char* buffer = reinterpret_cast<const unsigned char*>(p);
-  for (int i = 0; i < n; i++) {
-    if (buffer[i] != ((seed + i) & 0xff)) {
-      return false;
-    }
-  }
-  return true;
-}
-
-int main(int argc, char** argv) {
-  SetTestResourceLimit();
-
-  // Try allocating data with a bunch of alignments and sizes
-  for (int a = 1; a < 1048576; a *= 2) {
-    for (int s = 0; s != -1; s = NextSize(s)) {
-      void* ptr = memalign(a, s);
-      CheckAlignment(ptr, a);
-      Fill(ptr, s, 'x');
-      CHECK(Valid(ptr, s, 'x'));
-      free(ptr);
-
-      if ((a >= sizeof(void*)) && ((a & (a-1)) == 0)) {
-        CHECK(posix_memalign(&ptr, a, s) == 0);
-        CheckAlignment(ptr, a);
-        Fill(ptr, s, 'y');
-        CHECK(Valid(ptr, s, 'y'));
-        free(ptr);
-      }
-    }
-  }
-
-  {
-    // Check various corner cases
-    void* p1 = memalign(1<<20, 1<<19);
-    void* p2 = memalign(1<<19, 1<<19);
-    void* p3 = memalign(1<<21, 1<<19);
-    CheckAlignment(p1, 1<<20);
-    CheckAlignment(p2, 1<<19);
-    CheckAlignment(p3, 1<<21);
-    Fill(p1, 1<<19, 'a');
-    Fill(p2, 1<<19, 'b');
-    Fill(p3, 1<<19, 'c');
-    CHECK(Valid(p1, 1<<19, 'a'));
-    CHECK(Valid(p2, 1<<19, 'b'));
-    CHECK(Valid(p3, 1<<19, 'c'));
-    free(p1);
-    free(p2);
-    free(p3);
-  }
-
-  {
-    // posix_memalign
-    void* ptr;
-    CHECK(posix_memalign(&ptr, 0, 1) == EINVAL);
-    CHECK(posix_memalign(&ptr, sizeof(void*)/2, 1) == EINVAL);
-    CHECK(posix_memalign(&ptr, sizeof(void*)+1, 1) == EINVAL);
-    CHECK(posix_memalign(&ptr, 4097, 1) == EINVAL);
-
-    // Grab some memory so that the big allocation below will definitely fail.
-    void* p_small = malloc(4*1048576);
-    CHECK(p_small != NULL);
-
-    // Make sure overflow is returned as ENOMEM
-    const size_t zero = 0;
-    static const size_t kMinusNTimes = 10;
-    for ( size_t i = 1; i < kMinusNTimes; ++i ) {
-      int r = posix_memalign(&ptr, 1024, zero - i);
-      CHECK(r == ENOMEM);
-    }
-
-    free(p_small);
-  }
-
-  const int pagesize = getpagesize();
-  {
-    // valloc
-    for (int s = 0; s != -1; s = NextSize(s)) {
-      void* p = valloc(s);
-      CheckAlignment(p, pagesize);
-      Fill(p, s, 'v');
-      CHECK(Valid(p, s, 'v'));
-      free(p);
-    }
-  }
-
-  {
-    // pvalloc
-    for (int s = 0; s != -1; s = NextSize(s)) {
-      void* p = pvalloc(s);
-      CheckAlignment(p, pagesize);
-      int alloc_needed = ((s + pagesize - 1) / pagesize) * pagesize;
-      Fill(p, alloc_needed, 'x');
-      CHECK(Valid(p, alloc_needed, 'x'));
-      free(p);
-    }
-  }
-
-  printf("PASS\n");
-  return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/packed-cache_test.cc
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/packed-cache_test.cc b/third_party/gperftools/src/tests/packed-cache_test.cc
deleted file mode 100644
index befbd77..0000000
--- a/third_party/gperftools/src/tests/packed-cache_test.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
-// Copyright (c) 2007, 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.
-
-// ---
-// Author: Geoff Pike
-
-#include <stdio.h>
-#include "base/logging.h"
-#include "packed-cache-inl.h"
-
-static const int kHashbits = PackedCache<64, uint64>::kHashbits;
-
-// A basic sanity test.
-void PackedCacheTest_basic() {
-  PackedCache<32, uint32> cache(0);
-  CHECK_EQ(cache.GetOrDefault(0, 1), 0);
-  cache.Put(0, 17);
-  CHECK(cache.Has(0));
-  CHECK_EQ(cache.GetOrDefault(0, 1), 17);
-  cache.Put(19, 99);
-  CHECK(cache.Has(0) && cache.Has(19));
-  CHECK_EQ(cache.GetOrDefault(0, 1), 17);
-  CHECK_EQ(cache.GetOrDefault(19, 1), 99);
-  // Knock <0, 17> out by using a conflicting key.
-  cache.Put(1 << kHashbits, 22);
-  CHECK(!cache.Has(0));
-  CHECK_EQ(cache.GetOrDefault(0, 1), 1);
-  CHECK_EQ(cache.GetOrDefault(1 << kHashbits, 1), 22);
-}
-
-int main(int argc, char **argv) {
-  PackedCacheTest_basic();
-
-  printf("PASS\n");
-  return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/page_heap_test.cc
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/page_heap_test.cc b/third_party/gperftools/src/tests/page_heap_test.cc
deleted file mode 100644
index e82a1da..0000000
--- a/third_party/gperftools/src/tests/page_heap_test.cc
+++ /dev/null
@@ -1,169 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
-// Copyright 2009 Google Inc. All Rights Reserved.
-// Author: fikes@google.com (Andrew Fikes)
-//
-// Use of this source code is governed by a BSD-style license that can
-// be found in the LICENSE file.
-
-#include "config_for_unittests.h"
-#include "page_heap.h"
-#include "system-alloc.h"
-#include <stdio.h>
-#include "base/logging.h"
-#include "common.h"
-
-DECLARE_int64(tcmalloc_heap_limit_mb);
-
-namespace {
-
-// The system will only release memory if the block size is equal or hight than
-// system page size.
-static bool HaveSystemRelease =
-    TCMalloc_SystemRelease(
-      TCMalloc_SystemAlloc(getpagesize(), NULL, 0), getpagesize());
-
-static void CheckStats(const tcmalloc::PageHeap* ph,
-                       uint64_t system_pages,
-                       uint64_t free_pages,
-                       uint64_t unmapped_pages) {
-  tcmalloc::PageHeap::Stats stats = ph->stats();
-
-  if (!HaveSystemRelease) {
-    free_pages += unmapped_pages;
-    unmapped_pages = 0;
-  }
-
-  EXPECT_EQ(system_pages, stats.system_bytes >> kPageShift);
-  EXPECT_EQ(free_pages, stats.free_bytes >> kPageShift);
-  EXPECT_EQ(unmapped_pages, stats.unmapped_bytes >> kPageShift);
-}
-
-static void TestPageHeap_Stats() {
-  tcmalloc::PageHeap* ph = new tcmalloc::PageHeap();
-
-  // Empty page heap
-  CheckStats(ph, 0, 0, 0);
-
-  // Allocate a span 's1'
-  tcmalloc::Span* s1 = ph->New(256);
-  CheckStats(ph, 256, 0, 0);
-
-  // Split span 's1' into 's1', 's2'.  Delete 's2'
-  tcmalloc::Span* s2 = ph->Split(s1, 128);
-  ph->Delete(s2);
-  CheckStats(ph, 256, 128, 0);
-
-  // Unmap deleted span 's2'
-  ph->ReleaseAtLeastNPages(1);
-  CheckStats(ph, 256, 0, 128);
-
-  // Delete span 's1'
-  ph->Delete(s1);
-  CheckStats(ph, 256, 128, 128);
-
-  delete ph;
-}
-
-static void TestPageHeap_Limit() {
-  tcmalloc::PageHeap* ph = new tcmalloc::PageHeap();
-
-  CHECK_EQ(kMaxPages, 1 << (20 - kPageShift));
-
-  // We do not know much is taken from the system for other purposes,
-  // so we detect the proper limit:
-  {
-    FLAGS_tcmalloc_heap_limit_mb = 1;
-    tcmalloc::Span* s = NULL;
-    while((s = ph->New(kMaxPages)) == NULL) {
-      FLAGS_tcmalloc_heap_limit_mb++;
-    }
-    FLAGS_tcmalloc_heap_limit_mb += 9;
-    ph->Delete(s);
-    // We are [10, 11) mb from the limit now.
-  }
-
-  // Test AllocLarge and GrowHeap first:
-  {
-    tcmalloc::Span * spans[10];
-    for (int i=0; i<10; ++i) {
-      spans[i] = ph->New(kMaxPages);
-      EXPECT_NE(spans[i], NULL);
-    }
-    EXPECT_EQ(ph->New(kMaxPages), NULL);
-
-    for (int i=0; i<10; i += 2) {
-      ph->Delete(spans[i]);
-    }
-
-    tcmalloc::Span *defragmented = ph->New(5 * kMaxPages);
-
-    if (HaveSystemRelease) {
-      // EnsureLimit should release deleted normal spans
-      EXPECT_NE(defragmented, NULL);
-      EXPECT_TRUE(ph->CheckExpensive());
-      ph->Delete(defragmented);
-    }
-    else
-    {
-      EXPECT_EQ(defragmented, NULL);
-      EXPECT_TRUE(ph->CheckExpensive());
-    }
-
-    for (int i=1; i<10; i += 2) {
-      ph->Delete(spans[i]);
-    }
-  }
-
-  // Once again, testing small lists this time (twice smaller spans):
-  {
-    tcmalloc::Span * spans[20];
-    for (int i=0; i<20; ++i) {
-      spans[i] = ph->New(kMaxPages >> 1);
-      EXPECT_NE(spans[i], NULL);
-    }
-    // one more half size allocation may be possible:
-    tcmalloc::Span * lastHalf = ph->New(kMaxPages >> 1);
-    EXPECT_EQ(ph->New(kMaxPages >> 1), NULL);
-
-    for (int i=0; i<20; i += 2) {
-      ph->Delete(spans[i]);
-    }
-
-    for(Length len = kMaxPages >> 2; len < 5 * kMaxPages; len = len << 1)
-    {
-      if(len <= kMaxPages >> 1 || HaveSystemRelease) {
-        tcmalloc::Span *s = ph->New(len);
-        EXPECT_NE(s, NULL);
-        ph->Delete(s);
-      }
-    }
-
-    EXPECT_TRUE(ph->CheckExpensive());
-
-    for (int i=1; i<20; i += 2) {
-      ph->Delete(spans[i]);
-    }
-
-    if (lastHalf != NULL) {
-      ph->Delete(lastHalf);
-    }
-  }
-
-  delete ph;
-}
-
-}  // namespace
-
-int main(int argc, char **argv) {
-  TestPageHeap_Stats();
-  TestPageHeap_Limit();
-  printf("PASS\n");
-  // on windows as part of library destructors we call getenv which
-  // calls malloc which fails due to our exhausted heap limit. It then
-  // causes fancy stack overflow because log message we're printing
-  // for failed allocation somehow cause malloc calls too
-  //
-  // To keep us out of trouble we just drop malloc limit
-  FLAGS_tcmalloc_heap_limit_mb = 0;
-  return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b249eb11/third_party/gperftools/src/tests/pagemap_unittest.cc
----------------------------------------------------------------------
diff --git a/third_party/gperftools/src/tests/pagemap_unittest.cc b/third_party/gperftools/src/tests/pagemap_unittest.cc
deleted file mode 100644
index 88d46e7..0000000
--- a/third_party/gperftools/src/tests/pagemap_unittest.cc
+++ /dev/null
@@ -1,178 +0,0 @@
-// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
-// Copyright (c) 2003, 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.
-
-// ---
-// Author: Sanjay Ghemawat
-
-#include "config_for_unittests.h"
-#include <stdio.h>
-#include <stdlib.h>
-#if defined HAVE_STDINT_H
-#include <stdint.h>             // to get intptr_t
-#elif defined HAVE_INTTYPES_H
-#include <inttypes.h>           // another place intptr_t might be defined
-#endif
-#include <sys/types.h>
-#include <vector>
-#include "base/logging.h"
-#include "pagemap.h"
-
-using std::vector;
-
-static void Permute(vector<intptr_t>* elements) {
-  if (elements->empty())
-    return;
-  const size_t num_elements = elements->size();
-  for (size_t i = num_elements - 1; i > 0; --i) {
-    const size_t newpos = rand() % (i + 1);
-    const intptr_t tmp = (*elements)[i];   // swap
-    (*elements)[i] = (*elements)[newpos];
-    (*elements)[newpos] = tmp;
-  }
-}
-
-// Note: we leak memory every time a map is constructed, so do not
-// create too many maps.
-
-// Test specified map type
-template <class Type>
-void TestMap(int limit, bool limit_is_below_the_overflow_boundary) {
-  RAW_LOG(INFO, "Running test with %d iterations...\n", limit);
-
-  { // Test sequential ensure/assignment
-    Type map(malloc);
-    for (intptr_t i = 0; i < static_cast<intptr_t>(limit); i++) {
-      map.Ensure(i, 1);
-      map.set(i, (void*)(i+1));
-      CHECK_EQ(map.get(i), (void*)(i+1));
-    }
-    for (intptr_t i = 0; i < static_cast<intptr_t>(limit); i++) {
-      CHECK_EQ(map.get(i), (void*)(i+1));
-    }
-  }
-
-  { // Test bulk Ensure
-    Type map(malloc);
-    map.Ensure(0, limit);
-    for (intptr_t i = 0; i < static_cast<intptr_t>(limit); i++) {
-      map.set(i, (void*)(i+1));
-      CHECK_EQ(map.get(i), (void*)(i+1));
-    }
-    for (intptr_t i = 0; i < static_cast<intptr_t>(limit); i++) {
-      CHECK_EQ(map.get(i), (void*)(i+1));
-    }
-  }
-
-  // Test that we correctly notice overflow
-  {
-    Type map(malloc);
-    CHECK_EQ(map.Ensure(limit, limit+1), limit_is_below_the_overflow_boundary);
-  }
-
-  { // Test randomized accesses
-    srand(301);   // srand isn't great, but it's portable
-    vector<intptr_t> elements;
-    for (intptr_t i = 0; i < static_cast<intptr_t>(limit); i++) elements.push_back(i);
-    Permute(&elements);
-
-    Type map(malloc);
-    for (intptr_t i = 0; i < static_cast<intptr_t>(limit); i++) {
-      map.Ensure(elements[i], 1);
-      map.set(elements[i], (void*)(elements[i]+1));
-      CHECK_EQ(map.get(elements[i]), (void*)(elements[i]+1));
-    }
-    for (intptr_t i = 0; i < static_cast<intptr_t>(limit); i++) {
-      CHECK_EQ(map.get(i), (void*)(i+1));
-    }
-  }
-}
-
-// REQUIRES: BITS==10, i.e., valid range is [0,1023].
-// Representations for different types will end up being:
-//    PageMap1: array[1024]
-//    PageMap2: array[32][32]
-//    PageMap3: array[16][16][4]
-template <class Type>
-void TestNext(const char* name) {
-  RAW_LOG(ERROR, "Running NextTest %s\n", name);
-  Type map(malloc);
-  char a, b, c, d, e;
-
-  // When map is empty
-  CHECK(map.Next(0) == NULL);
-  CHECK(map.Next(5) == NULL);
-  CHECK(map.Next(1<<30) == NULL);
-
-  // Add a single value
-  map.Ensure(40, 1);
-  map.set(40, &a);
-  CHECK(map.Next(0) == &a);
-  CHECK(map.Next(39) == &a);
-  CHECK(map.Next(40) == &a);
-  CHECK(map.Next(41) == NULL);
-  CHECK(map.Next(1<<30) == NULL);
-
-  // Add a few values
-  map.Ensure(41, 1);
-  map.Ensure(100, 3);
-  map.set(41, &b);
-  map.set(100, &c);
-  map.set(101, &d);
-  map.set(102, &e);
-  CHECK(map.Next(0) == &a);
-  CHECK(map.Next(39) == &a);
-  CHECK(map.Next(40) == &a);
-  CHECK(map.Next(41) == &b);
-  CHECK(map.Next(42) == &c);
-  CHECK(map.Next(63) == &c);
-  CHECK(map.Next(64) == &c);
-  CHECK(map.Next(65) == &c);
-  CHECK(map.Next(99) == &c);
-  CHECK(map.Next(100) == &c);
-  CHECK(map.Next(101) == &d);
-  CHECK(map.Next(102) == &e);
-  CHECK(map.Next(103) == NULL);
-}
-
-int main(int argc, char** argv) {
-  TestMap< TCMalloc_PageMap1<10> > (100, true);
-  TestMap< TCMalloc_PageMap1<10> > (1 << 10, false);
-  TestMap< TCMalloc_PageMap2<20> > (100, true);
-  TestMap< TCMalloc_PageMap2<20> > (1 << 20, false);
-  TestMap< TCMalloc_PageMap3<20> > (100, true);
-  TestMap< TCMalloc_PageMap3<20> > (1 << 20, false);
-
-  TestNext< TCMalloc_PageMap1<10> >("PageMap1");
-  TestNext< TCMalloc_PageMap2<10> >("PageMap2");
-  TestNext< TCMalloc_PageMap3<10> >("PageMap3");
-
-  printf("PASS\n");
-  return 0;
-}


Mime
View raw message