In timestampToDate(), std::localtime() is called to convert the timestamp into
a date and time. Since std::localtime() is timezone-aware, we have to force a
specific timezone (UTC) in tests to make them timezone-agnostic. After each
test is run, we set the timezone back to its original value.
At the moment, we (unofficially) support also macOS, so differentiate only
between Windows and UNIX by defining the following two symbolic constants:
* OS_WINDOWS
* OS_UNIX
The new version can be built faster:
Original version:
real 0m11.028s
user 0m10.241s
sys 0m0.782s
Latest version:
real 0m5.178s
user 0m4.753s
sys 0m0.425s
As a related change, this commit adds missing dependencies between the
gtest_main, gmock, and gmock_main libraries. In the original version,
libgmock.a contained libgtest.a and libgmock_main.a contained libgmock.a. Now,
libgmock.a is without libgtest.a and libgmock_main.a is without libgmock.a.
Thus, if one wants to link gmock_main, he or she has to also link gmock and
gtest. This has been reflected in the dependencies.
Based on #21:
The scripts will also fail on Cygwin, due to Cygwin's virtual paths (c:
becomes /cygdrive/c/, and so on), which are not transformed by readlink.
Instead, one needs to use cygpath, to get the real windows path. So I've
added get_realpath to retdec-utils.sh, to check if the scripts are running
on Cygwin, and if they do, to use cygpath -ma (-a = absolute path, and -m =
mixed, i.e., forward slashes rather than backward slashes). Otherwise it
just uses readlink.
Based on #21:
Right now, the scripts used by retdec (e.g. retdec-decompiler.sh) will fail
if they're symlinked, i.e., retdec-decompiler.sh symlinked to
~/bin/retdec-decompiler, because both ${BASH_SOURCE} and $0 will always
point at the symlinked path, rather than the original, so $SCRIPT_DIR would
become invalid.
This is easy enough to fix, by doing dirname "$(readlink -e "$0")", rather
than the pretty ancient style of cding to dirname "$0" (pretty sure this
has been out of date since the inception of Linux itself ...).
Reasons:
- Downloaded archives will have more meaningful names (e.g. capstone.zip
instead of 27c713fe4f6eaf9721785932d850b6291a6073fe.zip).
- This prevents collisions between projects (e.g. both yaracpp and yaramod are
in version 1.0.1 at the moment, so they were both downloaded as v1.0.1.zip).