mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
change with-micro-ext-test to without
This commit is contained in:
parent
9ee7d7769a
commit
0b1a321615
@ -369,8 +369,10 @@ abstract class BuilderBase
|
|||||||
|
|
||||||
foreach ($this->getExts() as $ext) {
|
foreach ($this->getExts() as $ext) {
|
||||||
$ext_name = $ext->getDistName();
|
$ext_name = $ext->getDistName();
|
||||||
$php .= "echo 'Running micro with {$ext_name} test' . PHP_EOL;\n";
|
if (!empty($ext_name)) {
|
||||||
$php .= "assert(extension_loaded('{$ext_name}'));\n\n";
|
$php .= "echo 'Running micro with {$ext_name} test' . PHP_EOL;\n";
|
||||||
|
$php .= "assert(extension_loaded('{$ext_name}'));\n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$php .= "echo '[micro-test-end]';\n";
|
$php .= "echo '[micro-test-end]';\n";
|
||||||
return $php;
|
return $php;
|
||||||
|
|||||||
@ -178,12 +178,17 @@ abstract class UnixBuilderBase extends BuilderBase
|
|||||||
file_put_contents(
|
file_put_contents(
|
||||||
SOURCE_PATH . '/hello.exe',
|
SOURCE_PATH . '/hello.exe',
|
||||||
file_get_contents(SOURCE_PATH . '/php-src/sapi/micro/micro.sfx') .
|
file_get_contents(SOURCE_PATH . '/php-src/sapi/micro/micro.sfx') .
|
||||||
'<?php echo "hello";'
|
($this->getOption('without-micro-ext-test') ? '<?php echo "[micro-test-start][micro-test-end]";' : $this->generateMicroExtTests())
|
||||||
);
|
);
|
||||||
chmod(SOURCE_PATH . '/hello.exe', 0755);
|
chmod(SOURCE_PATH . '/hello.exe', 0755);
|
||||||
[$ret, $output2] = shell()->execWithResult(SOURCE_PATH . '/hello.exe');
|
[$ret, $output2] = shell()->execWithResult(SOURCE_PATH . '/hello.exe');
|
||||||
if ($ret !== 0 || trim($out = implode('', $output2)) !== 'hello') {
|
$raw_out = trim(implode('', $output2));
|
||||||
throw new RuntimeException('micro failed sanity check, ret[' . $ret . '], out[' . ($out ?? 'NULL') . ']');
|
$condition[0] = $ret === 0;
|
||||||
|
$condition[1] = str_starts_with($raw_out, '[micro-test-start]') && str_ends_with($raw_out, '[micro-test-end]');
|
||||||
|
foreach ($condition as $k => $v) {
|
||||||
|
if (!$v) {
|
||||||
|
throw new RuntimeException("micro failed sanity check with condition[{$k}], ret[{$ret}], out[{$raw_out}]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -261,7 +261,7 @@ class WindowsBuilder extends BuilderBase
|
|||||||
file_put_contents(
|
file_put_contents(
|
||||||
SOURCE_PATH . '\hello.exe',
|
SOURCE_PATH . '\hello.exe',
|
||||||
file_get_contents(BUILD_ROOT_PATH . '\bin\micro.sfx') .
|
file_get_contents(BUILD_ROOT_PATH . '\bin\micro.sfx') .
|
||||||
($this->getOption('with-micro-ext-test') ? $this->generateMicroExtTests() : '<?php echo "[micro-test-start][micro-test-end]";')
|
($this->getOption('without-micro-ext-test') ? '<?php echo "[micro-test-start][micro-test-end]";' : $this->generateMicroExtTests())
|
||||||
);
|
);
|
||||||
chmod(SOURCE_PATH . '\hello.exe', 0755);
|
chmod(SOURCE_PATH . '\hello.exe', 0755);
|
||||||
[$ret, $output2] = cmd()->execWithResult(SOURCE_PATH . '\hello.exe');
|
[$ret, $output2] = cmd()->execWithResult(SOURCE_PATH . '\hello.exe');
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class BuildCliCommand extends BuildCommand
|
|||||||
$this->addOption('with-suggested-libs', 'L', null, 'Build with suggested libs for selected exts and libs');
|
$this->addOption('with-suggested-libs', 'L', null, 'Build with suggested libs for selected exts and libs');
|
||||||
$this->addOption('with-suggested-exts', 'E', null, 'Build with suggested extensions for selected exts');
|
$this->addOption('with-suggested-exts', 'E', null, 'Build with suggested extensions for selected exts');
|
||||||
$this->addOption('with-added-patch', 'P', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Inject patch script outside');
|
$this->addOption('with-added-patch', 'P', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Inject patch script outside');
|
||||||
$this->addOption('with-micro-ext-test', null, null, 'Enable phpmicro with extension test code');
|
$this->addOption('without-micro-ext-test', null, null, 'Disable phpmicro with extension test code');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user