1 | #!/usr/bin/env kmk_ash
|
---|
2 |
|
---|
3 | #
|
---|
4 | # Copyright (C) 2022 Oracle Corporation
|
---|
5 | #
|
---|
6 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
7 | # available from http://www.alldomusa.eu.org. This file is free software;
|
---|
8 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
9 | # General Public License (GPL) as published by the Free Software
|
---|
10 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
11 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
12 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
13 | #
|
---|
14 |
|
---|
15 | # Get parameters.
|
---|
16 | CP="$1"
|
---|
17 | MV="$2"
|
---|
18 | SED="$3"
|
---|
19 | OUTDIR="$4"
|
---|
20 | SRCDIR="$5"
|
---|
21 | FILE="$6"
|
---|
22 |
|
---|
23 | # Globals.
|
---|
24 | set -e
|
---|
25 | LC_ALL=C
|
---|
26 | export LC_ALL
|
---|
27 | SRCFILE="${SRCDIR}/tstIEMAImplData${FILE}.cpp"
|
---|
28 | OUTFILE="${OUTDIR}/tstIEMAImplData${FILE}.cpp"
|
---|
29 |
|
---|
30 | # Copy the file and deal with empty file.
|
---|
31 | if test -f "${SRCFILE}"; then
|
---|
32 | "${CP}" -f -- "${SRCFILE}" "${OUTFILE}.tmp"
|
---|
33 | else
|
---|
34 | > "${OUTFILE}.tmp"
|
---|
35 | fi
|
---|
36 | if ! test -s "${OUTFILE}.tmp"; then
|
---|
37 | echo '#include "tstIEMAImpl.h"' >> "${OUTFILE}.tmp"
|
---|
38 | fi
|
---|
39 | echo '' >> "${OUTFILE}.tmp"
|
---|
40 |
|
---|
41 | # Stub empty test arrays.
|
---|
42 | "${SED}" -n \
|
---|
43 | -e 's/TSTIEM_DECLARE_TEST_ARRAY[(]'"${FILE}"', *\([^,]*\), *\([^ ][^ ]*\) *[)];/\1\n\2/p' \
|
---|
44 | "${SRCDIR}/tstIEMAImpl.h" \
|
---|
45 | | \
|
---|
46 | while IFS= read -r a_Type && IFS= read -r a_Instr;
|
---|
47 | do
|
---|
48 | if "${SED}" -n -e "/ const g_cTests_${a_Instr} /q1" "${OUTFILE}.tmp"; then
|
---|
49 | echo "TSTIEM_DEFINE_EMPTY_TEST_ARRAY(${a_Type}, ${a_Instr});" >> "${OUTFILE}.tmp"
|
---|
50 | fi
|
---|
51 | done
|
---|
52 |
|
---|
53 | # Put the file in place.
|
---|
54 | "${MV}" -f -- "${OUTFILE}.tmp" "${OUTFILE}"
|
---|
55 |
|
---|