Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
find $(pwd) -name '.git' -exec bash -c 'git config --global --add safe.directory ${0%/.git}' {} \;
./autogen.sh --enable-embedded-yajl
./configure --enable-embedded-yajl CFLAGS='-Wall -Wextra -Werror'
# Run make check first to catch test failures with accessible logs
make -j $(nproc)
make check || (cat test-suite.log 2>/dev/null; exit 1)
# Now run distcheck for distribution validation
make -j $(nproc) distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-embedded-yajl"
# check that the working dir is clean
git describe --broken --dirty --all | grep -qv dirty
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ src/ocispec/validate

tests/.deps/
tests/.dirstamp
tests/test-[0-9]*
tests/test-[0-9]
tests/test-[0-9][0-9]
tests/*.log
tests/*.trs
test-suite.log
Expand Down
10 changes: 9 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ tests_test_10_LDADD = $(TESTS_LDADD)
tests_test_11_SOURCES = tests/test-11.c
tests_test_11_LDADD = $(TESTS_LDADD)

tests_test_12_SOURCES = tests/test-12.c
tests_test_12_LDADD = $(TESTS_LDADD)

tests_test_13_SOURCES = tests/test-13.c
tests_test_13_LDADD = $(TESTS_LDADD)

src_ocispec_validate_SOURCES = src/ocispec/validate.c
src_ocispec_validate_LDADD = $(TESTS_LDADD)

Expand All @@ -223,7 +229,9 @@ TESTS = tests/test-1 \
tests/test-8 \
tests/test-9 \
tests/test-10 \
tests/test-11
tests/test-11 \
tests/test-12 \
tests/test-13

noinst_PROGRAMS = src/ocispec/validate $(TESTS)

Expand Down
13 changes: 9 additions & 4 deletions src/ocispec/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1164,9 +1164,12 @@ def emit_clone(self, c_file, obj, prefix, indent=1):
# Clone function doesn't use json_ prefix
clone_name = self.map_name.replace('json_', '', 1)
emit(c_file, f'''
ret->{obj.fixname} = clone_{clone_name} (src->{obj.fixname});
if (ret->{obj.fixname} == NULL)
return NULL;
if (src->{obj.fixname} != NULL)
{{
ret->{obj.fixname} = clone_{clone_name} (src->{obj.fixname});
if (ret->{obj.fixname} == NULL)
return NULL;
}}
''', indent=indent)


Expand Down Expand Up @@ -1984,9 +1987,11 @@ def make_clone(obj, c_file, prefix):
{typename} *
clone_{typename} ({typename} *src)
{{
(void) src; /* Silence compiler warning. */
__auto_cleanup(free_{typename}) {typename} *ret = NULL;

if (src == NULL)
return NULL;

ret = calloc (1, sizeof (*ret));
if (ret == NULL)
return NULL;
Expand Down
Loading
Loading