Skip to content

Commit

Permalink
Cleanup: remove rest of libio
Browse files Browse the repository at this point in the history
Move the directory iterator test to libsquashfs, move the tree
scanning code to libcommon.

Signed-off-by: David Oberhollenzer <[email protected]>
  • Loading branch information
AgentD committed Oct 24, 2023
1 parent ee26abc commit 9f2d631
Show file tree
Hide file tree
Showing 30 changed files with 48 additions and 52 deletions.
1 change: 0 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ TESTS =
include lib/sqfs/Makemodule.am
include lib/util/Makemodule.am
include lib/xfrm/Makemodule.am
include lib/io/Makemodule.am

include lib/fstree/Makemodule.am
include lib/common/Makemodule.am
Expand Down
12 changes: 6 additions & 6 deletions bin/gensquashfs/Makemodule.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gensquashfs_SOURCES = bin/gensquashfs/src/mkfs.c bin/gensquashfs/src/mkfs.h \
bin/gensquashfs/src/apply_xattr.c bin/gensquashfs/src/filemap_xattr.c\
bin/gensquashfs/src/fstree_from_file.c \
bin/gensquashfs/src/sort_by_file.c bin/gensquashfs/src/glob.c
gensquashfs_LDADD = libcommon.a libsquashfs.la libio.a libfstree.a
gensquashfs_LDADD = libcommon.a libsquashfs.la libfstree.a
gensquashfs_LDADD += libutil.a libcompat.a $(LZO_LIBS) $(PTHREAD_LIBS)
gensquashfs_CPPFLAGS = $(AM_CPPFLAGS)
gensquashfs_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
Expand Down Expand Up @@ -33,7 +33,7 @@ test_fstree_from_file_SOURCES = bin/gensquashfs/test/fstree_from_file.c \
bin/gensquashfs/src/mkfs.h
test_fstree_from_file_CPPFLAGS = $(AM_CPPFLAGS)
test_fstree_from_file_CPPFLAGS += -I$(top_srcdir)/bin/gensquashfs/src
test_fstree_from_file_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \
test_fstree_from_file_LDADD = libsquashfs.la libcommon.a libfstree.a \
libutil.a libcompat.a

test_fstree_from_file2_SOURCES = bin/gensquashfs/test/fstree_from_file2.c \
Expand All @@ -42,7 +42,7 @@ test_fstree_from_file2_SOURCES = bin/gensquashfs/test/fstree_from_file2.c \
bin/gensquashfs/src/mkfs.h
test_fstree_from_file2_CPPFLAGS = $(AM_CPPFLAGS)
test_fstree_from_file2_CPPFLAGS += -I$(top_srcdir)/bin/gensquashfs/src
test_fstree_from_file2_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \
test_fstree_from_file2_LDADD = libsquashfs.la libcommon.a libfstree.a \
libutil.a libcompat.a

test_fstree_glob1_SOURCES = bin/gensquashfs/test/fstree_glob1.c \
Expand All @@ -51,7 +51,7 @@ test_fstree_glob1_SOURCES = bin/gensquashfs/test/fstree_glob1.c \
bin/gensquashfs/src/mkfs.h
test_fstree_glob1_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs/src
test_fstree_glob1_CPPFLAGS += -DTESTPATH=$(GENDATADIR)
test_fstree_glob1_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \
test_fstree_glob1_LDADD = libsquashfs.la libcommon.a libfstree.a \
libutil.a libcompat.a

test_sort_file_SOURCES = bin/gensquashfs/test/sort_file.c \
Expand All @@ -60,15 +60,15 @@ test_sort_file_SOURCES = bin/gensquashfs/test/sort_file.c \
bin/gensquashfs/src/glob.c \
bin/gensquashfs/src/mkfs.h
test_sort_file_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs/src
test_sort_file_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \
test_sort_file_LDADD = libsquashfs.la libcommon.a libfstree.a \
libutil.a libcompat.a

fstree_fuzz_SOURCES = bin/gensquashfs/test/fstree_fuzz.c \
bin/gensquashfs/src/fstree_from_file.c \
bin/gensquashfs/src/glob.c \
bin/gensquashfs/src/mkfs.h
fstree_fuzz_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs/src
fstree_fuzz_LDADD = libsquashfs.la libcommon.a libfstree.a libio.a \
fstree_fuzz_LDADD = libsquashfs.la libcommon.a libfstree.a \
libutil.a libcompat.a

GENSQUASHFS_TESTS = \
Expand Down
2 changes: 1 addition & 1 deletion bin/gensquashfs/src/mkfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "config.h"

#include "common.h"
#include "io/dir_iterator.h"
#include "dir_tree_iterator.h"
#include "util/util.h"
#include "util/parse.h"

Expand Down
2 changes: 1 addition & 1 deletion include/io/dir_iterator.h → include/dir_tree_iterator.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
* dir_iterator.h
* dir_tree_iterator.h
*
* Copyright (C) 2023 David Oberhollenzer <[email protected]>
*/
Expand Down
1 change: 0 additions & 1 deletion include/tar/tar.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include "config.h"
#include "compat.h"
#include "io/dir_iterator.h"
#include "sqfs/io.h"

#include <stdbool.h>
Expand Down
21 changes: 19 additions & 2 deletions lib/common/Makemodule.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ libcommon_a_SOURCES = include/common.h include/simple_writer.h \
lib/common/src/writer/serialize_fstree.c lib/common/src/writer/finish.c\
lib/common/src/fstree_cli.c lib/common/src/perror.c \
lib/common/src/dir_tree.c lib/common/src/read_tree.c \
lib/common/src/stream.c
lib/common/src/stream.c lib/common/src/dir_tree_iterator.c \
include/dir_tree_iterator.h lib/common/src/dir_tree_iterator.c
libcommon_a_CFLAGS = $(AM_CFLAGS) $(LZO_CFLAGS)

if WITH_LZO
Expand All @@ -26,8 +27,24 @@ test_fstree_cli_LDADD = libcommon.a libutil.a libcompat.a
test_get_node_path_SOURCES = lib/common/test/get_node_path.c
test_get_node_path_LDADD = libcommon.a libsquashfs.la libcompat.a

test_dir_tree_iterator_SOURCES = lib/common/test/dir_tree_iterator.c
test_dir_tree_iterator_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a
test_dir_tree_iterator_CPPFLAGS = $(AM_CPPFLAGS)
test_dir_tree_iterator_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/sqfs/test/testdir

test_dir_tree_iterator2_SOURCES = lib/common/test/dir_tree_iterator2.c
test_dir_tree_iterator2_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a
test_dir_tree_iterator2_CPPFLAGS = $(AM_CPPFLAGS)
test_dir_tree_iterator2_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/sqfs/test/testdir

test_dir_tree_iterator3_SOURCES = lib/common/test/dir_tree_iterator3.c
test_dir_tree_iterator3_LDADD = libcommon.a libsquashfs.la libutil.a libcompat.a
test_dir_tree_iterator3_CPPFLAGS = $(AM_CPPFLAGS)
test_dir_tree_iterator3_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/sqfs/test/testdir

LIBCOMMON_TESTS = \
test_istream_mem test_fstree_cli test_get_node_path
test_istream_mem test_fstree_cli test_get_node_path \
test_dir_tree_iterator test_dir_tree_iterator2 test_dir_tree_iterator3

check_PROGRAMS += $(LIBCOMMON_TESTS)
TESTS += $(LIBCOMMON_TESTS)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2023 David Oberhollenzer <[email protected]>
*/
#include "config.h"
#include "io/dir_iterator.h"
#include "dir_tree_iterator.h"
#include "util/util.h"
#include "sqfs/error.h"
#include "sqfs/io.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
*/
#include "config.h"

#include "io/dir_iterator.h"
#include "dir_tree_iterator.h"
#include "sqfs/error.h"
#include "util/test.h"
#include "sqfs/io.h"
#include "compat.h"
#include "common.h"

static int compare_entries(const void *a, const void *b)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
*/
#include "config.h"

#include "io/dir_iterator.h"
#include "dir_tree_iterator.h"
#include "sqfs/error.h"
#include "util/test.h"
#include "sqfs/io.h"
#include "compat.h"
#include "common.h"

static int compare_entries(const void *a, const void *b)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
*/
#include "config.h"

#include "io/dir_iterator.h"
#include "dir_tree_iterator.h"
#include "sqfs/error.h"
#include "util/test.h"
#include "sqfs/io.h"
#include "compat.h"
#include "common.h"

static int compare_entries(const void *a, const void *b)
{
Expand Down
34 changes: 0 additions & 34 deletions lib/io/Makemodule.am

This file was deleted.

9 changes: 8 additions & 1 deletion lib/sqfs/Makemodule.am
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,18 @@ test_rec_dir_LDADD = libsquashfs.la libutil.a libcompat.a
test_hl_dir_SOURCES = lib/sqfs/test/hl_dir.c
test_hl_dir_LDADD = libsquashfs.la libutil.a libcompat.a

test_dir_iterator_SOURCES = lib/sqfs/test/dir_iterator.c
test_dir_iterator_LDADD = libsquashfs.la libutil.a libcompat.a
test_dir_iterator_CPPFLAGS = $(AM_CPPFLAGS)
test_dir_iterator_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/sqfs/test/testdir

LIBSQFS_TESTS = \
test_abi test_xattr test_table test_xattr_writer \
test_istream_read test_istream_skip test_stream_splice test_rec_dir \
test_hl_dir
test_hl_dir test_dir_iterator
noinst_PROGRAMS += xattr_benchmark

check_PROGRAMS += $(LIBSQFS_TESTS)
TESTS += $(LIBSQFS_TESTS)

EXTRA_DIST += $(top_srcdir)/lib/sqfs/test/testdir
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
#include "config.h"

#include "io/dir_iterator.h"
#include "sqfs/dir_entry.h"
#include "sqfs/error.h"
#include "util/test.h"
#include "sqfs/io.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions lib/tar/src/iterator.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "util/util.h"
#include "xfrm/wrap.h"
#include "compat.h"
#include "sqfs/dir_entry.h"

#include <stdlib.h>
#include <string.h>
Expand Down
1 change: 1 addition & 0 deletions lib/tar/test/tar_iterator.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "util/test.h"
#include "sqfs/error.h"
#include "sqfs/io.h"
#include "sqfs/dir_entry.h"

#ifndef TESTUID
#define TESTUID 1000
Expand Down
1 change: 1 addition & 0 deletions lib/tar/test/tar_iterator2.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "tar/tar.h"
#include "util/test.h"
#include "sqfs/io.h"
#include "sqfs/dir_entry.h"

static const struct {
uint64_t offset;
Expand Down
1 change: 1 addition & 0 deletions lib/tar/test/tar_iterator3.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "util/test.h"
#include "sqfs/error.h"
#include "sqfs/io.h"
#include "sqfs/dir_entry.h"

int main(int argc, char **argv)
{
Expand Down
1 change: 1 addition & 0 deletions lib/tar/test/tar_write_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "sqfs/io.h"
#include "util/test.h"
#include "sqfs/xattr.h"
#include "sqfs/dir_entry.h"
#include "compat.h"

static void hex_dump(const sqfs_u8 *data, size_t size)
Expand Down

0 comments on commit 9f2d631

Please sign in to comment.