Bug 1321093 - Avoid logalloc-replay make check failure when libstdc++ allocates memory in some static initializer. r=njn
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 30 Nov 2016 07:22:20 +0900
changeset 324801 739ac5ad4db5a20d7fdff847cbd675e4c7608a38
parent 324800 8f217ad4bcd380c91e2c580fe56bba1e7dff6c60
child 324802 c91e2710718e0f29c036d87d223ba102efd650e8
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersnjn
bugs1321093
milestone53.0a1
Bug 1321093 - Avoid logalloc-replay make check failure when libstdc++ allocates memory in some static initializer. r=njn
memory/replace/logalloc/replay/Makefile.in
memory/replace/logalloc/replay/replay.log
--- 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