[2/2] make/test: generate .gitignore for tests

Submitted by Dmitry Safonov on June 29, 2016, 2:24 p.m.

Details

Message ID 20160629142439.29808-3-dsafonov@virtuozzo.com
State Rejected
Series "test's Makefile genocide"
Headers show

Commit Message

Dmitry Safonov June 29, 2016, 2:24 p.m.
It's quite boring to add your test to .gitignore and one may forget
to do that boilerplate -- put this labour on computer.
For that I make real targets for tests instead of implicit and
add test's binary name to .gitignore on make stage.
Also added *.pidns to .gitignore -- do not wanna do this as separate
trivial patch.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
---
 test/zdtm/.gitignore          | 263 +-----------------------------------------
 test/zdtm/static/Makefile     |  12 +-
 test/zdtm/transition/Makefile |  10 +-
 3 files changed, 23 insertions(+), 262 deletions(-)

Patch hide | download patch | download mbox

diff --git a/test/zdtm/.gitignore b/test/zdtm/.gitignore
index 85e39a2099e5..920772bc5950 100644
--- a/test/zdtm/.gitignore
+++ b/test/zdtm/.gitignore
@@ -1,266 +1,9 @@ 
 /lib/libzdtmtst.a
-/static/aio01
-/static/apparmor
-/static/arm-neon00
-/static/autofs
-/static/bind-mount
-/static/binfmt_misc
-/static/bridge
-/static/busyloop00
-/static/caps00
-/static/cgroup00
-/static/cgroup01
-/static/cgroup02
-/static/cgroup03
-/static/cgroup04
-/static/cgroupns
-/static/cgroup_stray
-/static/child_opened_proc
-/static/chroot
-/static/chroot-file
-/static/clean_mntns
-/static/cmdlinenv00
-/static/cow00
-/static/cow01
-/static/criu-rtc.pb-c.c
-/static/criu-rtc.pb-c.h
-/static/cwd00
-/static/cwd01
-/static/cwd02
-/static/deleted_dev
-/static/deleted_unix_sock
-/static/different_creds
-/static/dumpable01
-/static/dumpable02
-/static/env00
-/static/eventfs00
-/static/fanotify00
-/static/fdt_shared
-/static/fifo
-/static/fifo-ghost
-/static/fifo-rowo-pair
-/static/fifo_ro
-/static/fifo_wronly
-/static/file_append
-/static/file_attr
-/static/file_fown
-/static/file_locks00
-/static/file_locks01
-/static/file_shared
-/static/fpu00
-/static/fpu01
-/static/futex
-/static/futex-rl
-/static/groups
-/static/grow_map
-/static/grow_map02
-/static/grow_map03
-/static/inotify00
-/static/inotify01
-/static/inotify02
-/static/inotify_irmap
-/static/inotify_system
-/static/inotify_system_nodel
-/static/ipc_namespace
-/static/link10
-/static/loginuid
-/static/maps00
-/static/maps01
-/static/maps02
-/static/maps03
-/static/maps04
-/static/maps05
-/static/maps_file_prot
-/static/mem-touch
-/static/mmx00
-/static/mnt_enablefs
-/static/mnt_ext_auto
-/static/mnt_ext_dev
-/static/mnt_ext_master
-/static/mnt_tracefs
-/static/mnt_ro_bind
-/static/mntns_deleted
-/static/mntns_link_ghost
-/static/mntns_link_remap
-/static/mntns_open
-/static/mntns_overmount
-/static/mntns_rw_ro_rw
-/static/mntns_shared_bind
-/static/mntns_shared_bind02
-/static/mntns_shared_vs_private
-/static/mount_paths
-/static/mountpoints
-/static/mprotect00
-/static/msgque
-/static/mtime_mmap
-/static/netns
-/static/netns-dev
-/static/netns-nf
-/static/overmount_dev
-/static/overmount_fifo
-/static/overmount_file
-/static/overmount_sock
-/static/oom_score_adj
-/static/packet_sock
-/static/pdeath_sig
-/static/pid00
-/static/pipe00
-/static/pipe01
-/static/pipe02
-/static/poll
-/static/posix_timers
-/static/proc-self
-/static/pstree
-/static/pthread00
-/static/pthread01
-/static/pthread02
-/static/ptrace_sig
-/static/pty00
-/static/pty01
-/static/pty02
-/static/pty03
-/static/pty04
-/static/remap_dead_pid
-/static/remap_dead_pid_root
-/static/rlimits00
-/static/rmdir_open
-/static/rtc
-/static/sched_policy00
-/static/sched_prio00
-/static/seccomp_filter
-/static/seccomp_filter_tsync
-/static/seccomp_filter_inheritance
-/static/seccomp_strict
-/static/selfexe00
-/static/sem
-/static/session00
-/static/session01
-/static/session02
-/static/session03
-/static/shm
-/static/shm-unaligned
-/static/shm-mp
-/static/sigaltstack
-/static/signalfd00
-/static/sigpending
-/static/sk-netlink
-/static/sk-unix-rel
-/static/sk-unix-unconn
-/static/sleeping00
-/static/sock_filter
-/static/sock_opts00
-/static/sock_opts01
-/static/socket-closed-tcp
-/static/socket-ext
-/static/socket-tcp
-/static/socket-tcp-nfconntrack
-/static/socket-tcp6
-/static/socket-tcpbuf
-/static/socket-tcpbuf-local
-/static/socket-tcpbuf6
-/static/socket6_udp
-/static/socket_aio
-/static/socket_close_data
-/static/socket_close_data01
-/static/socket_dgram_data
-/static/socket_listen
-/static/socket_listen6
-/static/socket_queues
-/static/socket_snd_addr
-/static/socket_udp
-/static/socket_udplite
-/static/sockets00
-/static/sockets01
-/static/sockets02
-/static/sockets_dgram
-/static/sockets_spair
-/static/sse00
-/static/sse20
-/static/stopped
-/static/tempfs
-/static/tempfs_ro
-/static/tempfs_overmounted
-/static/tempfs_overmounted01
-/static/timerfd
-/static/timers
-/static/tty00
-/static/tty02
-/static/tty03
-/static/tun
-/static/umask00
-/static/unbound_sock
-/static/unhashed_proc
-/static/unlink_fifo
-/static/unlink_fifo_wronly
-/static/unlink_fstat00
-/static/unlink_fstat01
-/static/unlink_fstat01+
-/static/unlink_fstat02
-/static/unlink_fstat03
-/static/unlink_fstat04
-/static/unlink_largefile
-/static/unlink_mmap00
-/static/unlink_mmap01
-/static/unlink_mmap02
-/static/unlink_regular00
-/static/uptime_grow
-/static/utsname
-/static/vfork00
-/static/vdso00
-/static/vdso01
-/static/wait00
-/static/write_read00
-/static/write_read01
-/static/write_read02
-/static/write_read10
-/static/xids00
-/static/zombie00
-/static/ip.dump
-/static/ip.rst
-/static/vsx
-/static/vt
-/static/aio00
-/static/packet_sock_mmap
-/static/console
-/static/fd
-/static/file_locks02
-/static/file_locks03
-/static/file_locks04
-/static/file_locks05
-/static/mlock_setuid
-/static/mntns_root_bind
-/static/mntns_root_bind02
-/static/mntns-deleted-dst
-/static/socket-tcp-local
-/static/socket-tcp6-local
-/static/socket-tcpbuf6-local
-/static/sk-freebind
-/static/sk-freebind-false
-/static/stopped01
-/static/stopped02
-/static/stopped03
-/static/stopped12
-/static/tempfs_subns
-/transition/fifo_dyn
-/transition/fifo_loop
-/transition/file_aio
-/transition/netlink00
-/transition/pipe_loop00
-/transition/pipe_shared00
-/transition/socket-tcp
-/transition/socket-tcp6
-/transition/socket_loop00
-/transition/unix_sock
-/transition/epoll
-/transition/file_read
-/transition/fork
-/transition/fork2
-/transition/ipc
-/transition/maps007
-/transition/ptrace
-/transition/thread-bomb
+/static/.gitignore
+/transition/.gitignore
 
 *.pid
+*.pidns
 *.out
 *.outns
 *.out.external
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index a18435b98a7f..85e746abf4e9 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -2,6 +2,7 @@  include ../Makefile.inc
 
 LIBDIR	= ../lib
 LIB	= $(LIBDIR)/libzdtmtst.a
+LDLIBS	+= $(LIBDIR)/libzdtmtst.a
 override CPPFLAGS += -I$(LIBDIR)
 CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
 CFLAGS	+= $(USERCFLAGS)
@@ -274,6 +275,10 @@  OUT	= $(TST:%=%.out)
 STATE	= $(TST_STATE:%=%.state)
 STATE_OUT	= $(TST_STATE:%=%.out)
 
+%: %.c
+	$(Q)echo $@ >> .gitignore
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LOADLIBES) $^ $(LDLIBS) -o $@
+
 all:	$(TST) criu-rtc.so
 install: all
 .PHONY: all install
@@ -398,7 +403,10 @@  stopped12:	override CFLAGS += -DZDTM_STOPPED_KILL -DZDTM_STOPPED_TKILL
 $(LIB):	force
 	$(Q) $(MAKE) -C $(LIBDIR)
 
-clean:
+gitignore-clean:
+	$(RM) -f .gitignore
+
+clean:	gitignore-clean
 	$(RM) -f $(OBJ) $(TST) *~ criu-rtc.so criu-rtc.pb-c.c criu-rtc.pb-c.h get_smaps_bits.o
 
 cleandep:	clean
