Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #18025

Closed (moved)
(moved)
Open
Created Jan 09, 2016 by weasel (Peter Palfrader)@weasel

test_util_touch_file is racy and *does* fail

Tor's master has a broken test:

https://jenkins.torproject.org/job/tor-debian-master-nightly-binaries/630/ARCHITECTURE=i386,SUITE=wily/console

00:30:38 util/get_avail_disk_space: OK
00:30:38 util/touch_file: 
00:30:38   FAIL ../src/test/test_util.c:4615: assert(st.st_mtime OP_GE now): 1452299437 vs 1452299438
00:30:38   [touch_file FAILED]
00:30:38 util/pwdb: [forking] OK

from test_util.c:

  const time_t now = time(NULL);
  struct stat st;
  write_bytes_to_file(fname, "abc", 3, 1);
  tt_int_op(0, OP_EQ, stat(fname, &st));
  tt_i64_op(st.st_mtime, OP_GE, now);

The test is flawed to begin with, there's no guarantee for how much or little time is between the time() call and the write().

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking