inevity / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

[Patch] Fix typos in unit test scripts #587

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Call either of these four scripts
. heap-checker_unittest.sh
. heap-checker-death_unittest.sh
. heap-profiler_unittest.sh
. tcmalloc_unittest.sh
with an executable as argument.

What is the expected output? What do you see instead?
The argument will be garbled because of a misplaced brace, for example 
(heap-checker_unittest.sh):
HEAP_CHECKER="${1:-$BINDIR}/heap-checker_unittest"
which should be:
HEAP_CHECKER="${1:-$BINDIR/heap-checker_unittest}"
This unit test is used to check the binaries heap-checker_unittest and 
heap-checker_debug_unittest.
With the typo, the executable heap-checker_debug_unittest is never actually run.

What version of the product are you using? On what operating system?
Git HEAD, Linux x86_64 (Ubuntu 13.04, 3.8.0-19-generic)

Please provide any additional information below.
A Patch is attached.

Best regards,
Hannes Weisbach

Original issue reported on code.google.com by hannes.w...@googlemail.com on 12 Nov 2013 at 11:34

Attachments:

GoogleCodeExporter commented 9 years ago
BTW, git format-patch is more convenient for me. I.e. so that I don't have to 
invent commit message :)

Original comment by alkondratenko on 16 Nov 2013 at 7:17

GoogleCodeExporter commented 9 years ago
I'm not sure I understand. Even with that patch make check apparently still 
does not invoke debug version of heap checker unittest. It looks like make 
check is not passing anything to this script.

Original comment by alkondratenko on 16 Nov 2013 at 7:51

GoogleCodeExporter commented 9 years ago
merged. It looks like it will be nice to fix debug variants of this scripts to 
call debug unittest by default. But that can be done separately.

Thanks.

Original comment by alkondratenko on 16 Nov 2013 at 8:18

GoogleCodeExporter commented 9 years ago
Ah. I see what you mean. Sorry - I'm using gperftools within a CMake-based 
project, so I wrote some CMake-scripts and never looked back at the autotools 
scripts.
According to [0] it is not possible to pass command line arguments to tests 
with make check. I'm not that familiar with autotools to say there isn't a way 
to do it, but to me it seems, the easiest way would be a "template script" 
where the executable name is text-replaced inside the script. There is already 
a step, where the script file(s) is/are copied from src/tests to the top level 
directory:
cp -p $(top_srcdir)/$(heap_checker_unittest_sh_SOURCES) $@

I believe the cp could be changed to something like:
cat $(top_srcdir)/$(heap_checker_unittest_sh_SOURCES) | sed -e 
's/%%heap-checker-exe-name%%/heap-checker_unittest/' > $@
chmod +x $@

(This goes of course for all scripts which take command line arguments.)

Best regards,
Hannes

[0] 
http://stackoverflow.com/questions/9857400/how-do-i-pass-parameters-to-tests-in-
an-automake-input-file

Original comment by hannes.w...@googlemail.com on 18 Nov 2013 at 1:38