@@ -415,6 +423,8 @@  realclean:	cleandep cleanout
 rtc.c: criu-rtc.so
 
 criu-rtc.pb-c.c: criu-rtc.proto
+	$(Q)echo $@ >> .gitignore
+	$(Q)echo $(@:%.c=%.h) >> .gitignore
 	protoc-c --proto_path=. --c_out=. criu-rtc.proto
 
 criu-rtc.so: criu-rtc.c criu-rtc.pb-c.c
diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile
index a8dbc4d6352d..99ed19da6ad5 100644
--- a/test/zdtm/transition/Makefile
+++ b/test/zdtm/transition/Makefile
@@ -2,6 +2,7 @@  include ../Makefile.inc
 
 LIBDIR	= ../lib
 LIB	= $(LIBDIR)/libzdtmtst.a
+LDLIBS	+= $(LIBDIR)/libzdtmtst.a
 override CPPFLAGS += -I$(LIBDIR)
 CFLAGS	= -g -O2 -Wall -Werror -fno-strict-aliasing
 CFLAGS	+= $(USERCFLAGS)
@@ -37,6 +38,10 @@  DEP	= $(SRC:%.c=%.d)
 PID	= $(TST:%=%.pid)
 OUT	= $(TST:%=%.out)
 
+%: %.c
+	$(Q)echo $@ >> .gitignore
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LOADLIBES) $^ $(LDLIBS) -o $@
+
 all:	$(TST)
 install: all
 .PHONY: all install
@@ -85,7 +90,10 @@  thread-bomb:	override LDFLAGS += -pthread
 $(LIB):	force
 	$(Q) $(MAKE) -C $(LIBDIR)
 
-clean:
+gitignore-clean:
+	$(RM) -f .gitignore
+
+clean:	gitignore-clean
 	$(RM) -f $(OBJ) $(TST) *~
 
 cleandep:	clean

Comments

Tycho Andersen June 29, 2016, 2:29 p.m.
On Wed, Jun 29, 2016 at 05:24:39PM +0300, Dmitry Safonov wrote:
> It's quite boring to add your test to .gitignore and one may forget
> to do that boilerplate -- put this labour on computer.
> For that I make real targets for tests instead of implicit and
> add test's binary name to .gitignore on make stage.
> Also added *.pidns to .gitignore -- do not wanna do this as separate
> trivial patch.
> 
> Cc: Cyrill Gorcunov <gorcunov@openvz.org>

