Qinghui Xu created THRIFT-4976:
----------------------------------

             Summary: Docker build: Test failure for `StalenessCheckTest` on 
MacOS
                 Key: THRIFT-4976
                 URL: https://issues.apache.org/jira/browse/THRIFT-4976
             Project: Thrift
          Issue Type: Bug
          Components: Build Process
            Reporter: Qinghui Xu


`StalenessCheckTest` consists of three python tests, each of which verify 
whether a thrift file is recompiled after some modification. The test scheme is 
such as:
 * Compile some thrift files
 * Get the modification timestamp of generated files.
 * Make modification to the thrift files
 * Sleep for 0.1 second, and then recompile
 * Get the modification timestamp of (re)generated files
 * Assert that the second timestamp is bigger than the first

When running a docker build (with ubuntu-bionic) on MacOS, the assertion fails 
randomly, because the underlying file system's timestamp is only 
second-accurate. So the 0.1 second is not enough to make sure that the second 
timestamp is bigger than the first (both could end up to be round to the same 
second).

Example:
{code:java}
export  SCRIPT="cmake.sh"
export  BUILD_ARG="-D WITH_C_GLIB=OFF -D WITH_AS3=OFF -D WITH_PYTHON=OFF -D 
WITH_HASKELL=OFF"
export  BUILD_ENV="-e CC=gcc -e CXX=g++ -e THRIFT_CROSSTEST_CONCURRENCY=3"
export  DISTRO=ubuntu-bionic
export  BUILD_LIBS="CPP JAVA"  # only meaningful for CMake builds
export  DOCKER_REPO="thrift/thrift-build"

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DOCKER_TAG=$DOCKER_REPO:$DISTRO

docker run --net=host -e BUILD_LIBS="$BUILD_LIBS" $BUILD_ENV -v 
$(pwd):/thrift/src \
        -it $DOCKER_TAG build/docker/scripts/cmake.sh $BUILD_ARG

...

test 435
        Start 435: StalenessCheckTest435: Test command: /usr/bin/python 
"/thrift/src/compiler/cpp/test/compiler/staleness_check.py" 
"/thrift/src/cmake_build/compiler/cpp/bin/thrift"
435: Test timeout computed to be: 1500
435: test_staleness_check_of_included_file (__main__.TestStalenessCheck) ... 
FAIL
435: test_staleness_check_of_single_thrift_file_with_changed_output 
(__main__.TestStalenessCheck) ... ok
435: test_staleness_check_of_single_thrift_file_without_changed_output 
(__main__.TestStalenessCheck) ... ok
435:
435: ======================================================================
435: FAIL: test_staleness_check_of_included_file (__main__.TestStalenessCheck)
435: ----------------------------------------------------------------------
435: Traceback (most recent call last):
435:   File "/thrift/src/compiler/cpp/test/compiler/staleness_check.py", line 
123, in test_staleness_check_of_included_file
435:     included_constants_cpp_second_modification_time, 
included_constants_cpp_first_modification_time)
435: AssertionError: 1570986553.0 not greater than 1570986553.0
435:
435: ----------------------------------------------------------------------
435: Ran 3 tests in 0.727s
435:
435: FAILED (failures=1)
435/464 Test #435: StalenessCheckTest ...............***Failed    0.85 sec

...

99% tests passed, 1 tests failed out of 46499% tests passed, 1 tests failed out 
of 464
Total Test time (real) = 344.50 sec
The following tests FAILED: 435 - StalenessCheckTest (Failed)Errors while 
running CTest{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to