output/outcoff.c: zap timestamp when running tests

When we're running tests we must not fail due to
time stamp difference in a header. Lets zap it if
test run is detected.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov 2020-08-25 19:18:50 +03:00
parent 512c93dc42
commit 523b96dd6f

View file

@ -40,6 +40,7 @@
#include "nctype.h"
#include <time.h>
#include "ver.h"
#include "nasm.h"
#include "nasmlib.h"
@ -935,7 +936,16 @@ static void coff_write(void)
i = IMAGE_FILE_MACHINE_I386;
fwriteint16_t(i, ofile); /* machine type */
fwriteint16_t(coff_nsects, ofile); /* number of sections */
fwriteint32_t(time(NULL), ofile); /* time stamp */
/*
* When running tests we'are comparing binary output
* so time should be zapped.
*/
if (nasm_test_run())
fwriteint32_t(0, ofile); /* time stamp */
else
fwriteint32_t(time(NULL), ofile); /* time stamp */
fwriteint32_t(sympos, ofile);
fwriteint32_t(coff_nsyms + initsym, ofile);
fwriteint16_t(0, ofile); /* no optional header */