Nicolas Setton ec89ff0cc7 Add an "adareducer" script at the toplevel
For the benefit of the development environment, or any
users who only "git clone" this repository and work from it.

Fix the testsuite using this.

Rename the "adareducer" source dir to "ada_reducer"
2022-02-02 16:18:41 +00:00
2022-01-31 15:06:32 +00:00
2021-05-11 12:40:45 +01:00
2021-05-11 12:40:45 +01:00
2021-05-11 12:40:45 +01:00
2022-01-31 15:06:32 +00:00

adareducer

This program can be used to reduce an Ada code base to a smaller code base while maintaining a base property. It is typically used for minimising a bug reproducer.

Installation

Get a Python 3.7+ interpreter, install Libadalang's Python bindings and then run:

pip install /path/to/your/adareducer/clone

Usage

The interface is similar to that of the C-Reduce program for C/C++ code bases:

adareducer project_file oracle.sh

Where project_file is the path to a valid .gpr project file, and oracle.sh is a bash script which returns 0 as long as the program satisfies the base property that you are testing for, and non-zero otherwise.

For instance, if you are interested in reducing the program while maintaining the property that a particular file contains the text "hello", the oracle might contain something like this:

grep "hello" foo.adb

If you are interested in getting the minimum program that compiles and prints "hello", the oracle might look like this:

# Build the program and exit if the program doesn't build
# Note the -m2 switch: this tells gprbuild not to look at the
# timestamps, but the checksum
gprbuild -m2 -P p.gpr || exit 1

# Launch the program and verify that it prints "hello"
./main | grep "hello"
Description
No description provided
Readme GPL-3.0 176 KiB
Languages
Python 93.2%
Shell 3.8%
Ada 2.7%
PowerShell 0.2%
Makefile 0.1%