]> git.proxmox.com Git - mirror_edk2.git/commit - AppPkg/AppPkg.dsc
AppPkg: introduce OrderedCollectionTest
authorLaszlo Ersek <lersek@redhat.com>
Tue, 12 Aug 2014 07:29:17 +0000 (07:29 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 12 Aug 2014 07:29:17 +0000 (07:29 +0000)
commit424d84556d4dfe3b05af00c06fd5d3480dccb111
tree17de7ed9d7b789b4c641e6ecdcf2e350561ccb26
parentcf556c6a587462cf916272597b34b9951279e7b6
AppPkg: introduce OrderedCollectionTest

In this patch a small application is added to AppPkg, with the following
two goals:
- demonstrate how to use OrderedCollectionLib,
- allow users to test and "fuzz" BaseOrderedCollectionRedBlackTreeLib in
  particular, entering API "commands" interactively, or providing them
  from a script file.

A shell script is included that generates such an API command script.

Speaking about BaseOrderedCollectionRedBlackTreeLib specifically,
OrderedCollectionTest validates the internal red-black properties of the
tree after each read-write operation by setting the
PcdValidateOrderedCollection feature flag to TRUE.

The OrderedCollectionTest application's debugging environment is strictly
specified in the DSC file, because OrderedCollectionTest is entirely
useless for unit testing without full ASSERT() enablement.

The OrderedCollectionTest application deliberately doesn't follow the edk2
coding style in the following:
- const vs. CONST,
- void vs. VOID,
- assert() vs. ASSERT(),
- calloc() and free() vs. AllocateZeroPool() and FreePool(),
- integer types.

This is because OrderedCollectionTest is a standard C application, not a
UEFI application per se. In particular it relies on stdio. INTN, EFIAPI
and CONST VOID are used only in two places, where we provide the
comparator callbacks to OrderedCollectionLib. Proper range checking is
ensured for integers.

The application takes command input from stdin or a file (if the user
requests it), sends command output to stdout or a file (if the user
requests it), prints debug output to the console (as other AppPkg
applications do when debugging is enabled for them), and prints
diagnostics to stderr (like well behaved standard C programs should).

Input/output selection is implemented manually because the old shell
doesn't support input redirection at all, and because the new shell's
input redirection does not co-operate with fgets() for the time being.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15792 6f19259b-4bc3-4df7-8a09-765794883524
AppPkg/AppPkg.dsc
AppPkg/Applications/OrderedCollectionTest/OrderedCollectionTest.c [new file with mode: 0644]
AppPkg/Applications/OrderedCollectionTest/OrderedCollectionTest.inf [new file with mode: 0644]
AppPkg/Applications/OrderedCollectionTest/gentest.sh [new file with mode: 0644]
AppPkg/ReadMe.txt