Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SieveScript/test: Allow prepopulating variables so your sieve scripts can behave differently during test #5176

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

wolfsage
Copy link
Contributor

No description provided.

This way consumers can validate identifiers if they need to.
Copy link
Contributor

@ksmurchison ksmurchison left a comment

Choose a reason for hiding this comment

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

This all looks sane to me (assuming CI passes)

imap/jmap_sieve.c Outdated Show resolved Hide resolved
This way, a sieve script can behave differently in test mode based on
provided parameters to the JMAP call.
Otherwise, a second SieveScript/test call in the same process will fail
because template will be invalid.

Also add logging if this happens so we can maybe figure out what went wrong.
This way SieveScript/test can reconstruct it properly
This will make it easy to test the SieveScript/test endpoint with various
inputs and outputs.
... so you can specify a bunch of related tests together.

Also fill in all of the fileinto tests we need for now.

With this, you can say:

    ./testrunner Cyrus::JMAPSieve.sieve_test_extensive_fileinto*

to run all of the fileinto tests defined in this file
Otherwise we might try to install weird subroutines and it just won't end
well.
The escaping of '\' was surprising and problematic when doing other types of
tests, like inline jmapquery expressions.

Rather than using that, escape manually when needed.
Without this, and jmapquerys that depend on the conversations db don't
work.

Also, we need to configure Cassandane::Cyrus::JMAPSieve to allow specific
flags to be counted so we can use SomeInThreadHaveKeyword in our tests.
@wolfsage wolfsage force-pushed the sieve-script-test-variables branch from c22fc98 to adcd55c Compare December 20, 2024 19:05
@@ -2257,7 +2259,6 @@ static int jmap_sieve_test(struct jmap_req *req)
}
}

if (interp_ctx.cstate) conversations_commit(&interp_ctx.cstate);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The convdb is opened for us by jmap_api. If we commit it here, we'll crash later because jmap_api.c will try to commit it too

@ksmurchison ksmurchison self-requested a review December 20, 2024 19:08
Avoid a crash when freeing the memory by freeing the strarray the same way
all of the other strarrays are freed here.

It appears that parts of the data are from a mmap'd read-only segment so
they can't be freed with normal strarray_free().
@wolfsage
Copy link
Contributor Author

wolfsage commented Jan 3, 2025

@rsto I've added include-in-fastmail to this one o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants