Skip to content

Commit

Permalink
Merge branch 'master' into assertmsg
Browse files Browse the repository at this point in the history
  • Loading branch information
brarcher authored Jun 28, 2020
2 parents 7ac1fcb + f1626d5 commit c992bcb
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 11 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,44 @@ jobs:
- name: make install
run: sudo make install

build_linux_autotools_gcc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: create configure
run: autoreconf -i
- name: configure gcc
run: ./configure CC=gcc --enable-snprintf-replacement --enable-timer-replacement --disable-build-docs --disable-timeout-tests
- name: make
run: make
- name: make check
run: make check

build_linux_autotools_clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: create configure
run: autoreconf -i
- name: configure clang
run: ./configure CC=clang --enable-snprintf-replacement --enable-timer-replacement --disable-build-docs --disable-timeout-tests
- name: make
run: make

build_linux_autotools_crosscompile_mingw32:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install doc packages
run: sudo apt-get install -y gcc-mingw-w64
- name: create configure
run: autoreconf -i
- name: configure clang
run: ./configure --disable-build-docs --host=x86_64-w64-mingw32 --disable-static --disable-subunit
- name: make
run: make


build_linux_autotools_prereleasecheck:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion doc/check.texi
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ entitled ``@acronym{GNU} Free Documentation License.''

@dircategory Software development
@direntry
* Check: (check)Introduction.
* Check: (check). A unit testing framework for C.
@end direntry

@titlepage
Expand Down
6 changes: 3 additions & 3 deletions src/check.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ do { \
#define _ck_assert_ptr(X, OP, Y) do { \
const void* _ck_x = (X); \
const void* _ck_y = (Y); \
ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: %s == %#x, %s == %#x", #X" "#OP" "#Y, #X, _ck_x, #Y, _ck_y); \
ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: %s == %#lx, %s == %#lx", #X" "#OP" "#Y, #X, (unsigned long)_ck_x, #Y, (unsigned long)_ck_y); \
} while (0)

/* Pointer against NULL comparison macros with improved output
Expand All @@ -1734,9 +1734,9 @@ do { \
#define _ck_assert_ptr_null(X, OP) do { \
const void* _ck_x = (X); \
ck_assert_msg(_ck_x OP NULL, \
"Assertion '%s' failed: %s == %#x", \
"Assertion '%s' failed: %s == %#lx", \
#X" "#OP" NULL", \
#X, _ck_x); \
#X, (unsigned long)_ck_x); \
} while (0)

/**
Expand Down
4 changes: 2 additions & 2 deletions src/check_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void *emalloc(size_t n)

p = malloc(n);
if(p == NULL)
eprintf("malloc of %u bytes failed:", __FILE__, __LINE__ - 2, n);
eprintf("malloc of %zu bytes failed:", __FILE__, __LINE__ - 2, n);
return p;
}

Expand All @@ -71,6 +71,6 @@ void *erealloc(void *ptr, size_t n)

p = realloc(ptr, n);
if(p == NULL)
eprintf("realloc of %u bytes failed:", __FILE__, __LINE__ - 2, n);
eprintf("realloc of %zu bytes failed:", __FILE__, __LINE__ - 2, n);
return p;
}
6 changes: 3 additions & 3 deletions src/check_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int pack(enum ck_msg_type type, char **buf, CheckMsg * msg)

len = pftab[type] (buf, msg);
if(len > (size_t) INT_MAX)
eprintf("Value of len (%d) too big, max allowed %u\n",
eprintf("Value of len (%zu) too big, max allowed %u\n",
__FILE__, __LINE__ - 3, len, INT_MAX);
return (int) len;
}
Expand All @@ -159,10 +159,10 @@ int upack(char *buf, CheckMsg * msg, enum ck_msg_type *type)

diff = buf - obuf;
if(diff > (ptrdiff_t) INT_MAX)
eprintf("Value of diff (%t) too big, max allowed %u\n",
eprintf("Value of diff (%td) too big, max allowed %d\n",
__FILE__, __LINE__ - 3, diff, INT_MAX);
if(diff > (ptrdiff_t) INT_MAX || diff < (ptrdiff_t) INT_MIN)
eprintf("Value of diff (%t) too small, min allowed %u\n",
eprintf("Value of diff (%td) too small, min allowed %d\n",
__FILE__, __LINE__ - 6, diff, INT_MIN);
return (int) diff;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/check_check_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,15 @@ START_TEST(test_check_failure_lnos)
}

if (line_no > 0 && tr_lno(tr) != line_no) {
ck_abort_msg("For test %d (failure %d): Expected lno %d, got %d for suite %s, msg %s",
ck_abort_msg("For test %d (failure %d): Expected lno %ld, got %d for suite %s, msg %s",
i, number_failed, line_no, tr_lno(tr), tr_tcname(tr), tr_msg(tr));
}
}

/* At this point, there should be no remaining failures */
line_no = get_next_failure_line_num(line_num_failures);
ck_assert_msg(line_no == -1,
"No more failure line numbers expected, but found %d", line_no);
"No more failure line numbers expected, but found %ld", line_no);
}
END_TEST

Expand Down

0 comments on commit c992bcb

Please sign in to comment.