Skip to content

Commit 9d4813c

Browse files
committed
fix an edge case when running tests in CI
1 parent 205c3ca commit 9d4813c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

tests/006_bsdiff_memory_leaks.phpt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Test memory usage
2+
Test memory leaks in function bsdiff_diff()
33
--EXTENSIONS--
44
bsdiff
55
--FILE--
@@ -12,8 +12,14 @@ foreach ([$old_file, $new_file, $diff_file] as $file) {
1212
if (file_exists($file)) unlink($file);
1313
}
1414

15-
$mem0 = memory_get_usage();
15+
// It's kind of weird that when running tests in GitHub Actions, we have to put this call to function file_put_contents()
16+
// before statement "$mem0 = memory_get_usage();", otherwise, the difference reported is "120" but not "0".
17+
// However,
18+
// 1. We don't need to make the same change for the 2nd test case in this file.
19+
// 2. The issue doesn't happen when tested locally (with or without Docker).
1620
file_put_contents($old_file, str_repeat("Hello World", 1997));
21+
22+
$mem0 = memory_get_usage();
1723
try {
1824
bsdiff_diff($old_file, $new_file, $diff_file);
1925
} catch (BsdiffException $e) {

tests/007_bspatch_memory_leaks.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Test memory usage
2+
Test memory leaks in function bsdiff_patch()
33
--EXTENSIONS--
44
bsdiff
55
--FILE--

0 commit comments

Comments
 (0)