From 34ef8732901d63eccb443ab48c56860266dc9011 Mon Sep 17 00:00:00 2001 From: Deon Nicholas Date: Wed, 26 Jun 2013 11:41:13 -0700 Subject: [PATCH] Added stringappend_test back into the unit tests. Summary: With the Makefile now updated to correctly update all .o files, this should fix the issues recompiling stringappend_test. This should also fix the "segmentation-fault" that we were getting earlier. Now, stringappend_test should be clean, and I have added it back to the unit-tests. Also made some minor updates to the tests themselves. Test Plan: 1. make clean; make stringappend_test -j 32 (will test it by itself) 2. make clean; make all check -j 32 (to run all unit tests) 3. make clean; make release (test in release mode) 4. valgrind ./stringappend_test (valgrind tests) Reviewers: haobo, jpaton, dhruba Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D11505 --- Makefile | 3 ++- .../string_append/stringappend_test.cc | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0fa9d42dc..2665c3a21 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,8 @@ TESTS = \ filelock_test \ merge_test \ redis_test \ - manual_compaction_test + manual_compaction_test \ + stringappend_test TOOLS = \ sst_dump \ diff --git a/utilities/merge_operators/string_append/stringappend_test.cc b/utilities/merge_operators/string_append/stringappend_test.cc index 70128b02c..7fff3e5d9 100644 --- a/utilities/merge_operators/string_append/stringappend_test.cc +++ b/utilities/merge_operators/string_append/stringappend_test.cc @@ -329,6 +329,26 @@ TEST(StringAppendOperatorTest,PersistentVariousKeys) { slists.Append("b","l;"); slists.Append("c","rogosh"); + // The previous changes should be on disk (L0) + // The most recent changes should be in memory (MemTable) + // Hence, this will test both Get() paths. + std::string a,b,c; + slists.Get("a",&a); + slists.Get("b",&b); + slists.Get("c",&c); + + ASSERT_EQ(a,"x\nt\nr\nsa\ngh\njk"); + ASSERT_EQ(b,"y\n2\ndf\nl;"); + ASSERT_EQ(c,"asdasd\nasdasd\nbbnagnagsx\nrogosh"); + } + + // Reopen the database (the previous changes should persist / be remembered) + { + StringAppendOperator append_op('\n'); + auto db = OpenDb(&append_op); + StringLists slists(db); + + // All changes should be on disk. This will test VersionSet Get() std::string a,b,c; slists.Get("a",&a); slists.Get("b",&b);