Commit graph

102 commits

Author SHA1 Message Date
Arne Welzel
32d7cec549 testing/btest: Remove btest-bg-run sleep 1
Bump to the latest btest master version and set BTEST_BG_RUN_SLEEP
environment variable and to 0. This makes btest-bg-run return
immediately instead of delaying by 1 second.
2025-03-20 10:11:12 +01:00
Vern Paxson
85ef6e0cb8 removed a bunch of no-longer used BTest alternatives and their associated baselines 2024-12-12 19:16:34 -08:00
Vern Paxson
47a555da87 BTest updates for ZAM support of (optionally) keeping "assert" statements 2024-12-03 10:40:41 -07:00
Arne Welzel
de9d39cd01 btest: Add cluster dir, minimal test for enum value 2024-11-22 10:43:55 +01:00
Arne Welzel
f3fbe45c4c btest: Add integration test for DNS_Mgr
This makes use of an ephemeral dnsmasq instance
2024-11-08 11:29:31 +01:00
Arne Welzel
7b99fc01a9 testing/btest: Default to HILTI_JIT_PARALLELISM=1
This is a rework of b59bed9d06 moving
HILTI_JIT_PARALLELISM=1 into btest.cfg to make it default applicable to
btest -j users (and CI).

The background for this change is that spicyz may spawn up to nproc compiler
instances by default. Combined with btest -j, this may be nproc x nproc
instances worst case. Particularly with gcc, this easily overloads CI or
local systems, putting them into hard-to-recover-from thrashing/OOM states.

Exporting HILTI_JIT_PARALLELISM in the shell allows overriding.
2024-07-10 11:04:47 +02:00
Arne Welzel
43fec1f2c8 ci/btest: Remove ZEEK_PROFILER_FILE from btest.cfg, set in ci/test.sh explicitly
The produced coverage files are of little use in current local workflows
and usually just end-up taking up disk space. ZEEK_PROFILER_FILE can be
set explicitly if there's a one-off need to produce these locally, too.
2023-12-15 15:23:52 +01:00
Arne Welzel
60e997a3fd btest: Move zam/basic.test into opt/basic.test, update TestDirs
It seems "opt" can and should run unconditionally. The "misc" dir was
definitely an oversight.
2023-11-08 15:46:54 +01:00
Vern Paxson
42697d72f2 minor BTest generalizations & simplifications 2023-07-13 13:10:14 -07:00
Arne Welzel
b9803e157b btest.cfg: Set HILTI_CXX_COMPILER_LAUNCHER based on build/CMakeCache.txt
If CMakeCache.txt indicates the Zeek build was done with ccache,
take the CCACHE_PROGRAM:FILEPATH= line and populate the
HILTI_CXX_COMPILER_LAUNCHER environment.

For local development with ccache, this speeds up the spicy tests
significantly after the initial run without knowing or needing know
that setting HILTI_CXX_COMPILER_LAUNCHER would've helped.
2023-05-25 13:42:12 +02:00
Robin Sommer
10477b38aa
Move Spicy submodule a layer up.
This moves `auxil/spicy/spicy` to `auxil/spicy`. It relocates the
pieces previously inside that intermediary directory. The main change
is that now tweak the compilation flags for Spicy through target
options.

This is on top of `topic/robin/spicy-plugin`.
2023-05-16 12:09:12 +02:00
Robin Sommer
0040111955
Integrate the Spicy plugin into Zeek proper.
This reflects the `spicy-plugin` code as of `d8c296b81cc2a11`.

In addition to moving the code into Zeek's source tree, this comes
with a couple small functional changes:

- `spicyz` no longer tries to infer if it's running from the build
  directory. Instead `ZEEK_SPICY_LIBRARY` can be set to a custom
  location. `zeek-set-path.sh` does that now.

- ZEEK_CONFIG can be set to change what `spicyz -z` print out. This is
  primarily for backwards compatibility.

Some further notes on specifics:

- We raise the minimum Spicy version to 1.8 (i.e., current `main`
  branch).

- Renamed the `compiler/` subdirectory to `spicyz` to avoid
  include-path conflicts with the Spicy headers.

- In `cmake/`, the corresponding PR brings a new/extended version of
  `FindZeek`, which Spicy analyzer packages need. We also now install
  some of the files that the Spicy plugin used to bring for testing,
  so that existing packages keep working.

- For now, this all remains backwards compatible with the current
  `zkg` analyzer templates so that they work with both external and
  integrated Spicy support. Later, once we don't need to support any
  external Spicy plugin versions anymore, we can clean up the
  templates as well.

- All the plugin's tests have moved into the standard test suite. They
  are skipped if configure with `--disable-spicy`.

This holds off on adapting the new code further to Zeek's coding
conventions, so that it remains easier to maintain it in parallel to
the (now legacy) external plugin. We'll make a pass over the
formatting for (presumable) Zeek 6.1.
2023-05-16 10:17:45 +02:00
Arne Welzel
aaf68a4e2c btest: Add af_packet to TestDirs 2023-04-25 14:51:18 +02:00
Arne Welzel
f0b9c59adb Add experimental JavaScript support when libnode is available
zeek.on('zeek_init', () => {
        console.log('Hello, Zeek!');
    });

For interaction with external systems and HTTP APIs, JavaScript and the
Node.js ecosystem beat Zeek script. Make it more easily accessible by
including ZeekJS with Zeek directly.

When a recent enough libnode version is found on the build system, ZeekJS is
added as a builtin plugin. This behavior can be disabled via
``--disable-javascript``. Linux distributions providing such a package are
Ubuntu (22.10) and Debian (testing/bookworm) as libnode-dev.
Fedora provides it as nodejs-devel.

This plugin takes over loading of .js or .cjs files. When no such files
are provided to Zeek, Node and the V8 engine are not initialized and
should not get into the way.

This should be considered experimental.
2023-04-14 11:26:41 +02:00
Tim Wojtulewicz
7623e9f290 Use pathsep btest value in btest.cfg 2023-01-19 09:13:33 -07:00
Tim Wojtulewicz
b3498da983 Use build_dir btest value in btest.cfg 2023-01-19 09:13:33 -07:00
Benjamin Bannier
e40aa0f6d2 Add tests for bundled Spicy infrastructure. 2022-05-16 09:07:11 +02:00
Benjamin Bannier
b23eb76043 Disable formatting for files in testing/btest/plugins
Files in that folder were previously not formatted. With this patch we
now disable formatting in that folder explicitly by adding a dedicated
`clang-format` config which deactivates any formatting changes.
2021-11-09 07:20:18 +01:00
Vern Paxson
509428a9dc removing -uu functionality and associated script analysis now no longer needed 2021-09-22 11:17:28 -07:00
Vern Paxson
9722b4216f new "-a ZAM" testing baseline alternative 2021-09-08 10:23:38 -07:00
Vern Paxson
db7f88e661 new "-a cpp" btest alternative 2021-05-05 16:55:04 -07:00
Dominik Charousset
2bac354e43 Expose telemetry API to scripting land 2021-03-29 10:47:32 +02:00
Vern Paxson
8f21432f76 new "opt" btest alternative 2021-02-27 11:41:23 -08:00
Vern Paxson
0a6270365f splitting out "usage" test suite alternative into -u/-uu versions 2021-02-06 11:01:04 -08:00
Vern Paxson
c43925b7ee updates to test suite, including new baseline for "-a usage" environment 2021-01-23 10:57:08 -08:00
Vern Paxson
0e4c996718 new testing alternative for script transformation (= xform) 2021-01-10 14:24:18 -08:00
Vern Paxson
eb1848c547 cleaner approach for localizing errors associated with duplicated ASTs: virtualize GetLocationInfo 2021-01-07 15:14:22 -08:00
Vern Paxson
c42586af2c inlining of Zeek script functions 2020-11-19 16:16:59 -08:00
Robin Sommer
df48b7ea57 Update BTest to 0.63.
New baselines will now be store canonified.

