Ensure that the test version of the command line tool is stable for benchmarking (#2076)
Some benchmark suites contain test cases that have nonreproducible behaviour. This is mostly caused by relying on "now" when dealing with dates or timestamps, instead of using a fixed moment. (A notorious example is the crypto-aes.js test case of the sunspider bechmark suite, where the heap memory consumption can vary between 34K-41K heap because of using `(new Date()).getTime()`.) This commit renames the jerry-minimal command line tool to jerry-test (to better reflect its purpose) and adds extra code, which intercepts some calls to libc (`gettimeofday`, `rand`) and pins their results to some fixed values. This makes the tool useless in a general case but ensures stable results when benchmarking -- for which it is mostly used. As a side effect, the commit also changes jerry-libc by making all libc functions weak symbols to allow their override from application code. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -469,7 +469,7 @@ libc_printf_write_u_o_x_X (FILE *stream, /**< stream pointer */
|
||||
*
|
||||
* @return number of characters printed
|
||||
*/
|
||||
int
|
||||
int __attr_weak___
|
||||
vfprintf (FILE *stream, /**< stream pointer */
|
||||
const char *format, /**< format string */
|
||||
va_list args) /**< arguments */
|
||||
@@ -719,7 +719,7 @@ vfprintf (FILE *stream, /**< stream pointer */
|
||||
*
|
||||
* @return number of characters printed
|
||||
*/
|
||||
int
|
||||
int __attr_weak___
|
||||
fprintf (FILE *stream, /**< stream pointer */
|
||||
const char *format, /**< format string */
|
||||
...) /**< parameters' values */
|
||||
@@ -740,7 +740,7 @@ fprintf (FILE *stream, /**< stream pointer */
|
||||
*
|
||||
* @return number of characters printed
|
||||
*/
|
||||
int
|
||||
int __attr_weak___
|
||||
printf (const char *format, /**< format string */
|
||||
...) /**< parameters' values */
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user