[lxc-devel] [lxc/master] tests: runc coccinelle checks

brauner on Github lxc-bot at linuxcontainers.org
Wed Feb 20 18:58:11 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 505 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190220/9311eb03/attachment.bin>
-------------- next part --------------
From e16155dda76d9afd6ec56fb17e095764656a82f1 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 20 Feb 2019 19:56:31 +0100
Subject: [PATCH 1/2] tests: runc coccinelle checks

This runs our coccinelle checks during testing. If any changes are detected by
git diff after coccinelle has executed we fail the build.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/tests/Makefile.am         |  3 ++-
 src/tests/lxc-test-coccinelle | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100755 src/tests/lxc-test-coccinelle

diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index f7e9dc8294..1879a22dbf 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -96,7 +96,8 @@ bin_PROGRAMS = lxc-test-api-reboot \
 	       lxc-test-state-server \
 	       lxc-test-utils
 
-bin_SCRIPTS =
+bin_SCRIPTS = lxc-test-coccinelle
+
 if ENABLE_TOOLS
 bin_SCRIPTS += lxc-test-automount \
 	       lxc-test-autostart \
diff --git a/src/tests/lxc-test-coccinelle b/src/tests/lxc-test-coccinelle
new file mode 100755
index 0000000000..a90d8f0e1f
--- /dev/null
+++ b/src/tests/lxc-test-coccinelle
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# lxc: linux Container library
+
+# Authors:
+# Christian Brauner <christian.brauner at ubuntu.com>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# This library 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
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+set -e
+
+../../coccinelle/run-coccinelle.sh
+git diff --exit-code --quiet

From 46d958cc94e09bea730412ee100de83a6e3b6243 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 20 Feb 2019 19:57:28 +0100
Subject: [PATCH 2/2] TESTING

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/freezer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/freezer.c b/src/lxc/freezer.c
index 953d9d8b83..4c86a9b319 100644
--- a/src/lxc/freezer.c
+++ b/src/lxc/freezer.c
@@ -70,7 +70,7 @@ static int do_freeze_thaw(bool freeze, struct lxc_conf *conf, const char *name,
 		return -1;
 	}
 
-	for (;;) {
+	while (true) {
 		ret = cgroup_ops->get(cgroup_ops, "freezer.state", v, sizeof(v),
 				      name, lxcpath);
 		if (ret < 0) {


More information about the lxc-devel mailing list