Skip to content

Compilation of some test files fails when using -DUSE_NSEC=OFF #7036

@maroneze

Description

@maroneze

I did the following:

$ git clone https://github.com/libgit2/libgit2.git && cd libgit2
$ mkdir build && cd build && cmake .. -DUSE_NSEC=OFF && make -j

Compilation fails due to some test files, which require nanosecond-specific fields, e.g.:

/libgit2/tests/libgit2/index/nsec.c: In function ‘try_create_file_with_nsec_timestamp’:
/libgit2/tests/libgit2/index/nsec.c:38:23: error: ‘struct stat’ has no member named ‘st_ctime_nsec’
   38 |                 if (st.st_ctime_nsec && st.st_mtime_nsec)
      |                       ^
/libgit2/tests/libgit2/index/nsec.c:38:43: error: ‘struct stat’ has no member named ‘st_mtime_nsec’
   38 |                 if (st.st_ctime_nsec && st.st_mtime_nsec)
      |                                           ^

I can add -DBUILD_TESTS=OFF to also disable tests and the build succeeds. But if I could have some tests be built, that'd be nice.

Anyway, this is a minor issue and there is a workaround, so please feel free to close it if you wish.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions