Skip to content

Conversation

@karlseguin
Copy link
Collaborator

Preserves all existing behavior (i.e. make test and zig build test are not changed in any way).

The new 'unittest' only runs unit tests and is fast to build. It takes ~1.7 to build unittest, vs ~11.09 to build test. This is really the main goal, and hopefully any unit test which are (a) fast and (b) don't impact build times will be run here.

The test runner is based on:
https://gist.github.com/karlseguin/c6bea5b35e4e8d26af6f81c22cb5d76b

It allow filtering, i.e. make unittest F="parse query dup".

'unittest' does memory leak detection when tests use std.testing.allocator.

Fixed a memory leak in url/query which was detected/reported with by the new 'unittest'.

In order to avoid having 3 src/test_xyx.zig files, I merged the existing test_runner.zig and run_tests.zig into a single main_tests.zig. (this change is superfluous, but I thought it was cleaner this way. Happy to revert this).

@krichprollsch krichprollsch self-requested a review February 8, 2025 11:44
Preserves all existing behavior (i.e. make test and zig build test are not
changed in any way).

The new 'unittest' only runs unit tests and is fast to build. It takes ~1.7 to
build unittest, vs ~11.09 to build test. This is really the main goal, and
hopefully any unit test which are (a) fast and (b) don't impact build times
will be run here.

The test runner is based on:
https://gist.github.com/karlseguin/c6bea5b35e4e8d26af6f81c22cb5d76b

It allow filtering, i.e. `make unittest F="parse query dup"`.

'unittest' does memory leak detection when tests use std.testing.allocator.

Fixed a memory leak in url/query which was detected/reported with by the new
'unittest'.

In order to avoid having 3 src/test_xyx.zig files, I merged the existing
test_runner.zig and run_tests.zig into a single main_tests.zig. (this change
is superfluous, but I thought it was cleaner this way. Happy to revert this).
Change loader tests to use local HTTP server.

Add missing test scripts (i.e. storage) to unittest runs.
var loader = Loader.init(alloc);
defer loader.deinit();

var result = try loader.get(alloc, "https://en.wikipedia.org/wiki/Main_Page");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep a test using TLS also...
But I agree having something locally is really better.

Maybe we could imagine an optional slower test suite for these kind of test we could run in CI.
But It's not a blocker for now.

@krichprollsch krichprollsch merged commit c78b582 into lightpanda-io:main Feb 10, 2025
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 10, 2025
@karlseguin karlseguin deleted the unittest_build branch February 10, 2025 08:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants