ACEUNIT(1)

NAME
aceunit - generate test fixtures from object files

SYNOPSIS
aceunit [OPTION]... [OBJECT_FILE]...

DESCRIPTION

Scans object files for test cases and generates the fixtures code on stdout.

OPTIONS

-b BINARY
    Use BINARY instead of the default for the selected tool. Example: -b m68k-amigaos-objdump

-h  Display help text and stop.

-n NAME
    Use NAME instead of fixtures as the symbol name for the fixture table.

-p PATTERN
    Prefix test functions with the specified PATTERN; PATTERN needs to be understood by grep. Example: -p '[^_\+_' to allow any pattern prefix followed by an underscore.

-s PATTERN
    Strip this prefix PATTERN from symbols before using them; PATTERN needs to be undestood by grep. Example: -s _ to strip a leading underscore from the symbols names.

-t TOOL
    Use TOOL for displaying the symbol table. Defaults to objdump. Built-in alternatives: nm, readelf.

-v  Print version information and stop.

DEPENDENCIES
aceunit requires objdump, readelf, or nm to work.

EXAMPLES

aceunit -p '[^_]+_' *_test.o >aceunit.c
    scans all object files matching the pattern *_test.o and write the found fixtures to aceunit.c.

aceunit -t nm -b m68k-amigaos-nm -s _ *_test.o >aceunit.c
    scans all object files matching the pattern *_test.o using nm with m68k-amigaos-nm as the binary, stripping leading _ from the symbol names, and write the found fixtures to aceunit.c.

aceunit -t readelf a.o b.o c.o >aceunit.c
    scans the object files a.o, b.o, and c.o and write the found fixtures to aceunit.c.

USAGE IN MAKEFILES

AceUnit can easily be used in a Makefile.  Here are some hints of how to do that.

  Makefile Example
    ACEUNIT:=aceunit
    .PHONY: all
    all: test
    testcases:=$(patsubst %.c,%.o,$(wildcard *_test.c))
    fixtures.c: $(testcases)
    	$(ACEUNIT) $(ACEUNIT_FLAGS) $^ >$@
    unittest: LOADLIBES+=-laceunit-setjmp
    unittest: $(testcases) $(objects) fixtures.o
    .PHONY: test
    test:
    	./unittest

LIMITATIONS
The aceunit program cannot operate on stdin. This is not really a limitation of AceUnit itself but rather a limitation of the downstream tools nm, objdump, and readelf.

AUTHOR
Written by Christian Hujer.

REPORTING BUGS
AceUnit online help: <https://nelkinda.com/products/aceunit/>

COPYRIGHT
Copyright © 2007, 2024 Christian Hujer License BSD
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
objdump(1), readelf(1), nm(1), abort(3), assert(3), longjmp(3), setjmp(3), fork(2), signal(2), Full documentation: <https://nelkinda.com/products/aceunit/>