\o/ thanks :)

Acked-by: Tycho Andersen <tycho.andersen@canonical.com>

> Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
> ---
>  test/zdtm/.gitignore          | 263 +-----------------------------------------
>  test/zdtm/static/Makefile     |  12 +-
>  test/zdtm/transition/Makefile |  10 +-
>  3 files changed, 23 insertions(+), 262 deletions(-)
> 
> diff --git a/test/zdtm/.gitignore b/test/zdtm/.gitignore
> index 85e39a2099e5..920772bc5950 100644
> --- a/test/zdtm/.gitignore
> +++ b/test/zdtm/.gitignore
> @@ -1,266 +1,9 @@
>  /lib/libzdtmtst.a
> -/static/aio01
> -/static/apparmor
> -/static/arm-neon00
> -/static/autofs
> -/static/bind-mount
> -/static/binfmt_misc
> -/static/bridge
> -/static/busyloop00
> -/static/caps00
> -/static/cgroup00
> -/static/cgroup01
> -/static/cgroup02
> -/static/cgroup03
> -/static/cgroup04
> -/static/cgroupns
> -/static/cgroup_stray
> -/static/child_opened_proc
> -/static/chroot
> -/static/chroot-file
> -/static/clean_mntns
> -/static/cmdlinenv00
> -/static/cow00
> -/static/cow01
> -/static/criu-rtc.pb-c.c
> -/static/criu-rtc.pb-c.h
> -/static/cwd00
> -/static/cwd01
> -/static/cwd02
> -/static/deleted_dev
> -/static/deleted_unix_sock
> -/static/different_creds
> -/static/dumpable01
> -/static/dumpable02
> -/static/env00
> -/static/eventfs00
> -/static/fanotify00
> -/static/fdt_shared
> -/static/fifo
> -/static/fifo-ghost
> -/static/fifo-rowo-pair
> -/static/fifo_ro
> -/static/fifo_wronly
> -/static/file_append
> -/static/file_attr
> -/static/file_fown
> -/static/file_locks00
> -/static/file_locks01
> -/static/file_shared
> -/static/fpu00
> -/static/fpu01
> -/static/futex
> -/static/futex-rl
> -/static/groups
> -/static/grow_map
> -/static/grow_map02
> -/static/grow_map03
> -/static/inotify00
> -/static/inotify01
> -/static/inotify02
> -/static/inotify_irmap
> -/static/inotify_system
> -/static/inotify_system_nodel
> -/static/ipc_namespace
> -/static/link10
> -/static/loginuid
> -/static/maps00
> -/static/maps01
> -/static/maps02
> -/static/maps03
> -/static/maps04
> -/static/maps05
> -/static/maps_file_prot
> -/static/mem-touch
> -/static/mmx00
> -/static/mnt_enablefs
> -/static/mnt_ext_auto
> -/static/mnt_ext_dev
> -/static/mnt_ext_master
> -/static/mnt_tracefs
> -/static/mnt_ro_bind
> -/static/mntns_deleted
> -/static/mntns_link_ghost
> -/static/mntns_link_remap
> -/static/mntns_open
> -/static/mntns_overmount
> -/static/mntns_rw_ro_rw
> -/static/mntns_shared_bind
> -/static/mntns_shared_bind02
> -/static/mntns_shared_vs_private
> -/static/mount_paths
> -/static/mountpoints
> -/static/mprotect00
> -/static/msgque
> -/static/mtime_mmap
> -/static/netns
> -/static/netns-dev
> -/static/netns-nf
> -/static/overmount_dev
> -/static/overmount_fifo
> -/static/overmount_file
> -/static/overmount_sock
> -/static/oom_score_adj
> -/static/packet_sock
> -/static/pdeath_sig
> -/static/pid00
> -/static/pipe00
> -/static/pipe01
> -/static/pipe02
> -/static/poll
> -/static/posix_timers
> -/static/proc-self
> -/static/pstree
> -/static/pthread00
> -/static/pthread01
> -/static/pthread02
> -/static/ptrace_sig
> -/static/pty00
> -/static/pty01
> -/static/pty02
> -/static/pty03
> -/static/pty04
> -/static/remap_dead_pid
> -/static/remap_dead_pid_root
> -/static/rlimits00
> -/static/rmdir_open
> -/static/rtc
> -/static/sched_policy00
> -/static/sched_prio00
> -/static/seccomp_filter
> -/static/seccomp_filter_tsync
> -/static/seccomp_filter_inheritance
> -/static/seccomp_strict
> -/static/selfexe00
> -/static/sem
> -/static/session00
> -/static/session01
> -/static/session02
> -/static/session03
> -/static/shm
> -/static/shm-unaligned
> -/static/shm-mp
> -/static/sigaltstack
> -/static/signalfd00
> -/static/sigpending
> -/static/sk-netlink
> -/static/sk-unix-rel
> -/static/sk-unix-unconn
> -/static/sleeping00
> -/static/sock_filter
> -/static/sock_opts00
> -/static/sock_opts01
> -/static/socket-closed-tcp
> -/static/socket-ext
> -/static/socket-tcp
> -/static/socket-tcp-nfconntrack
> -/static/socket-tcp6
> -/static/socket-tcpbuf
> -/static/socket-tcpbuf-local
> -/static/socket-tcpbuf6
> -/static/socket6_udp
> -/static/socket_aio
> -/static/socket_close_data
> -/static/socket_close_data01
> -/static/socket_dgram_data
> -/static/socket_listen
> -/static/socket_listen6
> -/static/socket_queues
> -/static/socket_snd_addr
> -/static/socket_udp
> -/static/socket_udplite
> -/static/sockets00
> -/static/sockets01
> -/static/sockets02
> -/static/sockets_dgram
> -/static/sockets_spair
> -/static/sse00
> -/static/sse20
> -/static/stopped
> -/static/tempfs
> -/static/tempfs_ro
> -/static/tempfs_overmounted
> -/static/tempfs_overmounted01
> -/static/timerfd
> -/static/timers
> -/static/tty00
> -/static/tty02
> -/static/tty03
> -/static/tun
> -/static/umask00
> -/static/unbound_sock
> -/static/unhashed_proc
> -/static/unlink_fifo
> -/static/unlink_fifo_wronly
> -/static/unlink_fstat00
> -/static/unlink_fstat01
> -/static/unlink_fstat01+
> -/static/unlink_fstat02
> -/static/unlink_fstat03
> -/static/unlink_fstat04
> -/static/unlink_largefile
> -/static/unlink_mmap00
> -/static/unlink_mmap01
> -/static/unlink_mmap02
> -/static/unlink_regular00
> -/static/uptime_grow
> -/static/utsname
> -/static/vfork00
> -/static/vdso00
> -/static/vdso01
> -/static/wait00
> -/static/write_read00
> -/static/write_read01
> -/static/write_read02
> -/static/write_read10
> -/static/xids00
> -/static/zombie00
> -/static/ip.dump
> -/static/ip.rst
> -/static/vsx
> -/static/vt
> -/static/aio00
> -/static/packet_sock_mmap
> -/static/console
> -/static/fd
> -/static/file_locks02
> -/static/file_locks03
> -/static/file_locks04
> -/static/file_locks05
> -/static/mlock_setuid
> -/static/mntns_root_bind
> -/static/mntns_root_bind02
> -/static/mntns-deleted-dst
> -/static/socket-tcp-local
> -/static/socket-tcp6-local
> -/static/socket-tcpbuf6-local
> -/static/sk-freebind
> -/static/sk-freebind-false
> -/static/stopped01
> -/static/stopped02
> -/static/stopped03
> -/static/stopped12
> -/static/tempfs_subns
> -/transition/fifo_dyn
> -/transition/fifo_loop
> -/transition/file_aio
> -/transition/netlink00
> -/transition/pipe_loop00
> -/transition/pipe_shared00
> -/transition/socket-tcp
> -/transition/socket-tcp6
> -/transition/socket_loop00
> -/transition/unix_sock
> -/transition/epoll
> -/transition/file_read
> -/transition/fork
> -/transition/fork2
> -/transition/ipc
> -/transition/maps007
> -/transition/ptrace
> -/transition/thread-bomb
> +/static/.gitignore
> +/transition/.gitignore
>  
>  *.pid
> +*.pidns
>  *.out
>  *.outns
>  *.out.external
> diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
> index a18435b98a7f..85e746abf4e9 100644
> --- a/test/zdtm/static/Makefile
> +++ b/test/zdtm/static/Makefile
> @@ -2,6 +2,7 @@ include ../Makefile.inc
>  
>  LIBDIR	= ../lib
>  LIB	= $(LIBDIR)/libzdtmtst.a
> +LDLIBS	+= $(LIBDIR)/libzdtmtst.a
>  override CPPFLAGS += -I$(LIBDIR)
>  CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
>  CFLAGS	+= $(USERCFLAGS)
> @@ -274,6 +275,10 @@ OUT	= $(TST:%=%.out)
>  STATE	= $(TST_STATE:%=%.state)
>  STATE_OUT	= $(TST_STATE:%=%.out)
>  
> +%: %.c
> +	$(Q)echo $@ >> .gitignore
> +	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LOADLIBES) $^ $(LDLIBS) -o $@
> +
>  all:	$(TST) criu-rtc.so
>  install: all
>  .PHONY: all install
> @@ -398,7 +403,10 @@ stopped12:	override CFLAGS += -DZDTM_STOPPED_KILL -DZDTM_STOPPED_TKILL
>  $(LIB):	force
>  	$(Q) $(MAKE) -C $(LIBDIR)
>  
> -clean:
> +gitignore-clean:
> +	$(RM) -f .gitignore
> +
> +clean:	gitignore-clean
>  	$(RM) -f $(OBJ) $(TST) *~ criu-rtc.so criu-rtc.pb-c.c criu-rtc.pb-c.h get_smaps_bits.o
>  
>  cleandep:	clean
> @@ -415,6 +423,8 @@ realclean:	cleandep cleanout
>  rtc.c: criu-rtc.so
>  
>  criu-rtc.pb-c.c: criu-rtc.proto
> +	$(Q)echo $@ >> .gitignore
> +	$(Q)echo $(@:%.c=%.h) >> .gitignore
>  	protoc-c --proto_path=. --c_out=. criu-rtc.proto
>  
>  criu-rtc.so: criu-rtc.c criu-rtc.pb-c.c
> diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile
> index a8dbc4d6352d..99ed19da6ad5 100644
> --- a/test/zdtm/transition/Makefile
> +++ b/test/zdtm/transition/Makefile
> @@ -2,6 +2,7 @@ include ../Makefile.inc
>  
>  LIBDIR	= ../lib
>  LIB	= $(LIBDIR)/libzdtmtst.a
> +LDLIBS	+= $(LIBDIR)/libzdtmtst.a
>  override CPPFLAGS += -I$(LIBDIR)
>  CFLAGS	= -g -O2 -Wall -Werror -fno-strict-aliasing
>  CFLAGS	+= $(USERCFLAGS)
> @@ -37,6 +38,10 @@ DEP	= $(SRC:%.c=%.d)
>  PID	= $(TST:%=%.pid)
>  OUT	= $(TST:%=%.out)
>  
> +%: %.c
> +	$(Q)echo $@ >> .gitignore
> +	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LOADLIBES) $^ $(LDLIBS) -o $@
> +
>  all:	$(TST)
>  install: all
>  .PHONY: all install
> @@ -85,7 +90,10 @@ thread-bomb:	override LDFLAGS += -pthread
>  $(LIB):	force
>  	$(Q) $(MAKE) -C $(LIBDIR)
>  
> -clean:
> +gitignore-clean:
> +	$(RM) -f .gitignore
> +
> +clean:	gitignore-clean
>  	$(RM) -f $(OBJ) $(TST) *~
>  
>  cleandep:	clean
> -- 
> 2.9.0
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu