Skip to content

Commit

Permalink
Merge pull request #40 from WyriHaximusNet/test-meminfo-functional
Browse files Browse the repository at this point in the history
Test that meminfo is functional
  • Loading branch information
WyriHaximus authored Dec 5, 2019
2 parents 69aa6b9 + 3250b49 commit a657eca
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
23 changes: 23 additions & 0 deletions test/container/functional/meminfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

const MEMINFO_DUMP_FILE = '/tmp/my_dump_file.json';

meminfo_dump(fopen(MEMINFO_DUMP_FILE, 'w'));

sleep(1);

if (!file_exists(MEMINFO_DUMP_FILE)) {
exit(1);
}

$json = json_decode(file_get_contents(MEMINFO_DUMP_FILE), true);

if (!is_array($json)) {
exit(1);
}

if (count($json) === 0) {
exit(1);
}

echo 'meminfo';
6 changes: 6 additions & 0 deletions test/container/test_php_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ def test_php_meminfo_is_enabled(host):
def test_php_meminfo_is_not_enabled(host):
output = host.run('php -r "exit(function_exists(\'meminfo_dump\') ? 0 : 255);"')
assert output.rc == 255

@pytest.mark.php_dev
def test_php_ext_meminfo_is_functional(host):
output = host.run('php /tests/container/functional/meminfo.php')
assert output.stdout == 'meminfo'
assert output.rc == 0
6 changes: 5 additions & 1 deletion test/container/test_php_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ def test_iconv_is_loaded(host):
def test_intl_is_loaded(host):
assert 'intl' in host.run('php -m').stdout

@pytest.mark.php_dev
def test_meminfo_is_loaded(host):
assert 'meminfo' in host.run('php -m').stdout

@pytest.mark.php_zts
def test_paralle_is_loaded(host):
def test_parallel_is_loaded(host):
assert 'parallel' in host.run('php -m').stdout

@pytest.mark.php_nts
Expand Down

0 comments on commit a657eca

Please sign in to comment.