diff options
author | Andrew Morrow <acm@mongodb.com> | 2017-03-14 20:41:35 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2017-03-22 11:16:36 -0400 |
commit | b38e0199d04a6b4516566be71c819e612801c365 (patch) | |
tree | 722ec33edc8b51e0439fce3ccd91efa01356937b /src | |
parent | dd260b0a3bde58530504e982b8f4acd753f71739 (diff) | |
download | mongo-b38e0199d04a6b4516566be71c819e612801c365.tar.gz |
SERVER-19677 Add support for running the intel decimal library test
Diffstat (limited to 'src')
4 files changed, 65 insertions, 2 deletions
diff --git a/src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_strtod.h b/src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_strtod.h index 58b6ecd6509..c09d5450d40 100755 --- a/src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_strtod.h +++ b/src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_strtod.h @@ -198,11 +198,12 @@ int i,k; }
*ps = L'\0';
- ps0_c = malloc(k*sizeof(char));
+ ps0_c = malloc(k*sizeof(char) + 1);
if(!ps0_c)
{ free(ps0); return NULL;}
- for(i=0; i<=k; i++)
+ for(i=0; i<k; i++)
ps0_c[i] = (ps0[i] - L'0') + '0';
+ ps0_c[k] = '\0';
free(ps0);
return ps0_c;
diff --git a/src/third_party/IntelRDFPMathLib20U1/SConscript b/src/third_party/IntelRDFPMathLib20U1/SConscript index 61b3d8f92c6..c2c60cdb93c 100644 --- a/src/third_party/IntelRDFPMathLib20U1/SConscript +++ b/src/third_party/IntelRDFPMathLib20U1/SConscript @@ -1,5 +1,7 @@ # -*- mode: python -*- +import sys + Import("env") Import("has_option") Import("debugBuild") @@ -339,3 +341,42 @@ env.Library( source=source_files, LIBS=libs, ) + +readtest = env.Program( + target='intel_decimal128_readtest', + source=[ + 'TESTS/readtest.c', + ], + LIBDEPS=[ + 'intel_decimal128', + ], + LIBS=libs, +) + +readtest_input = env.Install( + '.', + source=['TESTS/readtest.in'], +) + +readtest_dict = { + '@readtest_python_interpreter@' : sys.executable, + '@readtest_program@' : readtest[0].name, + '@readtest_input@' : readtest_input[0].name, +} + +readtest_wrapper = env.Substfile( + 'intel_decimal128_readtest_wrapper.py.in', + SUBST_DICT=readtest_dict, +) +env.Depends(readtest_wrapper, [readtest, readtest_input]) + +if env.TargetOSIs('windows'): + readtest_wrapper_bat = env.Substfile( + 'intel_decimal128_readtest_wrapper.bat.in', + SUBST_DICT=readtest_dict, + ) + env.Depends(readtest_wrapper_bat, readtest_wrapper) + env.RegisterUnitTest(readtest_wrapper_bat[0]) +else: + env.AddPostAction(readtest_wrapper[0], Chmod(readtest_wrapper[0], 'oug+x')) + env.RegisterUnitTest(readtest_wrapper[0]) diff --git a/src/third_party/IntelRDFPMathLib20U1/intel_decimal128_readtest_wrapper.bat.in b/src/third_party/IntelRDFPMathLib20U1/intel_decimal128_readtest_wrapper.bat.in new file mode 100644 index 00000000000..adaa206cc5e --- /dev/null +++ b/src/third_party/IntelRDFPMathLib20U1/intel_decimal128_readtest_wrapper.bat.in @@ -0,0 +1,2 @@ +@REM Wrapper to invoke correct python interpreter on Windows +@readtest_python_interpreter@ %~dp0\intel_decimal128_readtest_wrapper.py diff --git a/src/third_party/IntelRDFPMathLib20U1/intel_decimal128_readtest_wrapper.py.in b/src/third_party/IntelRDFPMathLib20U1/intel_decimal128_readtest_wrapper.py.in new file mode 100755 index 00000000000..24585cdd150 --- /dev/null +++ b/src/third_party/IntelRDFPMathLib20U1/intel_decimal128_readtest_wrapper.py.in @@ -0,0 +1,19 @@ +#!@readtest_python_interpreter@ +""" +Wrapper python script to launch the readtest_program program as interpolated +by scons with the standard input set to the test file readtest_input, also as +interpolated by scons. +""" + +import os +import subprocess + +rp = os.path.realpath(__file__) +dn = os.path.dirname(rp) + +readtest_program = os.path.join(dn, '@readtest_program@') +readtest_input = os.path.join(dn, '@readtest_input@') + +with open(readtest_input, 'r') as readtest_input_stream: + result = subprocess.call([readtest_program], stdin=readtest_input_stream) + exit(result) |