1fa59483dSPhilippe Mathieu-Daudé#!/usr/bin/env bash 2cebc92a2SMarcel Apfelbaum 3cebc92a2SMarcel Apfelbaum# 4cebc92a2SMarcel Apfelbaum# Rebuild expected AML files for acpi unit-test 5cebc92a2SMarcel Apfelbaum# 6cebc92a2SMarcel Apfelbaum# Copyright (c) 2013 Red Hat Inc. 7cebc92a2SMarcel Apfelbaum# 8cebc92a2SMarcel Apfelbaum# Authors: 9cebc92a2SMarcel Apfelbaum# Marcel Apfelbaum <marcel.a@redhat.com> 10ae3c12a0SIgor Mammedov# Igor Mammedov <imammedo@redhat.com> 11cebc92a2SMarcel Apfelbaum# 12cebc92a2SMarcel Apfelbaum# This work is licensed under the terms of the GNU GPLv2. 13cebc92a2SMarcel Apfelbaum# See the COPYING.LIB file in the top-level directory. 14cebc92a2SMarcel Apfelbaum 15*0f130d9eSSunil V Lqemu_arches="x86_64 aarch64 riscv64" 16cebc92a2SMarcel Apfelbaum 170ce46ab5SShameer Kolothumif [ ! -e "tests/qtest/bios-tables-test" ]; then 1890475791SPaolo Bonzini echo "Test: bios-tables-test is required! Run make check before this script." 19cebc92a2SMarcel Apfelbaum echo "Run this script from the build directory." 20cebc92a2SMarcel Apfelbaum exit 1; 21cebc92a2SMarcel Apfelbaumfi 22cebc92a2SMarcel Apfelbaum 2371352aa9SMichael S. Tsirkinif grep TARGET_DIRS= config-host.mak; then 2471352aa9SMichael S. Tsirkin for arch in $qemu_arches; do 2571352aa9SMichael S. Tsirkin if grep TARGET_DIRS= config-host.mak | grep "$arch"-softmmu; 2671352aa9SMichael S. Tsirkin then 2771352aa9SMichael S. Tsirkin qemu_bins="$qemu_bins ./qemu-system-$arch" 2871352aa9SMichael S. Tsirkin fi 2971352aa9SMichael S. Tsirkin done 3071352aa9SMichael S. Tsirkinelse 3171352aa9SMichael S. Tsirkin echo "config-host.mak missing!" 3271352aa9SMichael S. Tsirkin echo "Run this script from the build directory." 3371352aa9SMichael S. Tsirkin exit 1; 3471352aa9SMichael S. Tsirkinfi 3571352aa9SMichael S. Tsirkin 3671352aa9SMichael S. Tsirkinif [ -z "$qemu_bins" ]; then 3771352aa9SMichael S. Tsirkin echo "Only the following architectures are currently supported: $qemu_arches" 3871352aa9SMichael S. Tsirkin echo "None of these configured!" 39*0f130d9eSSunil V L echo "To fix, run configure \ 40*0f130d9eSSunil V L --target-list=x86_64-softmmu,aarch64-softmmu,riscv64-softmmu" 4171352aa9SMichael S. Tsirkin exit 1; 4271352aa9SMichael S. Tsirkinfi 4371352aa9SMichael S. Tsirkin 44ae3c12a0SIgor Mammedovfor qemu in $qemu_bins; do 45ae3c12a0SIgor Mammedov if [ ! -e $qemu ]; then 46ae3c12a0SIgor Mammedov echo "Run 'make' to build the following QEMU executables: $qemu_bins" 47ae3c12a0SIgor Mammedov echo "Also, run this script from the build directory." 48ae3c12a0SIgor Mammedov exit 1; 49ae3c12a0SIgor Mammedov fi 500ce46ab5SShameer Kolothum TEST_ACPI_REBUILD_AML=y QTEST_QEMU_BINARY=$qemu tests/qtest/bios-tables-test 51ae3c12a0SIgor Mammedovdone 52ae3c12a0SIgor Mammedov 535f6b3561SMichael S. Tsirkineval `grep SRC_PATH= config-host.mak` 545f6b3561SMichael S. Tsirkin 556ab425d8SMichael S. Tsirkinold_allowed_dif=`grep -v -e 'List of comma-separated changed AML files to ignore' ${SRC_PATH}/tests/qtest/bios-tables-test-allowed-diff.h` 566ab425d8SMichael S. Tsirkin 570ce46ab5SShameer Kolothumecho '/* List of comma-separated changed AML files to ignore */' > ${SRC_PATH}/tests/qtest/bios-tables-test-allowed-diff.h 58cebc92a2SMarcel Apfelbaum 59cebc92a2SMarcel Apfelbaumecho "The files were rebuilt and can be added to git." 60e6e68e32SMichael S. Tsirkinecho "You can use ${SRC_PATH}/tests/data/acpi/disassemle-aml.sh to disassemble them to ASL." 616ab425d8SMichael S. Tsirkin 626ab425d8SMichael S. Tsirkinif [ -z "$old_allowed_dif" ]; then 636ab425d8SMichael S. Tsirkin echo "Note! Please do not commit expected files with source changes" 646ab425d8SMichael S. Tsirkin echo "Note! Please follow the process documented in ${SRC_PATH}/tests/qtest/bios-tables-test.c" 656ab425d8SMichael S. Tsirkinfi 66