Bug 1321093 - Avoid logalloc-replay make check failure when libstdc++ allocates memory in some static initializer. r?njn
--- a/memory/replace/logalloc/replay/Makefile.in
+++ b/memory/replace/logalloc/replay/Makefile.in
@@ -18,15 +18,19 @@ endif
expected_output.log: $(srcdir)/replay.log
# The logalloc-replay program will only replay entries from the first pid,
# so the expected output only contains entries beginning with "1 "
grep "^1 " $< > $@
check:: $(srcdir)/replay.log expected_output.log
# Test with MALLOC_LOG as a file descriptor number
- MALLOC_LOG=1 $(LOGALLOC) ./$(PROGRAM) < $< | $(PYTHON) $(srcdir)/logalloc_munge.py | diff -w - expected_output.log
+# We filter out anything happening before the first jemalloc_stats (first
+# command in replay.log) because starting with libstdc++ 5, a static
+# initializer in the STL allocates memory, which we obviously don't have
+# in expected_output.log.
+ MALLOC_LOG=1 $(LOGALLOC) ./$(PROGRAM) < $< | sed -n '/jemalloc_stats/,$$p' | $(PYTHON) $(srcdir)/logalloc_munge.py | diff -w - expected_output.log
# Test with MALLOC_LOG as a file name
$(RM) test_output.log
MALLOC_LOG=test_output.log $(LOGALLOC) ./$(PROGRAM) < $<
- $(PYTHON) $(srcdir)/logalloc_munge.py < test_output.log | diff -w - expected_output.log
+ sed -n '/jemalloc_stats/,$$p' test_output.log | $(PYTHON) $(srcdir)/logalloc_munge.py | diff -w - expected_output.log
endif
--- a/memory/replace/logalloc/replay/replay.log
+++ b/memory/replace/logalloc/replay/replay.log
@@ -1,8 +1,9 @@
+1 1 jemalloc_stats()
1 1 malloc(42)=#1
1 1 malloc(24)=#2
2 2 malloc(42)=#1
1 1 free(#1)
1 1 posix_memalign(4096,1024)=#1
1 1 calloc(4,42)=#3
1 1 free(#2)
1 1 realloc(#3,84)=#2