Skip to content
This repository was archived by the owner on Jan 14, 2023. It is now read-only.

Commit bfc88af

Browse files
authored
Test against 32-bit PHP versions (#46)
* Add 32-bit images to test against * Update memory test for 32-bit architectures. We don't necessarily know how much memory is allocated across platforms. We'll change this test to make sure that we are executing the loop more than once, but fewer times than all.
1 parent d0715b0 commit bfc88af

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

cloudbuild.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ steps:
3030
- name: gcr.io/cloud-builders/docker
3131
args: ['build', '--build-arg', 'BASE_IMAGE=gcr.io/php-stackdriver/php71-debug', '.']
3232
id: php71-debug
33+
- name: gcr.io/cloud-builders/docker
34+
args: ['build', '--build-arg', 'BASE_IMAGE=gcr.io/php-stackdriver/php71-32bit', '.']
35+
id: php71-32bit
36+
- name: gcr.io/cloud-builders/docker
37+
args: ['build', '--build-arg', 'BASE_IMAGE=gcr.io/php-stackdriver/php70-32bit', '.']
38+
id: php70-32bit

tests/logpoints/memory_limit.phpt

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ $data = [];
77

88
function logpoint_callback($level, $message) {
99
global $data;
10-
echo "logpoint: $level - $message" . PHP_EOL;
1110
$data[] = array_fill(0, 100000, 1);
1211
}
1312
// set a snapshot for line 7 in loop.php ($sum += $i)
@@ -16,14 +15,17 @@ var_dump(stackdriver_debugger_add_logpoint('loop.php', 7, 'INFO', 'Logpoint hit!
1615
]));
1716

1817
require_once(__DIR__ . '/loop.php');
19-
2018
$sum = loop(10);
2119

20+
// Check the number of times that the logpoint_callback was executed is
21+
// limited as it's hard to determine exact memory usage across systems
22+
$iterations = count($data);
23+
$test = ($iterations < 10) && ($iterations > 1);
24+
echo "Logpoint executed fewer than 10 times: $test" . PHP_EOL;
25+
2226
echo "Sum is {$sum}\n";
2327
?>
2428
--EXPECTF--
2529
bool(true)
26-
logpoint: INFO - Logpoint hit!
27-
logpoint: INFO - Logpoint hit!
28-
logpoint: INFO - Logpoint hit!
30+
Logpoint executed fewer than 10 times: 1
2931
Sum is 45

0 commit comments

Comments
 (0)