Fix conformance score calculcation (#313)
This commit is contained in:
parent
3e45b1f486
commit
f12ea0ab58
3 changed files with 19 additions and 10 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -6,6 +6,8 @@ vendor
|
|||
examples/**/dev.log
|
||||
examples/**/cache
|
||||
examples/**/sessions
|
||||
tests/Conformance/client-conformance.json
|
||||
tests/Conformance/server-conformance.json
|
||||
tests/Conformance/results
|
||||
tests/Conformance/sessions
|
||||
tests/Conformance/logs/*.log
|
||||
|
|
|
|||
8
Makefile
8
Makefile
|
|
@ -27,11 +27,15 @@ conformance-server:
|
|||
docker compose -f tests/Conformance/Fixtures/docker-compose.yml up -d
|
||||
@echo "Waiting for server to start..."
|
||||
@sleep 5
|
||||
cd tests/Conformance && npx @modelcontextprotocol/conformance server --url http://localhost:8000/ || true
|
||||
rm -rf tests/Conformance/results
|
||||
cd tests/Conformance && npx @modelcontextprotocol/conformance server --url http://localhost:8000/ --output-dir results || true
|
||||
php tests/Conformance/score.php server
|
||||
docker compose -f tests/Conformance/Fixtures/docker-compose.yml down
|
||||
|
||||
conformance-client:
|
||||
cd tests/Conformance && npx @modelcontextprotocol/conformance client --command "php $(CURDIR)/tests/Conformance/client.php" --suite all --expected-failures conformance-baseline.yml || true
|
||||
rm -rf tests/Conformance/results
|
||||
cd tests/Conformance && npx @modelcontextprotocol/conformance client --command "php $(CURDIR)/tests/Conformance/client.php" --suite all --expected-failures conformance-baseline.yml --output-dir results || true
|
||||
php tests/Conformance/score.php client
|
||||
|
||||
coverage:
|
||||
XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite=unit --coverage-html=coverage
|
||||
|
|
|
|||
|
|
@ -68,17 +68,20 @@ require_once dirname(__DIR__, 2).'/vendor/autoload.php';
|
|||
continue;
|
||||
}
|
||||
|
||||
++$total;
|
||||
|
||||
foreach ($checks as $check) {
|
||||
if ('FAILURE' === ($check['status'] ?? null)) {
|
||||
$failures[] = $file->getRelativePath();
|
||||
|
||||
continue 2;
|
||||
switch ($check['status'] ?? null) {
|
||||
case 'FAILURE':
|
||||
$failures[] = $file->getRelativePath();
|
||||
break;
|
||||
case 'SUCCESS':
|
||||
++$passed;
|
||||
break;
|
||||
default:
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
++$passed;
|
||||
++$total;
|
||||
}
|
||||
}
|
||||
|
||||
$pct = $total > 0 ? (int) round($passed / $total * 100) : 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue