Add transformation block support v0.21.0
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 11 Oct 2023 14:48:28 +0000 (10:48 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 11 Oct 2023 15:08:53 +0000 (11:08 -0400)
commitcd33dfe61ea9d6c08460d800bb995cdb774c3c48
tree7dac74cc3eb0424c07a25490b914de44bd3dca9c
parentba11fb1d54eed503a11e9c31339eb2f68fe776e4
Add transformation block support

A transformation block represents the transformed bytes of one or more
items, for example:

    !transform base64
      "hello how are you"
      {ICITTE:8} * 20
    !end

    61 47 56 73 62 47 38 67  61 47 39 33 49 47 46 79  ┆ aGVsbG8gaG93IGFy
    5a 53 42 35 62 33 55 52  45 68 4d 55 46 52 59 58  ┆ ZSB5b3UREhMUFRYX
    47 42 6b 61 47 78 77 64  48 68 38 67 49 53 49 6a  ┆ GBkaGxwdHh8gISIj
    4a 41 3d 3d                                       ┆ JA==

It's effectively calling a function with the bytes of the block items.

As of this version, Normand only features a specific set of
transformation functions. In the future the user should be able to
define its own transformations (named functions passed to
normand.parse() I guess).

The gzip and bzip2 formats include a timestamp, so the `tests/*.nt`
approach doesn't work here: adding `tests/test_trans_gz_bz2.py` which
uses normand.parse() to compress some data D, and then decompresses the
result using the correct module and compares to D.

Change-Id: I31eb296fa9ba726ee9695cc1cf049abd7cabaf52
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/normand/+/11030
Tested-by: jenkins <jenkins@lttng.org>
20 files changed:
README.adoc
normand/normand.py
pyproject.toml
tests/fail-trans-inval-type.nt [new file with mode: 0644]
tests/fail-trans-missing-type.nt [new file with mode: 0644]
tests/fail-trans-unknown-label.nt [new file with mode: 0644]
tests/pass-comment-all.nt
tests/pass-readme-learn-trans.nt [new file with mode: 0644]
tests/pass-trans-a85.nt [new file with mode: 0644]
tests/pass-trans-a85p.nt [new file with mode: 0644]
tests/pass-trans-b16.nt [new file with mode: 0644]
tests/pass-trans-b32.nt [new file with mode: 0644]
tests/pass-trans-b64.nt [new file with mode: 0644]
tests/pass-trans-b64u.nt [new file with mode: 0644]
tests/pass-trans-b85.nt [new file with mode: 0644]
tests/pass-trans-b85p.nt [new file with mode: 0644]
tests/pass-trans-qp.nt [new file with mode: 0644]
tests/pass-trans-qpt.nt [new file with mode: 0644]
tests/test_api.py
tests/test_trans_gz_bz2.py [new file with mode: 0644]
This page took 0.024757 seconds and 4 git commands to generate.