vendor/bc: update to upstream version 5.0.2

This commit is contained in:
Stefan Eßer 2021-09-19 14:41:20 +02:00
parent 2f57ecae4b
commit a60ef1802a
15 changed files with 73 additions and 49 deletions

30
NEWS.md
View file

@ -1,5 +1,35 @@
# News
## 5.0.2
This is a production release with one fix for a flaky test. If you have not
experienced problems with the test suite, you do ***NOT*** need to upgrade.
The test was one that tested whether `bc` fails gracefully when it can't
allocate memory. Unfortunately, there are cases when Linux and FreeBSD lie and
pretend to allocate the memory.
The reason they do this is because a lot of programs don't use all of the memory
they allocate, so those OS's usually get away with it.
However, this `bc` uses all of the memory it allocates (at least at page
granularity), so when it tries to use the memory, FreeBSD and Linux kill it.
This only happens sometimes, however. Other times (on my machine), they do, in
fact, refuse the request.
So I changed the test to not test for that because I think the graceful failure
code won't really change much.
## 5.0.1
This is a production release with two fixes:
* Fix for the build on Mac OSX.
* Fix for the build on Android.
Users that do not use those platforms do ***NOT*** need to update.
## 5.0.0
This is a major production release with several changes:

View file

@ -53,6 +53,10 @@
#define DC_ENABLED (1)
#endif // DC_ENABLED
#ifndef BC_ENABLE_LIBRARY
#define BC_ENABLE_LIBRARY (0)
#endif // BC_ENABLE_LIBRARY
// This is error checking for fuzz builds.
#if BC_ENABLE_AFL
#ifndef __AFL_HAVE_MANUAL_CONTROL

View file

@ -441,7 +441,7 @@ void bc_slabvec_print(BcVec *v, const char *func);
* contain @a s.
* @param s The source string.
*/
#define strcpy(d, l, s) strcpy(d, s)
#define bc_strcpy(d, l, s) strcpy(d, s)
#else // _WIN32
@ -452,7 +452,7 @@ void bc_slabvec_print(BcVec *v, const char *func);
* contain @a s.
* @param s The source string.
*/
#define strcpy(d, l, s) strcpy_s(d, l, s)
#define bc_strcpy(d, l, s) strcpy_s(d, l, s)
#endif // _WIN32

View file

@ -37,6 +37,6 @@
#define BC_VERSION_H
/// The current version.
#define VERSION 5.0.0
#define VERSION 5.0.2
#endif // BC_VERSION_H

View file

@ -461,7 +461,7 @@ static char* bc_slab_add(BcSlab *s, const char *str, size_t len) {
ptr = (char*) (s->s + s->len);
strcpy(ptr, len, str);
bc_strcpy(ptr, len, str);
s->len += len;

View file

@ -129,6 +129,9 @@ sh "$testdir/errors.sh" "$d" "$exe" "$@"
# Other tests.
sh "$testdir/other.sh" "$d" "$extra" "$exe" "$@"
# History tests.
sh "$testdir/history.sh" "$d" -a
printf '\nAll %s tests passed.\n' "$d"
printf '\n%s\n' "$stars"

View file

@ -32,6 +32,8 @@
script="$0"
testdir=$(dirname "$script")
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir/..}
# Gets the timeconst script, which could be a command-line argument.
if [ "$#" -gt 0 ]; then
timeconst="$1"
@ -49,8 +51,8 @@ else
fi
#
out1="$testdir/bc_outputs/bc_timeconst.txt"
out2="$testdir/bc_outputs/bc_timeconst_results.txt"
out1="$outputdir/bc_outputs/bc_timeconst.txt"
out2="$outputdir/bc_outputs/bc_timeconst_results.txt"
outdir=$(dirname "$out1")

Binary file not shown.

View file

