Skip to contentSkip to conversation

multipath-tools tests: unversioned .so for valgrind tests

PATCH In review [email protected] 2 participants 4 messages Dec 18, 2020 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 multipath-tools tests: unversioned .so for valgrind tests

From: Martin Wilck <[email protected]>

We need to the same thing for valgrind tests as we did in 448752f ("libmultipath: create separate .so for unit tests").

---
 tests/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/Makefile +1 -1
index 54da774..50673fa 100644
@@ -76,7 +76,7 @@ lib/libchecktur.so:
 
 %.vgr:  %-test lib/libchecktur.so
 	@echo == running valgrind for $< ==
-	@LD_LIBRARY_PATH=$(multipathdir):$(mpathcmddir) \
+	@LD_LIBRARY_PATH=.:$(mpathcmddir) \
 		valgrind --leak-check=full --error-exitcode=128 ./$< >$@ 2>&1
 
 OBJS = $(TESTS:%=%.o) $(HELPERS)
Signature · 7 lines
2.29.0


--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
#1 lore raw

PATCH 2/2 multipath-tools unit tests: fix memory leaks in mpathvalid tests

From: Martin Wilck <[email protected]>

They break "make valgrind-test".

---
 tests/mpathvalid.c | 4 ++++
 1 file changed, 4 insertions(+)
tests/mpathvalid.c +4 -0
index 5ffabb9..cfe4bae 100644
@@ -381,6 +381,7 @@ static void test_mpathvalid_is_path_good2(void **state)
 	assert_int_equal(mpathvalid_is_path(test_dev, MPATH_DEFAULT, &wwid,
 					    wwids, 4), MPATH_IS_VALID);
 	assert_string_equal(wwid, TEST_WWID);
+	free(wwid);
 }
 
 static void test_mpathvalid_is_path_good3(void **state)
@@ -395,6 +396,7 @@ static void test_mpathvalid_is_path_good3(void **state)
 	assert_int_equal(mpathvalid_is_path(test_dev, MPATH_SMART, &wwid,
 					    wwids, 4), MPATH_IS_VALID);
 	assert_string_equal(wwid, TEST_WWID);
+	free(wwid);
 }
 
 /* mabybe valid with no matching paths */
@@ -410,6 +412,7 @@ static void test_mpathvalid_is_path_good4(void **state)
 	assert_int_equal(mpathvalid_is_path(test_dev, MPATH_DEFAULT, &wwid,
 					    wwids, 4), MPATH_IS_MAYBE_VALID);
 	assert_string_equal(wwid, TEST_WWID);
+	free(wwid);
 }
 
 /* maybe valid with matching paths */
@@ -425,6 +428,7 @@ static void test_mpathvalid_is_path_good5(void **state)
 	assert_int_equal(mpathvalid_is_path(test_dev, MPATH_DEFAULT, &wwid,
 					    wwids, 4), MPATH_IS_VALID);
 	assert_string_equal(wwid, TEST_WWID);
+	free(wwid);
 }
 
 #define setup_test(name) \
Signature · 7 lines
2.29.0


--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [dm-devel] [PATCH 2/2] multipath-tools unit tests: fix memory leaks in mpathvalid tests

Quoted 4 lines · On Fri, Dec 18, 2020 at 11:27:14PM +0100, [email protected] wrote:

From: Martin Wilck <[email protected]>

They break "make valgrind-test".

Quoted 43 lines
---
 tests/mpathvalid.c | 4 ++++
 1 file changed, 4 insertions(+)
tests/mpathvalid.c +4 -0
index 5ffabb9..cfe4bae 100644
@@ -381,6 +381,7 @@ static void test_mpathvalid_is_path_good2(void **state)
 	assert_int_equal(mpathvalid_is_path(test_dev, MPATH_DEFAULT, &wwid,
 					    wwids, 4), MPATH_IS_VALID);
 	assert_string_equal(wwid, TEST_WWID);
+	free(wwid);
 }
 
 static void test_mpathvalid_is_path_good3(void **state)
@@ -395,6 +396,7 @@ static void test_mpathvalid_is_path_good3(void **state)
 	assert_int_equal(mpathvalid_is_path(test_dev, MPATH_SMART, &wwid,
 					    wwids, 4), MPATH_IS_VALID);
 	assert_string_equal(wwid, TEST_WWID);
+	free(wwid);
 }
 
 /* mabybe valid with no matching paths */
@@ -410,6 +412,7 @@ static void test_mpathvalid_is_path_good4(void **state)
 	assert_int_equal(mpathvalid_is_path(test_dev, MPATH_DEFAULT, &wwid,
 					    wwids, 4), MPATH_IS_MAYBE_VALID);
 	assert_string_equal(wwid, TEST_WWID);
+	free(wwid);
 }
 
 /* maybe valid with matching paths */
@@ -425,6 +428,7 @@ static void test_mpathvalid_is_path_good5(void **state)
 	assert_int_equal(mpathvalid_is_path(test_dev, MPATH_DEFAULT, &wwid,
 					    wwids, 4), MPATH_IS_VALID);
 	assert_string_equal(wwid, TEST_WWID);
+	free(wwid);
 }
 
 #define setup_test(name) \
Signature · 1 line
2.29.0

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

maintainer Reviewed-by on v1 1/2
#3 lore raw
In reply to [email protected]
Quoted 5 lines · On Fri, Dec 18, 2020 at 11:27:13PM +0100, [email protected] wrote:

From: Martin Wilck <[email protected]>

We need to the same thing for valgrind tests as we did in 448752f ("libmultipath: create separate .so for unit tests").

Quoted 20 lines
---
 tests/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/Makefile +1 -1
index 54da774..50673fa 100644
@@ -76,7 +76,7 @@ lib/libchecktur.so:
 
 %.vgr:  %-test lib/libchecktur.so
 	@echo == running valgrind for $< ==
-	@LD_LIBRARY_PATH=$(multipathdir):$(mpathcmddir) \
+	@LD_LIBRARY_PATH=.:$(mpathcmddir) \
 		valgrind --leak-check=full --error-exitcode=128 ./$< >$@ 2>&1
 
 OBJS = $(TESTS:%=%.o) $(HELPERS)
Signature · 1 line
2.29.0

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel