[PATCH] tests: disassemble-asm.sh: generate AML in readable format

Michael S. Tsirkin posted 1 patch 3 years, 10 months ago
Test docker-mingw@fedora passed
Test checkpatch failed
Test asan passed
Test docker-quick@centos7 passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200611165112.30979-1-mst@redhat.com
Maintainers: Igor Mammedov <imammedo@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
tests/data/acpi/disassemle-aml.sh | 52 +++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100755 tests/data/acpi/disassemle-aml.sh
[PATCH] tests: disassemble-asm.sh: generate AML in readable format
Posted by Michael S. Tsirkin 3 years, 10 months ago
On systems where the IASL tool exists, we can convert
extected ACPI tables to ASL format, which is useful
for debugging and documentation purposes.
This script does this for all ACPI tables under tests/data/acpi/.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/data/acpi/disassemle-aml.sh | 52 +++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100755 tests/data/acpi/disassemle-aml.sh

diff --git a/tests/data/acpi/disassemle-aml.sh b/tests/data/acpi/disassemle-aml.sh
new file mode 100755
index 0000000000..42a1b51df0
--- /dev/null
+++ b/tests/data/acpi/disassemle-aml.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/bash
+
+outdir=
+while getopts "o:" arg; do
+  case ${arg} in
+    o )
+        outdir=$OPTARG
+        ;;
+    \? )
+        echo "Usage: ./tests/data/acpi/disassemle-aml.sh [-o <output-directory>]"
+        exit 1
+        ;;
+    
+  esac
+done
+
+for machine in tests/data/acpi/*
+do
+    if [[ ! -d "$machine" ]];
+    then
+        continue
+    fi
+
+    if [[ "${outdir}" ]];
+    then
+        mkdir -p "${outdir}"/${machine} || exit $?
+    fi
+    for aml in $machine/*
+    do
+        if [[ "$aml" == $machine/*.dsl ]];
+        then
+            continue
+        fi
+        if [[ "$aml" == $machine/SSDT*.* ]];
+        then
+            dsdt=${aml/SSDT*./DSDT.}
+            extra="-e ${dsdt}"
+        elif [[ "$aml" == $machine/SSDT* ]];
+        then
+            dsdt=${aml/SSDT*/DSDT};
+            extra="-e ${dsdt}"
+        else
+            extra=""
+        fi
+        asl=${aml}.dsl
+        if [[ "${outdir}" ]];
+        then
+            asl="${outdir}"/${machine}/${asl}
+        fi
+        iasl -d -p ${asl} ${extra} ${aml} 
+    done
+done
-- 
MST


Re: [PATCH] tests: disassemble-asm.sh: generate AML in readable format
Posted by no-reply@patchew.org 3 years, 10 months ago
Patchew URL: https://patchew.org/QEMU/20200611165112.30979-1-mst@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20200611165112.30979-1-mst@redhat.com
Subject: [PATCH] tests: disassemble-asm.sh: generate AML in readable format
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
96571e6 tests: disassemble-asm.sh: generate AML in readable format

=== OUTPUT BEGIN ===
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#16: 
new file mode 100755

WARNING: line over 80 characters
#30: FILE: tests/data/acpi/disassemle-aml.sh:10:
+        echo "Usage: ./tests/data/acpi/disassemle-aml.sh [-o <output-directory>]"

ERROR: trailing whitespace
#33: FILE: tests/data/acpi/disassemle-aml.sh:13:
+    $

ERROR: trailing whitespace
#70: FILE: tests/data/acpi/disassemle-aml.sh:50:
+        iasl -d -p ${asl} ${extra} ${aml} $

total: 2 errors, 2 warnings, 52 lines checked

Commit 96571e631bfb (tests: disassemble-asm.sh: generate AML in readable format) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20200611165112.30979-1-mst@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [PATCH] tests: disassemble-asm.sh: generate AML in readable format
Posted by Igor Mammedov 3 years, 10 months ago
On Thu, 11 Jun 2020 12:51:16 -0400
"Michael S. Tsirkin" <mst@redhat.com> wrote:

subj: s/asm/asl/

> On systems where the IASL tool exists, we can convert
> extected ACPI tables to ASL format, which is useful
> for debugging and documentation purposes.
> This script does this for all ACPI tables under tests/data/acpi/. 

for debugging I usually use V=1 env var with test/make check,
as it gives me all diffs vs current blobs.
And it's on rare occasion that I go and decompile ASL file myself,
since test already did that for tables that didn't match. 

> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  tests/data/acpi/disassemle-aml.sh | 52 +++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
>  create mode 100755 tests/data/acpi/disassemle-aml.sh
> 
> diff --git a/tests/data/acpi/disassemle-aml.sh b/tests/data/acpi/disassemle-aml.sh
> new file mode 100755
> index 0000000000..42a1b51df0
> --- /dev/null
> +++ b/tests/data/acpi/disassemle-aml.sh
> @@ -0,0 +1,52 @@
> +#!/usr/bin/bash
> +
> +outdir=
> +while getopts "o:" arg; do
> +  case ${arg} in
> +    o )
> +        outdir=$OPTARG
> +        ;;
> +    \? )
> +        echo "Usage: ./tests/data/acpi/disassemle-aml.sh [-o <output-directory>]"
> +        exit 1
> +        ;;
> +    
> +  esac
> +done
> +
> +for machine in tests/data/acpi/*
> +do
> +    if [[ ! -d "$machine" ]];
> +    then
> +        continue
> +    fi
> +
> +    if [[ "${outdir}" ]];
> +    then
> +        mkdir -p "${outdir}"/${machine} || exit $?
> +    fi
> +    for aml in $machine/*
> +    do
> +        if [[ "$aml" == $machine/*.dsl ]];
> +        then
> +            continue
> +        fi
> +        if [[ "$aml" == $machine/SSDT*.* ]];
> +        then
> +            dsdt=${aml/SSDT*./DSDT.}
> +            extra="-e ${dsdt}"
> +        elif [[ "$aml" == $machine/SSDT* ]];
> +        then
> +            dsdt=${aml/SSDT*/DSDT};
> +            extra="-e ${dsdt}"
> +        else
> +            extra=""
> +        fi
> +        asl=${aml}.dsl
> +        if [[ "${outdir}" ]];
> +        then
> +            asl="${outdir}"/${machine}/${asl}
> +        fi
> +        iasl -d -p ${asl} ${extra} ${aml} 
> +    done
> +done