Repository navigation
Conversation
The release tarballs this repository was imported from leave out the C++ sources of the test programs that src/test-bin/Makefile.am builds; the test scripts and their inputs and expected outputs (src/test-bin, osm-3s_testing) are already here. These 34 files are copied unchanged from drolbr/Overpass-API at 87bfad1 (branch minor_issues), the commit that src/overpass_api/core/settings.cc names as this code's source_hash. They are every file that src/test-bin/Makefile.am references and that is missing here, apart from four that drolbr's repository doesn't have either. Co-Authored-By: Colin Dellow <cldellow@gmail.com>
cldellow
force-pushed
the
revive-test-suites
branch
4 times, most recently
from
November 27, 2026 04:17
bdca871 to
2f9513d
Compare
The suites expect a build installed with the repository root as prefix,
so that bin/, cgi-bin/ and test-bin/ sit next to src/ (the top-level
.gitignore already lists them), and are run from osm-3s_testing:
cd osm-3s_testing && ./turn_testing_on.sh
cd ../src && autoreconf -i && ./configure --prefix="$(cd .. && pwd)"
make install
cd ../osm-3s_testing && ../test-bin/run_testsuite.sh 40
With the changes below, every suite passes at size 40: 776 tests
report success, and the attic, vlt and implicit areas suites, which
report only differences, report none. Size 40 is
needed: the expected outputs of osm3s_query and run_and_compare.sh are
fixed files made at that size, while the other suites generate theirs
for any size.
- turn_testing_on.sh: use Makefile.test.am and configure.test.ac only if
they exist. When they don't, `diff -q` prints nothing to stdout, so the
script tried to move the missing file and left testing off.
- osm3s_query: osm3s_query now writes "runtime remark: Timeout is N and
maxsize is M." to stderr. Add it to the expected stderr of the tests
from 20 on that still run.
- osm3s_query 22: after a foreach, `_` is empty, as the statements unit
test foreach 2 expects, but the expected output prints the input set.
Write the foreach and the query in it to their own sets, so that `_`
keeps the input set and the expected output still holds.
- osm3s_query: when a query hits its timeout or element limit, the
progress message starts with the elapsed time ("After 0h0m2s: ") and
ends with where the query stood (" Stack: ..."). Both depend on the
machine and on timing: a query that hits its element limit at once
reports 0h0m1s if it starts just before a second boundary. Replace the
elapsed time with "After: " and strip the stack, here and in the
expected outputs.
- osm3s_query: skip tests 19, 28, 31, 34, 66 and 67. They expect a query
to hit, or not hit, a one-second timeout, but without the timeout their
queries take only 1.3 to 5.9 seconds, so the result depends on the
machine: on two machines 19 always finished, 31 always timed out, and
28, 34 and 67 varied. The other nine timeout tests run queries that
take 12 seconds to over two minutes and still run. The skipped tests'
input and expected files are unchanged.
- run_and_compare.sh 1 to 3 (osm_backend): the expected outputs were made
at size 2000 and with an older progress format. Replace them with the
output at size 40.
- implicit areas: add the runtime remark to the expected stderr.
area_bbox no longer reports "Filters too weak"; its output is
unchanged.
- run_testsuite.sh: also run run_unittests_implicit_areas.sh.
- Ignore result.osm, which run_unittests_areas.sh leaves behind.
Co-Authored-By: Colin Dellow <cldellow@gmail.com>
Extend the existing CI job, which runs on every push and pull request, so that it turns test-bin on, installs into the repository root (the test scripts expect bin/, cgi-bin/ and test-bin/ next to src/), runs run_testsuite.sh at size 40, and fails if any test reports FAILED or a difference from its expected output. On failure, it uploads the log and the failed tests' outputs. The scripts always exit 0, so the job checks their output. Build with -D_GLIBCXX_ASSERTIONS, so that out-of-bounds indexing into a std::string or std::vector aborts instead of reading past the end unnoticed, and with one make job per CPU. The job now takes about 9 minutes: 6 to build, including the test programs, and 2 to run the suites. Co-Authored-By: Colin Dellow <cldellow@gmail.com>
Add run_testsuite_regressions.sh, which runs every test in
osm-3s_testing/input/regression_*/ and compares its output with
expected/regression_*/, and call it from run_testsuite.sh. Each test is
one directory, so a fix can add its test without changing a script:
stdin.log the query (for a CGI test, the request body, if any)
init.osm optional: data imported into a database of the test's own
import.args optional: arguments for update_database (default --meta)
env optional: run cgi-bin/interpreter with these environment
variables instead of osm3s_query, with a dispatcher over
the test's database
Each test runs for at most 60 seconds and writes at most 10 MB per file,
so a test of a hang fails rather than blocks the suite. The database is
created with mktemp, because the dispatcher's socket path in a directory
under osm-3s_testing/run can exceed the length limit for socket paths.
The script passes shellcheck.
The following commits add tests for the fixes since v0.7.62.11. They
leave out the parts of #4 that leave the output of a request unchanged
(reading the POST body in chunks, the scope of the "=" search, the
operates_* checks in pt_diagrams), the cgi-bin shell scripts of #3,
and the performance changes of #8 and #11.
Co-Authored-By: Colin Dellow <cldellow@gmail.com>
Test 04c045b, "Stop the OverpassQL parser looping past the nesting limit": node(1); inside 1024 levels of parentheses. The parser reports that nesting is limited to 1023 levels and stops. With the fix reverted (git revert -n 04c045b), it reports parse errors without end, and the test stops when the output reaches 10 MB. Co-Authored-By: Colin Dellow <cldellow@gmail.com>
Test #4: a GET request for data=[out:custom];node(1);out; with url=http://example.com/%0d%0aX-Injected:%201 is rejected with 400 Bad Request. With #4 reverted (git revert -n -m 1 8edf11b), the response is a 302 redirect with an extra header line "X-Injected: 1". Co-Authored-By: Colin Dellow <cldellow@gmail.com>
Test #4: a GET request for data=node(1);out;% keeps the "%" and fails to parse. Before #4, replace_cgi read raw[pos+2], one past the end of the string, for a "%" in the last position. The result was discarded, so the output is the same with or without the fix, but in a build with -D_GLIBCXX_ASSERTIONS, as in CI, the old code aborts. With #4 reverted (git revert -n -m 1 8edf11b) and that flag, the test fails. Co-Authored-By: Colin Dellow <cldellow@gmail.com>
cldellow
force-pushed
the
revive-test-suites
branch
2 times, most recently
from
November 27, 2026 04:49
1f202ea to
27edf5c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #257.
Based on
upstream/master. This PR is mainly to check that CI runs the suites on pull requests.Change
Nine commits, meant to be reviewed one at a time:
test-bin: restore the unit test sourcesadds the 34 C++ files thatsrc/test-bin/Makefile.ambuilds. They're copied unchanged from drolbr/Overpass-API at87bfad18, the tip of itsminor_issuesbranch and the source of the v0.7.62.11 release. Every blob hash matches.test suites: fix stale expected outputs and skip timing-dependent testsmakes every suite pass at size 40, with no workflow changes:osm-3s_testing/turn_testing_on.sh, which left testing off;After 0h0m2s:) andStack:progress in limit messages;The commit message lists each change.
CI: run the test suitesextends the existing job inci.ymlrather than adding a workflow. Her steps stay; it adds:--prefix="$GITHUB_WORKSPACE"andCXXFLAGS="-g -O2 -D_GLIBCXX_ASSERTIONS"to configure. With the prefix,make installputsbin/,cgi-bin/andtest-bin/where the scripts expect them. With assertions, out-of-bounds indexing into astd::stringorstd::vectoraborts instead of passing unnoticed;make -j"$(nproc)" install;run_testsuite.sh 40. It fails if any test reportsFAILEDor a difference, or if the suites didn't run at all; the scripts always exit 0, so it checks their output.test suites: add a suite for regression testsaddsrun_testsuite_regressions.sh, which passes shellcheck. Each test is one directory with:A future fix can add its test without changing a script. Each test runs for at most 60 seconds and writes at most 10 MB per file, so a test of a hang fails rather than blocks the suite.
Commits 5 to 9 add one regression test each, for the fixes since v0.7.62.11:
regression_ql_nesting_limit:node(1);inside 1024 levels of parentheses04c045b9, parser nesting limitregression_user_touched_relations:rel(1); nwr._(uid_touched:999999999); out count;and, as a control, the same withuid_touched:14a9c1b59,userfilter on relationsregression_cgi_custom_url_line_break: GETdata=[out:custom];node(1);out;withurl=http://example.com/%0d%0aX-Injected:%2018edf11b0, CGI fixesX-Injected: 1header line instead of 400 Bad Requestregression_cgi_bbox_not_numeric: GETdata=node(bbox);out;withbbox=7,51,8);node(id:1,528edf11b0, CGI fixesnode(51,7,52,8);node(id:1);out;and returns node 1, instead of failing to parseregression_cgi_truncated_percent: GETdata=node(1);out;%8edf11b0, CGI fixesreplace_cgireads one past the end of the string. That's only visible with-D_GLIBCXX_ASSERTIONS, as in CI, where it aborts.Impact on the benchmark queries
None. The PR changes no code that the server or the query tools run. It adds test programs (built only when testing is turned on), test scripts, test data and CI steps.
Testing
run_testsuite.sh 40reports 781 tests succeeding, and no failures or differences. The attic, vlt and implicit areas suites only report differences, and report none.git revert -n 04c045b9,git revert -n 4a9c1b59,git revert -n -m 1 8edf11b0), with-D_GLIBCXX_ASSERTIONS. Exactly the tests in the table failed, and with nothing reverted all passed.87bfad18.Limitations and open questions
run_and_compare.shexpected outputs are fixed files made at that size.foreach,_is now empty, as the statements unit testforeach 2expects. The test's input now writes the loop and its query to their own sets, so its original expected output still holds.8edf11b0that leave the output unchanged even with assertions: reading the POST body in chunks, the scope of the=search, and theoperates_*checks inpt_diagrams;cgi-binshell script fixes in284d0d18;48d5aa5eandd4510489, which change only performance.printloop). It should go in an issue of its own.🤖 Generated with Claude Code
https://claude.ai/code/session_01736kJTiuJPoCWZs7RtFYjm