Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 46 additions & 3 deletions config/ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,30 @@
"source": "apcu"
},
"bcmath": {
"type": "builtin"
"type": "builtin",
"test": [
"assert(function_exists('bcscale'));"
]
},
"bz2": {
"type": "builtin",
"arg-type": "with-prefix",
"lib-depends": [
"bzip2"
],
"test": [
"$str = 'This is bz2 extension test';",
"assert(function_exists('bzdecompress'));",
"assert(function_exists('bzcompress'));",
"assert(bzdecompress(bzcompress($str, 9)) === $str);"
]
},
"calendar": {
"type": "builtin"
"type": "builtin",
"test": [
"assert(function_exists('cal_info'));",
"assert(is_array(cal_info(0)));"
]
},
"ctype": {
"type": "builtin"
Expand All @@ -24,6 +37,9 @@
"arg-type": "with",
"lib-depends": [
"curl"
],
"test": [
"assert(function_exists('curl_init'));"
]
},
"dba": {
Expand All @@ -37,6 +53,12 @@
"lib-depends": [
"libxml2",
"zlib"
],
"test": [
"assert(class_exists('\\DOMDocument'));",
"$doc = new DOMDocument();",
"$doc->loadHtml('<html><head><meta charset=\"UTF-8\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body id='app'>Hello</body></html>');",
"assert($doc->getElementById('app')->nodeValue === 'Hello');"
]
},
"event": {
Expand Down Expand Up @@ -67,7 +89,10 @@
"type": "builtin"
},
"filter": {
"type": "builtin"
"type": "builtin",
"test": [
"assert(function_exists('filter_var'));"
]
},
"ftp": {
"type": "builtin",
Expand All @@ -91,6 +116,12 @@
"libwebp",
"libjpeg",
"freetype"
],
"test": [
"assert(function_exists('gd_info'));",
"assert(gd_info()['PNG Support'] ?? false);",
"assert(gd_info()['GIF Create Support'] ?? false);",
"assert(gd_info()['GIF Read Support'] ?? false);"
]
},
"gettext": {
Expand Down Expand Up @@ -149,6 +180,9 @@
"cpp-extension": true,
"lib-depends": [
"icu"
],
"test": [
"assert(class_exists(NumberFormatter::class));"
]
},
"ldap": {
Expand Down Expand Up @@ -309,6 +343,9 @@
"arg-type": "custom",
"ext-suggests": [
"session"
],
"test": [
"assert(class_exists('\\Redis'));"
]
},
"session": {
Expand Down Expand Up @@ -484,6 +521,9 @@
"arg-type-windows": "enable",
"lib-depends": [
"libzip"
],
"test": [
"assert(class_exists('\\ZipArchive'));"
]
},
"zlib": {
Expand All @@ -492,6 +532,9 @@
"arg-type-windows": "enable",
"lib-depends": [
"zlib"
],
"test": [
"assert(function_exists('gzcompress'));"
]
},
"zstd": {
Expand Down
8 changes: 8 additions & 0 deletions src/SPC/builder/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ public function getDistName(): string
return $this->name;
}

/**
* @return string[]
*/
public function getTests(): array
{
return Config::getExt($this->name, 'test', []);
}

public function getWindowsConfigureArg(): string
{
return '';
Expand Down
6 changes: 4 additions & 2 deletions src/SPC/builder/traits/UnixBuilderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ public function sanityCheck(int $build_target): void
if ($ret !== 0) {
throw new RuntimeException('extension ' . $ext->getName() . ' failed compile check');
}
if (file_exists(ROOT_DIR . '/src/globals/tests/' . $ext->getName() . '.php')) {
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php ' . ROOT_DIR . '/src/globals/tests/' . $ext->getName() . '.php');

$tests = $ext->getTests();
if ($tests !== []) {
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -r "' . implode('', $tests) . '"');
if ($ret !== 0) {
throw new RuntimeException('extension ' . $ext->getName() . ' failed sanity check');
}
Expand Down
5 changes: 0 additions & 5 deletions src/globals/tests/bcmath.php

This file was deleted.

8 changes: 0 additions & 8 deletions src/globals/tests/bz2.php

This file was deleted.

6 changes: 0 additions & 6 deletions src/globals/tests/calendar.php

This file was deleted.

5 changes: 0 additions & 5 deletions src/globals/tests/curl.php

This file was deleted.

8 changes: 0 additions & 8 deletions src/globals/tests/dom.php

This file was deleted.

5 changes: 0 additions & 5 deletions src/globals/tests/filter.php

This file was deleted.

9 changes: 0 additions & 9 deletions src/globals/tests/gd.php

This file was deleted.

5 changes: 0 additions & 5 deletions src/globals/tests/intl.php

This file was deleted.

5 changes: 0 additions & 5 deletions src/globals/tests/redis.php

This file was deleted.

5 changes: 0 additions & 5 deletions src/globals/tests/zip.php

This file was deleted.

5 changes: 0 additions & 5 deletions src/globals/tests/zlib.php

This file was deleted.