Skip to content

Kaitai Struct: tests in all supported programming languages

License

Notifications You must be signed in to change notification settings

Mingun/kaitai_struct_tests

This branch is 2 commits ahead of, 316 commits behind kaitai-io/kaitai_struct_tests:master.

Folders and files

NameName
Last commit message
Last commit date
Jul 13, 2024
Jul 14, 2024
Sep 28, 2023
Jul 16, 2024
Apr 15, 2024
Jul 12, 2024
Jul 28, 2023
Jul 16, 2024
Apr 7, 2022
Jul 16, 2024
Apr 3, 2020
Jul 19, 2023
Nov 6, 2020
Sep 16, 2019
Apr 20, 2019
Mar 28, 2024
Dec 19, 2020
Apr 13, 2020
Nov 6, 2021
Aug 4, 2023
Mar 22, 2024
Nov 16, 2018
Nov 16, 2018
Apr 27, 2019
Jul 12, 2024
Apr 17, 2019
Apr 27, 2019
Oct 10, 2023
Apr 28, 2024
Aug 13, 2020
Nov 6, 2021
Apr 17, 2017
Apr 27, 2019
Aug 4, 2023
Oct 12, 2019
Aug 19, 2018
Apr 26, 2024
Jun 10, 2024
Apr 26, 2024
Jul 12, 2024
Mar 18, 2024
Aug 4, 2023
Apr 11, 2019
Oct 6, 2019
Oct 6, 2019
Apr 9, 2019
Apr 15, 2018
Apr 13, 2019
Oct 10, 2023
Apr 26, 2024
Aug 13, 2020
Feb 20, 2022
Apr 27, 2019
Jul 8, 2023
Jul 22, 2023
Aug 4, 2023
Mar 16, 2018
Oct 7, 2019
Dec 16, 2020
Dec 16, 2020
Mar 22, 2024

Repository files navigation

Kaitai Struct: specs and tests

This repository contains specifications and tests for Kaitai Struct project.

What's inside

The repository is laid out like that:

  • src/ - binary input files that would be parsed during the tests
  • formats/ - file formats description is Kaitai Struct YAML format for the files in src/
  • spec/ - specifications (i.e. test code) that uses format descriptions to parse binary input files and ensures that they're parsed properly.
    • $LANGUAGE/ - one subdirectory per every supported target language

During the testing the following is expected to be created:

  • compiled/ - formats (described in formats/), compiled into specific programming languages modules
    • $LANGUAGE/ - one subdirectory per every supported target language
  • test_out/ - test running output, in a language-specific format
    • $LANGUAGE/ - one subdirectory per every supported target language

How to test

The overall procedure of testing works as follows:

  • Make sure that KS compiler (ksc) is built and ready to be used
  • Compile format descriptions in formats/ into source files in relevant programming languages (Java, Python, Ruby, etc), which should be placed in compiled/$LANGUAGE.
  • Compile and run test code for particular language (located in spec/$LANGUAGE), which will use files in src/ for input.
  • Aggregate and view results

Automated test tools

There are a few scripts that automate steps specified above:

  • build-compiler builds compiler using special "stage" mode, i.e. without system-wide deployment, ready to be run from a build directory
  • build-formats compiles all format descriptions in formats/ with this compiler for every supported language, placing results in compiled/$LANGUAGE
  • run-$LANGUAGE executes all tests for a particular $LANGUAGE using preferred language-specific testing tool. The output is generally dumped on screen for quick assessment during development.
  • ci-$LANGUAGE also runs all tests for a particular $LANGUAGE, but logs all output into designated log file instead (mostly useful for aggregation within a CI system afterwards).

Obviously, these scripts require Kaitai Struct compiler and language-specific runtime modules. They are normally located in distinct repositories - there is a file named /config that specifies their default locations. If you've used main Kaitai Struct project to check out all linked repositories as submodules in their default locations, you don't need to adjust anything. If you have these dependencies in some other places, just edit the /config.

Continuous integration

Main Kaitai Struct project includes a Travis CI configuration. This mean that every commit to main project repository gets automatically built and tested throughly. The results are published at Kaitai Struct CI results page.

Please refer to CI documentation for a throughout overview of how this all is tied together in a bigger picture.

About

Kaitai Struct: tests in all supported programming languages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 40.9%
  • Scala 24.9%
  • C++ 17.0%
  • Shell 12.0%
  • C# 2.7%
  • JavaScript 1.9%
  • Other 0.6%