Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/tcmalloc/chromium/src/tests/sampling_test.sh

Issue 576001: Merged third_party/tcmalloc/vendor/src(google-perftools r87) into... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Removed the unnecessary printf and ASSERT(0) Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # Copyright (c) 2008, Google Inc. 3 # Copyright (c) 2008, Google Inc.
4 # All rights reserved. 4 # All rights reserved.
5 # 5 #
6 # Redistribution and use in source and binary forms, with or without 6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are 7 # modification, are permitted provided that the following conditions are
8 # met: 8 # met:
9 # 9 #
10 # * Redistributions of source code must retain the above copyright 10 # * Redistributions of source code must retain the above copyright
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 SAMPLING_TEST_BINARY=`"$SAMPLING_TEST" 2>&1 | awk '/USAGE/ {print $2; exit;}'` 55 SAMPLING_TEST_BINARY=`"$SAMPLING_TEST" 2>&1 | awk '/USAGE/ {print $2; exit;}'`
56 56
57 # A kludge for cygwin. Unfortunately, 'test -f' says that 'foo' exists 57 # A kludge for cygwin. Unfortunately, 'test -f' says that 'foo' exists
58 # even when it doesn't, and only foo.exe exists. Other unix utilities 58 # even when it doesn't, and only foo.exe exists. Other unix utilities
59 # (like nm) need you to say 'foo.exe'. We use one such utility, cat, to 59 # (like nm) need you to say 'foo.exe'. We use one such utility, cat, to
60 # see what the *real* binary name is. 60 # see what the *real* binary name is.
61 if ! cat "$SAMPLING_TEST_BINARY" >/dev/null 2>&1; then 61 if ! cat "$SAMPLING_TEST_BINARY" >/dev/null 2>&1; then
62 SAMPLING_TEST_BINARY="$SAMPLING_TEST_BINARY".exe 62 SAMPLING_TEST_BINARY="$SAMPLING_TEST_BINARY".exe
63 fi 63 fi
64 64
65 die() { 65 die() { # runs the command given as arguments, and then dies.
66 echo "FAILED" 66 echo "FAILED. Output from $@"
67 echo "reason:" 67 echo "----"
68 echo "$@" 68 "$@"
69 echo "----" 69 echo "----"
70 exit 1 70 exit 1
71 } 71 }
72 72
73 rm -rf "$OUTDIR" || die "Unable to delete $OUTDIR" 73 rm -rf "$OUTDIR" || die "Unable to delete $OUTDIR"
74 mkdir "$OUTDIR" || die "Unable to create $OUTDIR" 74 mkdir "$OUTDIR" || die "Unable to create $OUTDIR"
75 75
76 # This puts the output into out.heap and out.growth. It allocates 76 # This puts the output into out.heap and out.growth. It allocates
77 # 8*10^7 bytes of memory, which is 76M. Because we sample, the 77 # 8*10^7 bytes of memory, which is 76M. Because we sample, the
78 # estimate may be a bit high or a bit low: we accept anything from 78 # estimate may be a bit high or a bit low: we accept anything from
79 # 50M to 99M. 79 # 50M to 99M.
80 "$SAMPLING_TEST" "$OUTDIR/out" 80 "$SAMPLING_TEST" "$OUTDIR/out"
81 81
82 echo -n "Testing heap output..." 82 echo "Testing heap output..."
83 "$PPROF" --text "$SAMPLING_TEST_BINARY" "$OUTDIR/out.heap" \ 83 "$PPROF" --text "$SAMPLING_TEST_BINARY" "$OUTDIR/out.heap" \
84 | grep '^ *[5-9][0-9]\.[0-9][ 0-9.%]*_*AllocateAllocate' >/dev/null \ 84 | grep '^ *[5-9][0-9]\.[0-9][ 0-9.%]*_*AllocateAllocate' >/dev/null \
85 || die `"$PPROF" --text "$SAMPLING_TEST_BINARY" "$OUTDIR/out.heap"` 85 || die "$PPROF" --text "$SAMPLING_TEST_BINARY" "$OUTDIR/out.heap"
86 echo "OK" 86 echo "OK"
87 87
88 echo -n "Testing growth output..." 88 echo "Testing growth output..."
89 "$PPROF" --text "$SAMPLING_TEST_BINARY" "$OUTDIR/out.growth" \ 89 "$PPROF" --text "$SAMPLING_TEST_BINARY" "$OUTDIR/out.growth" \
90 | grep '^ *[5-9][0-9]\.[0-9][ 0-9.%]*_*AllocateAllocate' >/dev/null \ 90 | grep '^ *[5-9][0-9]\.[0-9][ 0-9.%]*_*AllocateAllocate' >/dev/null \
91 || die `"$PPROF" --text "$SAMPLING_TEST_BINARY" "$OUTDIR/out.growth"` 91 || die "$PPROF" --text "$SAMPLING_TEST_BINARY" "$OUTDIR/out.growth"
92 echo "OK" 92 echo "OK"
93 93
94 echo "PASS" 94 echo "PASS"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698