Also setting new MinVersion option in btest.cfg.
2020-10-20 09:01:11 +00:00
Jon Siwek
efcbf979f5 Add framework for running UndefinedBehaviorSanitizer in CI
Many checks are initially disabled because they do cause failures
when running the test suites.
2020-09-18 11:32:05 -07:00
Jon Siwek
23ad81400b Rename aux/ to auxil/
Since "aux" is not an allowed file/dir name on Windows.
2020-06-04 15:18:44 -07:00
Jon Siwek
a2b0abe283 Add environment variable to disable supervisor SIGKILL
For use in btests since SIGKILL can otherwise bypass the usual
btest-bg-wait timeout mechanism and make reason for test failures less
obvious.
2020-02-06 17:50:17 -08:00
Jon Siwek
1972190b89 Add supervisor btests 2020-01-16 19:21:53 -08:00
Daniel Thayer
1a74516db1 Rename all BRO-prefixed environment variables
For backward compatibility when reading values, we first check
the ZEEK-prefixed value, and if not set, then check the corresponding
BRO-prefixed value.
2019-05-22 00:12:31 -05:00
Jon Siwek
13867f53c3 Update btest.cfg path to use zeek-aux 2019-05-14 18:36:20 -07:00
Daniel Thayer
bbaee15280 Undo a change to btest.cfg from a recent commit
Remove a line from btest.cfg that was added (probably unintentionally)
in commit 789cb376.
2019-05-12 19:17:25 -05:00
Robin Sommer
789cb376fd GH-239: Rename bro to zeek, bro-config to zeek-config, and bro-path-dev to zeek-path-dev.
This also installs symlinks from "zeek" and "bro-config" to a wrapper
script that prints a deprecation warning.

The btests pass, but this is still WIP. broctl renaming is still
missing.

#239
2019-05-01 21:43:45 +00:00
Jon Siwek
67484a90fa GH-211: improve consistency of how scripting errors are handled
Scripting errors/mistakes now consistently generate a runtime error
which have the behavior of unwinding the call stack all the way out of
the current event handler.

Before, such errors were not treated consistently and either aborted
the process entirely or emitted a message while continuing to execute
subsequent statements without well-defined behavior (possibly causing
a cascade of errors).

The previous behavior also would only unwind out of the current
function (if within a function body), not out the current event
handler, which is especially problematic for functions that return
a value: the caller is essentially left a mess with no way to deal
with it.

This also changes the behavior of the startup/initialization process
to abort if there's errors during bro_init() rather than continue one
to the main run loop.  The `allow_init_errors` option may change this
new, default behavior.
2019-01-30 11:20:09 -06:00
Jon Siwek
9e5e9d04b7 Remove Sphinx btest integrations and tests 2018-12-14 16:32:35 -06:00
Jon Siwek
da9f91fc19 Add env. variables to override Broker listen/connect retry intervals
And use them to default retries to 1sec for all unit tests.
2018-08-16 12:16:03 -05:00
Daniel Thayer
7b3bad635b Disable broxygen when running unit tests
Disable broxygen when running unit tests (except for the tests that use
broxygen).  On my dual-core MacBook Pro, this change results in the
unit tests taking about 13% less time to finish running.
2018-06-19 16:30:40 -05:00
Jon Siwek
1b4e0116f4 Allow BRO_DEFAULT_LISTEN_ADDRESS to control broker listen address
This environment variable is now set to listen only on IPv4 loopback
when running unit tests (instead of using the default INADDR_ANY).

This also moves some of the @loads out from init-bare.bro into a new
init-frameworks-and-bifs.bro in order to better support calling BIFs
(like `getenv`) from variable initializations in those particular
frameworks.
2018-06-01 15:38:11 -05:00
Jon Siwek
55f14c2eb8 Relocate temporary script coverage files
So they don't clutter the top-level of unit test .tmp/ dir.
2018-06-01 11:30:36 -05:00
Robin Sommer
fe7e1ee7f0 Merge topic/actor-system throug a squashed commit. 2018-05-18 22:39:23 +00:00
Daniel Thayer
f6248994e4 Add /sbin to PATH in btest.cfg
Added /sbin to PATH so that a couple of tests that require ifconfig
are not skipped on systems (such as debian) which don't have /sbin
in PATH by default.

Also removed a duplicate default_path.
2015-05-04 14:47:56 -05:00
Jon Siwek
9e53722b57 Rename comm/ directories to broker/ 2015-03-05 17:02:25 -06:00
Jon Siwek
cfb666af2b broker integration: move listen port for unit tests to a btest variable
Later, this might be something btest itself could provide to help
parallelize communication tests.  E.g. unit tests requests a unique
number from some range and btest coordinates the distribution of those
among all tests.
2015-02-09 16:01:31 -06:00
Jon Siwek
5527543601 broker integration: add unit tests for remote log/print/event 2015-01-26 16:53:13 -06:00
Robin Sommer
91c218d44a Include plugin unit tests into the top-level btest configuration.
Turns out they weren't part of it yet. Comes with some baseline updates.
2014-10-07 15:33:18 -07:00
Robin Sommer
ccfd081437 Fixing PATH to bro-cut in BTest configuration. 2014-08-01 14:35:26 -07:00