]> granicus.if.org Git - neomutt/commitdiff
test: templates for signal functions
authorRichard Russon <rich@flatcap.org>
Sun, 28 Apr 2019 11:37:16 +0000 (12:37 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 30 Apr 2019 10:22:04 +0000 (11:22 +0100)
.gitignore
test/Makefile.autosetup
test/signal/main.c [new file with mode: 0644]
test/signal/mutt_sig_allow_interrupt.c [new file with mode: 0644]
test/signal/mutt_sig_block.c [new file with mode: 0644]
test/signal/mutt_sig_block_system.c [new file with mode: 0644]
test/signal/mutt_sig_empty_handler.c [new file with mode: 0644]
test/signal/mutt_sig_exit_handler.c [new file with mode: 0644]
test/signal/mutt_sig_init.c [new file with mode: 0644]
test/signal/mutt_sig_unblock.c [new file with mode: 0644]
test/signal/mutt_sig_unblock_system.c [new file with mode: 0644]

index bfe81e5a13256f93fe78393674b0189743bb243a..aff4ade2fe8c373eee357925dd4a6544492f898e 100644 (file)
@@ -33,6 +33,7 @@ test/path-test
 test/pattern-test
 test/regex-test
 test/sha1-test
+test/signal-test
 test/string-test
 
 # Build products
index 637a23b7fe8e165dfcd1db179bd82b2fb617cece..ff50618875d7728ceb3ad979d1faeb8d3d6dbc4c 100644 (file)
@@ -311,6 +311,16 @@ SHA1_OBJS  = test/sha1/main.o \
                  test/sha1/mutt_sha1_transform.o \
                  test/sha1/mutt_sha1_update.o
 
+SIGNAL_OBJS    = test/signal/main.o \
+                 test/signal/mutt_sig_allow_interrupt.o \
+                 test/signal/mutt_sig_block.o \
+                 test/signal/mutt_sig_block_system.o \
+                 test/signal/mutt_sig_empty_handler.o \
+                 test/signal/mutt_sig_exit_handler.o \
+                 test/signal/mutt_sig_init.o \
+                 test/signal/mutt_sig_unblock.o \
+                 test/signal/mutt_sig_unblock_system.o
+
 STRING_OBJS    = test/string/main.o \
                  test/string/mutt_str_adjust.o \
                  test/string/mutt_str_append_item.o \
@@ -407,10 +417,12 @@ TEST_REGEX = test/regex-test$(EXEEXT)
 
 TEST_SHA1 = test/sha1-test$(EXEEXT)
 
+TEST_SIGNAL = test/signal-test$(EXEEXT)
+
 TEST_STRING = test/string-test$(EXEEXT)
 
 .PHONY: test
-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_STRING)
+test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING)
        $(TEST_BINARY)
        $(TEST_ADDRESS)
        $(TEST_BASE64)
@@ -433,6 +445,7 @@ test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSE
        $(TEST_PATTERN)
        $(TEST_REGEX)
        $(TEST_SHA1)
+       $(TEST_SIGNAL)
        $(TEST_STRING)
 
 $(TEST_BINARY): $(TEST_OBJS) $(MUTTLIBS)
