diff mbox

[3/6] utilities: kernelscan.sh: scan various directories for kernel error messages

Message ID 1351875517-19128-4-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Nov. 2, 2012, 4:58 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

This is the initial script to scrap for ACPI related error messages in the
kernel.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/utilities/kernelscan.sh |   57 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 src/utilities/kernelscan.sh

Comments

Keng-Yu Lin Nov. 7, 2012, 2:13 a.m. UTC | #1
On Sat, Nov 3, 2012 at 12:58 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> This is the initial script to scrap for ACPI related error messages in the
> kernel.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/utilities/kernelscan.sh |   57 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 57 insertions(+)
>  create mode 100644 src/utilities/kernelscan.sh
>
> diff --git a/src/utilities/kernelscan.sh b/src/utilities/kernelscan.sh
> new file mode 100644
> index 0000000..ed402d9
> --- /dev/null
> +++ b/src/utilities/kernelscan.sh
> @@ -0,0 +1,57 @@
> +#!/bin/bash
> +#
> +# Copyright (C) 2010-2012 Canonical
> +#
> +# 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, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> +#
> +
> +KERNELSCAN=./kernelscan
> +TMP=/tmp/kernelscan_$$.txt
> +
> +if [ $# -lt 1 ]; then
> +       echo "Usage: $0 path-to-kernel-source"
> +       exit 1
> +fi
> +
> +src=$1
> +
> +if [ ! -d  $1 ]; then
> +       echo "Path '$1' not found"
> +       exit 1
> +fi
> +
> +scan_source_file()
> +{
> +       $KERNELSCAN < $1 -E | gcc  -E - | $KERNELSCAN -P > $TMP
> +       if [ $(stat -c%s $TMP) -gt 0 ]; then
> +               echo "Source: $1"
> +               cat $TMP
> +       fi
> +       rm $TMP
> +}
> +
> +scan_source_tree()
> +{
> +       tree=$1
> +
> +       echo "Scanning $tree"
> +       for I in $(find $tree -name "*.c")
> +       do
> +               scan_source_file $I
> +       done
> +}
> +
> +scan_source_tree $src/drivers/acpi
> +scan_source_tree $src/arch/x86/kernel/acpi
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung Nov. 21, 2012, 5:50 a.m. UTC | #2
On 11/03/2012 12:58 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> This is the initial script to scrap for ACPI related error messages in the
> kernel.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/utilities/kernelscan.sh |   57 +++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 57 insertions(+)
>   create mode 100644 src/utilities/kernelscan.sh
>
> diff --git a/src/utilities/kernelscan.sh b/src/utilities/kernelscan.sh
> new file mode 100644
> index 0000000..ed402d9
> --- /dev/null
> +++ b/src/utilities/kernelscan.sh
> @@ -0,0 +1,57 @@
> +#!/bin/bash
> +#
> +# Copyright (C) 2010-2012 Canonical
> +#
> +# 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, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> +#
> +
> +KERNELSCAN=./kernelscan
> +TMP=/tmp/kernelscan_$$.txt
> +
> +if [ $# -lt 1 ]; then
> +	echo "Usage: $0 path-to-kernel-source"
> +	exit 1
> +fi
> +
> +src=$1
> +
> +if [ ! -d  $1 ]; then
> +	echo "Path '$1' not found"
> +	exit 1
> +fi
> +
> +scan_source_file()
> +{
> +	$KERNELSCAN < $1 -E | gcc  -E - | $KERNELSCAN -P > $TMP
> +	if [ $(stat -c%s $TMP) -gt 0 ]; then
> +		echo "Source: $1"
> +		cat $TMP
> +	fi
> +	rm $TMP
> +}
> +
> +scan_source_tree()
> +{
> +	tree=$1
> +
> +	echo "Scanning $tree"
> +	for I in $(find $tree -name "*.c")
> +	do
> +		scan_source_file $I
> +	done
> +}
> +
> +scan_source_tree $src/drivers/acpi
> +scan_source_tree $src/arch/x86/kernel/acpi
>
Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/utilities/kernelscan.sh b/src/utilities/kernelscan.sh
new file mode 100644
index 0000000..ed402d9
--- /dev/null
+++ b/src/utilities/kernelscan.sh
@@ -0,0 +1,57 @@ 
+#!/bin/bash
+#
+# Copyright (C) 2010-2012 Canonical
+#
+# 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+KERNELSCAN=./kernelscan
+TMP=/tmp/kernelscan_$$.txt
+
+if [ $# -lt 1 ]; then
+	echo "Usage: $0 path-to-kernel-source"
+	exit 1
+fi
+
+src=$1
+
+if [ ! -d  $1 ]; then
+	echo "Path '$1' not found"
+	exit 1
+fi
+
+scan_source_file()
+{
+	$KERNELSCAN < $1 -E | gcc  -E - | $KERNELSCAN -P > $TMP
+	if [ $(stat -c%s $TMP) -gt 0 ]; then
+		echo "Source: $1"
+		cat $TMP
+	fi
+	rm $TMP
+}
+
+scan_source_tree()
+{
+	tree=$1
+
+	echo "Scanning $tree"
+	for I in $(find $tree -name "*.c")
+	do
+		scan_source_file $I
+	done
+}
+
+scan_source_tree $src/drivers/acpi
+scan_source_tree $src/arch/x86/kernel/acpi