Skip to content

Commit a4cd64f

Browse files
committed
Fix conformance score calculcation
1 parent 3e45b1f commit a4cd64f

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ vendor
66
examples/**/dev.log
77
examples/**/cache
88
examples/**/sessions
9+
tests/Conformance/client-conformance.json
10+
tests/Conformance/server-conformance.json
911
tests/Conformance/results
1012
tests/Conformance/sessions
1113
tests/Conformance/logs/*.log

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ conformance-server:
2727
docker compose -f tests/Conformance/Fixtures/docker-compose.yml up -d
2828
@echo "Waiting for server to start..."
2929
@sleep 5
30-
cd tests/Conformance && npx @modelcontextprotocol/conformance server --url http://localhost:8000/ || true
30+
rm -rf tests/Conformance/results
31+
cd tests/Conformance && npx @modelcontextprotocol/conformance server --url http://localhost:8000/ --output-dir results || true
32+
php tests/Conformance/score.php server
3133
docker compose -f tests/Conformance/Fixtures/docker-compose.yml down
3234

3335
conformance-client:
34-
cd tests/Conformance && npx @modelcontextprotocol/conformance client --command "php $(CURDIR)/tests/Conformance/client.php" --suite all --expected-failures conformance-baseline.yml || true
36+
rm -rf tests/Conformance/results
37+
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
38+
php tests/Conformance/score.php client
3539

3640
coverage:
3741
XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite=unit --coverage-html=coverage

tests/Conformance/score.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,21 @@
6868
continue;
6969
}
7070

71-
++$total;
72-
7371
foreach ($checks as $check) {
74-
if ('FAILURE' === ($check['status'] ?? null)) {
75-
$failures[] = $file->getRelativePath();
76-
77-
continue 2;
72+
switch ($check['status'] ?? null) {
73+
case 'FAILURE':
74+
$failures[] = $file->getRelativePath();
75+
break;
76+
case 'SUCCESS':
77+
++$passed;
78+
break;
79+
default:
80+
continue 2;
7881
}
82+
83+
++$total;
7984
}
8085

81-
++$passed;
8286
}
8387

8488
$pct = $total > 0 ? (int) round($passed / $total * 100) : 0;

0 commit comments

Comments
 (0)