@@ -504,6 +517,9 @@ $(TEST_REGEX): $(PWD)/test/regex $(REGEX_OBJS) $(MUTTLIBS)
 $(TEST_SHA1): $(PWD)/test/sha1 $(SHA1_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(SHA1_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
+$(TEST_SIGNAL): $(PWD)/test/signal $(SIGNAL_OBJS) $(MUTTLIBS)
+       $(CC) -o $@ $(SIGNAL_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
+
 $(TEST_STRING): $(PWD)/test/string $(STRING_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(STRING_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
@@ -573,10 +589,13 @@ $(PWD)/test/regex:
 $(PWD)/test/sha1:
        $(MKDIR_P) $(PWD)/test/sha1
 
+$(PWD)/test/signal:
+       $(MKDIR_P) $(PWD)/test/signal
+
 $(PWD)/test/string:
        $(MKDIR_P) $(PWD)/test/string
 
-all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_STRING)
+all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING)
 
 clean-test:
        $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \
@@ -601,6 +620,7 @@ clean-test:
              $(TEST_PATTERN) $(PATTERN_OBJS) $(PATTERN_OBJS:.o=.Po) \
              $(TEST_REGEX) $(REGEX_OBJS) $(REGEX_OBJS:.o=.Po) \
              $(TEST_SHA1) $(SHA1_OBJS) $(SHA1_OBJS:.o=.Po) \
+             $(TEST_SIGNAL) $(SIGNAL_OBJS) $(SIGNAL_OBJS:.o=.Po) \
              $(TEST_STRING) $(STRING_OBJS) $(STRING_OBJS:.o=.Po)
 
 install-test:
@@ -675,6 +695,9 @@ REGEX_DEPFILES = $(REGEX_OBJS:.o=.Po)
 SHA1_DEPFILES = $(SHA1_OBJS:.o=.Po)
 -include $(SHA1_DEPFILES)
 
+SIGNAL_DEPFILES = $(SIGNAL_OBJS:.o=.Po)
+-include $(SIGNAL_DEPFILES)
+
 STRING_DEPFILES = $(STRING_OBJS:.o=.Po)
 -include $(STRING_DEPFILES)
 
diff --git a/test/signal/main.c b/test/signal/main.c
new file mode 100644 (file)
index 0000000..e4f0d86
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * @file
+ * Test code for signal Operations
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "acutest.h"
+
+/******************************************************************************
+ * Add your test cases to this list.
+ *****************************************************************************/
+#define NEOMUTT_TEST_LIST                                                      \
+  NEOMUTT_TEST_ITEM(test_mutt_sig_allow_interrupt)                             \
+  NEOMUTT_TEST_ITEM(test_mutt_sig_block)                                       \
+  NEOMUTT_TEST_ITEM(test_mutt_sig_block_system)                                \
+  NEOMUTT_TEST_ITEM(test_mutt_sig_empty_handler)                               \
+  NEOMUTT_TEST_ITEM(test_mutt_sig_exit_handler)                                \
+  NEOMUTT_TEST_ITEM(test_mutt_sig_init)                                        \
+  NEOMUTT_TEST_ITEM(test_mutt_sig_unblock)                                     \
+  NEOMUTT_TEST_ITEM(test_mutt_sig_unblock_system)
+
+/******************************************************************************
+ * You probably don't need to touch what follows.
+ *****************************************************************************/
+#define NEOMUTT_TEST_ITEM(x) void x(void);
+NEOMUTT_TEST_LIST
+#undef NEOMUTT_TEST_ITEM
+
+TEST_LIST = {
+#define NEOMUTT_TEST_ITEM(x) { #x, x },
+  NEOMUTT_TEST_LIST
+#undef NEOMUTT_TEST_ITEM
+  { 0 }
+};
diff --git a/test/signal/mutt_sig_allow_interrupt.c b/test/signal/mutt_sig_allow_interrupt.c
new file mode 100644 (file)
index 0000000..921bd0e
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sig_allow_interrupt()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_sig_allow_interrupt(void)
+{
+  // void mutt_sig_allow_interrupt(bool allow);
+}
diff --git a/test/signal/mutt_sig_block.c b/test/signal/mutt_sig_block.c
new file mode 100644 (file)
index 0000000..23a704a
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sig_block()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_sig_block(void)
+{
+  // void mutt_sig_block(void);
+}
diff --git a/test/signal/mutt_sig_block_system.c b/test/signal/mutt_sig_block_system.c
new file mode 100644 (file)
index 0000000..94c2b37
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sig_block_system()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_sig_block_system(void)
+{
+  // void mutt_sig_block_system(void);
+}
diff --git a/test/signal/mutt_sig_empty_handler.c b/test/signal/mutt_sig_empty_handler.c
new file mode 100644 (file)
index 0000000..26c9e60
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sig_empty_handler()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_sig_empty_handler(void)
+{
+  // void mutt_sig_empty_handler(int sig);
+}
diff --git a/test/signal/mutt_sig_exit_handler.c b/test/signal/mutt_sig_exit_handler.c
new file mode 100644 (file)
index 0000000..fec0910
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sig_exit_handler()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_sig_exit_handler(void)
+{
+  // void mutt_sig_exit_handler(int sig);
+}
diff --git a/test/signal/mutt_sig_init.c b/test/signal/mutt_sig_init.c
new file mode 100644 (file)
index 0000000..b184f9b
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sig_init()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_sig_init(void)
+{
+  // void mutt_sig_init(sig_handler_t sig_fn, sig_handler_t exit_fn);
+}
diff --git a/test/signal/mutt_sig_unblock.c b/test/signal/mutt_sig_unblock.c
new file mode 100644 (file)
index 0000000..c691775
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sig_unblock()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_sig_unblock(void)
+{
+  // void mutt_sig_unblock(void);
+}
diff --git a/test/signal/mutt_sig_unblock_system.c b/test/signal/mutt_sig_unblock_system.c
new file mode 100644 (file)
index 0000000..95e3a5f
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sig_unblock_system()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_sig_unblock_system(void)
+{
+  // void mutt_sig_unblock_system(bool catch);
+}