@ -34,6 +34,8 @@ testdir=$(dirname "$script")
. "$testdir/../scripts/functions.sh"
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
# Command-line processing.
if [ "$#" -eq 0 ]; then
printf 'usage: %s dir [exec args...]\n' "$script"
@ -56,7 +58,7 @@ unset BC_LINE_LENGTH
unset DC_ENV_ARGS
unset DC_LINE_LENGTH
out="$testdir/${d}_outputs/errors_results.txt"
out="$outputdir/${d}_outputs/errors_results.txt"
outdir=$(dirname "$out")
# Make sure the directory exists.
@ -146,33 +148,11 @@ for testfile in $testdir/$d/*errors.txt; do
done
# I need to skip a test here on FreeBSD.
os=$(uname)
# The list of files we need to skip.
skip_files="
33.txt
"
# Test all the files in the errors directory. While the loop above does one test
# for every line, this does one test per file, but it runs the file through
# stdin and as a file on the command-line.
for testfile in $testdir/$d/errors/*.txt; do
# If we are on FreeBSD...
if [ "$os" = "FreeBSD" ] && [ "$d" = "dc" ]; then
b=$(basename "$testfile")
# If the file is one of the skip files...
if [ -z "${skip_files##*$b*}" ]; then
printf 'On FreeBSD; skipping %s...\n' "$testfile"
continue
fi
fi
printf 'Running %s error file %s...' "$d" "$testfile"
printf '%s\n' "$halt" | "$exe" "$@" $opts "$testfile" 2> "$out" > /dev/null

View file

@ -41,6 +41,11 @@
script = sys.argv[0]
testdir = os.path.dirname(script)
if "BC_TEST_OUTPUT_DIR" in os.environ:
outputdir = os.environ["BC_TEST_OUTPUT_DIR"]
else:
outputdir = testdir
prompt = ">>> "
# This array is for escaping characters that are necessary to escape when
@ -67,16 +72,6 @@
]
def spawn(exe, args, env, encoding=None, codec_errors='strict'):
if do_test:
f = open(testdir + "/" + exedir + "_outputs/history_test.txt", "wb")
return pexpect.popen_spawn.PopenSpawn([ exe ] + args, env=env,
encoding=encoding, codec_errors=codec_errors, stderr=f)
else:
return pexpect.spawn(exe, args, env=env, encoding=encoding,
codec_errors=codec_errors)
# Check that the child output the expected line. If history is false, then
# the output should change.
def check_line(child, expected, prompt=">>> ", history=True):

View file

@ -34,6 +34,8 @@ testdir=$(dirname "$script")
. "$testdir/../scripts/functions.sh"
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
# Command-line processing.
if [ "$#" -ge 2 ]; then
@ -135,8 +137,8 @@ if [ "$d" = "bc" ]; then
unset BC_ENV_ARGS
redefine_res="$testdir/bc_outputs/redefine.txt"
redefine_out="$testdir/bc_outputs/redefine_results.txt"
redefine_res="$outputdir/bc_outputs/redefine.txt"
redefine_out="$outputdir/bc_outputs/redefine_results.txt"
outdir=$(dirname "$easter_out")
@ -201,8 +203,8 @@ else
printf 'Running dc Easter script...'
easter_res="$testdir/dc_outputs/easter.txt"
easter_out="$testdir/dc_outputs/easter_results.txt"
easter_res="$outputdir/dc_outputs/easter.txt"
easter_out="$outputdir/dc_outputs/easter_results.txt"
outdir=$(dirname "$easter_out")
@ -222,8 +224,8 @@ else
fi
out1="$testdir/../.log_$d.txt"
out2="$testdir/../.log_${d}_test.txt"
out1="$outputdir/${d}_outputs/${d}_other.txt"
out2="$outputdir/${d}_outputs/${d}_other_test.txt"
printf 'Running %s line length tests...' "$d"

View file

@ -34,6 +34,8 @@ testdir=$(dirname "$script")
. "$testdir/../scripts/functions.sh"
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
# Command-line processing.
if [ "$#" -lt 1 ]; then
printf 'usage: %s dir [exe [args...]]\n' "$0"
@ -58,7 +60,7 @@ name="$testdir/$d/read.txt"
results="$testdir/$d/read_results.txt"
errors="$testdir/$d/read_errors.txt"
out="$testdir/${d}_outputs/read_results.txt"
out="$outputdir/${d}_outputs/read_results.txt"
outdir=$(dirname "$out")
# Make sure the directory exists.

View file

@ -35,6 +35,8 @@ testdir=$(dirname "${script}")
. "$testdir/../scripts/functions.sh"
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
# Command-line processing.
if [ "$#" -lt 2 ]; then
printf 'usage: %s dir script [run_extra_tests] [run_stack_tests] [generate_tests] [time_tests] [exec args...]\n' "$script"
@ -126,7 +128,7 @@ if [ "$run_stack_tests" -eq 0 ]; then
fi
out="$testdir/${d}_outputs/${name}_script_results.txt"
out="$outputdir/${d}_outputs/${name}_script_results.txt"
outdir=$(dirname "$out")
# Make sure the directory exists.

View file

@ -35,6 +35,8 @@ testdir=$(dirname "$script")
. "$testdir/../scripts/functions.sh"
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
# Command-line processing.
if [ "$#" -lt 1 ]; then
printf 'usage: %s dir [exe [args...]]\n' "$0"
@ -55,7 +57,7 @@ else
exe="$testdir/../bin/$d"
fi
out="$testdir/${d}_outputs/stdin_results.txt"
out="$outputdir/${d}_outputs/stdin_results.txt"
outdir=$(dirname "$out")
# Make sure the directory exists.

View file

@ -35,6 +35,8 @@ testdir=$(dirname "$script")
. "$testdir/../scripts/functions.sh"
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
# Command-line processing.
if [ "$#" -lt 2 ]; then
printf 'usage: %s dir test [generate_tests] [time_tests] [exe [args...]]\n' "$0"
@ -74,7 +76,7 @@ else
exe="$testdir/../bin/$d"
fi
out="$testdir/${d}_outputs/${t}_results.txt"
out="$outputdir/${d}_outputs/${t}_results.txt"
outdir=$(dirname "$out")
# Make sure the directory exists.