Skip to contentSkip to conversation

tests/unit/test-util-sockets: Remove temporary file after test

PATCH In review Thomas Huth 4 participants 4 messages Feb 26, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/unit/test-util-sockets: Remove temporary file after test

test-util-sockets leaves the temporary socket files around in the temporary files folder. Let's better remove them at the end of the testing.

---
 tests/unit/test-util-sockets.c | 1 +
 1 file changed, 1 insertion(+)
tests/unit/test-util-sockets.c +1 -0
index 63909ccb2b..4c9dd0b271 100644
@@ -326,6 +326,7 @@ static void test_socket_unix_abstract(void)
         test_socket_unix_abstract_row(&matrix[i]);
     }
 
+    unlink(addr.u.q_unix.path);
     g_free(addr.u.q_unix.path);
 }
 
Signature · 1 line
2.43.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Thomas Huth

test-util-sockets leaves the temporary socket files around in the temporary files folder. Let's better remove them at the end of the testing.

Quoted 20 lines
---
 tests/unit/test-util-sockets.c | 1 +
 1 file changed, 1 insertion(+)
tests/unit/test-util-sockets.c +1 -1
index 63909ccb2b..4c9dd0b271 100644
@@ -326,6 +326,7 @@ static void test_socket_unix_abstract(void)
         test_socket_unix_abstract_row(&matrix[i]);
     }
 
+    unlink(addr.u.q_unix.path);
     g_free(addr.u.q_unix.path);
 }
 
--

2.43.2

Signature · 1 line
Marc-André Lureau
Reviewed-by on v1 1/1
#2 lore raw
In reply to Thomas Huth
Quoted 14 lines · Thomas Huth

test-util-sockets leaves the temporary socket files around in the temporary files folder. Let's better remove them at the end of the testing.

---
  tests/unit/test-util-sockets.c | 1 +
  1 file changed, 1 insertion(+)
tests/unit/test-util-sockets.c +0 -0
index 63909ccb2b..4c9dd0b271 100644

tests/unit/test-util-sockets.c static void test_socket_unix_abstract(void) · line 332

Quoted 7 lines
tests/unit/test-util-sockets.c +1 -0
@@ -326,6 +326,7 @@ static void test_socket_unix_abstract(void)
          test_socket_unix_abstract_row(&matrix[i]);
      }
 
+    unlink(addr.u.q_unix.path);
      g_free(addr.u.q_unix.path);
  }
 

Maybe:

Fixes 4d3a329af5 ("tests/util-sockets: add abstract unix socket cases")
#3 lore raw
In reply to Thomas Huth
Quoted 14 lines · Thomas Huth

test-util-sockets leaves the temporary socket files around in the temporary files folder. Let's better remove them at the end of the testing.

---
  tests/unit/test-util-sockets.c | 1 +
  1 file changed, 1 insertion(+)
tests/unit/test-util-sockets.c +0 -0
index 63909ccb2b..4c9dd0b271 100644

tests/unit/test-util-sockets.c static void test_socket_unix_abstract(void) · line 331

Quoted 6 lines
tests/unit/test-util-sockets.c +1 -0
@@ -326,6 +326,7 @@ static void test_socket_unix_abstract(void)
          test_socket_unix_abstract_row(&matrix[i]);
      }
 
+    unlink(addr.u.q_unix.path);
      g_free(addr.u.q_unix.path);
  }

Added the Fixes: tag as suggested by Philippe, and queued to trivial-patches tree. Thank you Thomas for this thankless work!

/mjt