From b1bd45684fa4ebba8b0e8741c6612bfaaca3d710 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Thu, 9 Aug 2018 07:12:20 +0100 Subject: [PATCH] config: replace cli with direct common_ options --- README.adoc | 10 +++------- bench-all | 4 +--- build | 2 -- cli.example | 16 ---------------- common | 4 +++- config.example | 3 +++ qemu-trace2txt | 2 -- run | 2 -- rungdb | 2 -- rungdb-user | 2 -- rungdbserver | 2 -- runtc | 2 -- trace-boot | 2 -- trace2line | 2 -- 14 files changed, 10 insertions(+), 45 deletions(-) delete mode 100644 cli.example create mode 100644 config.example diff --git a/README.adoc b/README.adoc index e07c5e3..0eea556 100644 --- a/README.adoc +++ b/README.adoc @@ -846,14 +846,10 @@ It gets annoying to retype `-a aarch64` for every single command, or to remember So simplify that, do: .... -cp cli.example data/cli +cp config.example data/config .... -and then edit the `data/cli` file to your needs. - -That file is used to pass extra command line arguments to most of our utilities. - -Of course, you could get by with the shell history, or your own aliases, but we've felt that it was worth introducing a common mechanism for that. +and then edit the `data/config` file to your needs. === Clean the build @@ -7342,7 +7338,7 @@ printf '' > data/readfile ./run -a "$arch" -g -- -r 1 .... -These commands output the approximate number of CPU cycles it took Dhrystone to run. +The commands output the approximate number of CPU cycles it took Dhrystone to run. For more serious tests, you will likely want to automate logging the commands ran and results to files, a good example is: link:gem5-bench-cache[]. diff --git a/bench-all b/bench-all index eeffeb6..ac8652b 100755 --- a/bench-all +++ b/bench-all @@ -1,16 +1,14 @@ #!/usr/bin/env bash # Run all benchmarks for this repo, and save the results to the # benchmark repo, which should be cloned at ../linux-kernel-module-cheat-benchmarks. -set -eux . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" - +set -x bench_build=false bench_buildroot_baseline=false bench_gem5_build=false bench_linux_boot=false default_arch=x86_64 update_repo=false -set -- ${cli_bench_all:-} "$@" while getopts Aa:Bbglu OPT; do case "$OPT" in A) diff --git a/build b/build index 1dcc528..c7a2f3c 100755 --- a/build +++ b/build @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" -set -- ${cli_build:-} "$@" mkdir -p "${common_out_dir}" br2_cli_file="${common_out_dir}/br2_cli" rm -f "$br2_cli_file" diff --git a/cli.example b/cli.example deleted file mode 100644 index f2a4f40..0000000 --- a/cli.example +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -arch=x86_64 -gem5= -#gem5=-g -printf ' -#BR2_TARGET_ROOTFS_EXT2_SIZE="1024M" -' > br2.gitignore -cli_bench_all="" -cli_build="-a ${arch} -b br2.gitignore -b br2_x11 ${gem5}" -cli_run="-a ${arch} ${gem5}" -cli_rungdb="-a ${arch} ${gem5}" -cli_rungdb_user="-a ${arch} ${gem5}" -cli_rungdbserver="-a ${arch} ${gem5}" -cli_runtc="-a ${arch}" -cli_trace2line="-a ${arch}" -cli_trace_boot="-a ${arch}" diff --git a/common b/common index d0ba00e..bb0cc61 100644 --- a/common +++ b/common @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -eu + common_abspath() ( echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")" ) @@ -146,7 +148,7 @@ common_qemu_variant=default common_run_id=0 common_suffix= -f="${common_data_dir}/cli" +f="${common_data_dir}/config" if [ -f "$f" ]; then . "$f" fi diff --git a/config.example b/config.example new file mode 100644 index 0000000..f86fff2 --- /dev/null +++ b/config.example @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +common_arch=aarch64 +common_gem5=true diff --git a/qemu-trace2txt b/qemu-trace2txt index c99468e..5c691f9 100755 --- a/qemu-trace2txt +++ b/qemu-trace2txt @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" -set -- ${cli_qemu_trace2txt:-} "$@" while getopts a: OPT; do case "$OPT" in a) diff --git a/run b/run index b8e8751..c7825f0 100755 --- a/run +++ b/run @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" -set -- ${cli_run:-} "$@" # CLI handling. cpus=1 diff --git a/rungdb b/rungdb index 23b9d5d..91d4a56 100755 --- a/rungdb +++ b/rungdb @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" -set -- ${cli_rungdb:-} "$@" after= before= lx_symbols="-ex 'lx-symbols ../kernel_module-1.0/' \\ diff --git a/rungdb-user b/rungdb-user index 147f069..d74fef2 100755 --- a/rungdb-user +++ b/rungdb-user @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" -set -- ${cli_rungdb_user:-} "$@" usage="$0 []" gem5_opt= while getopts a:gh OPT; do diff --git a/rungdbserver b/rungdbserver index d2271e6..c0bd853 100755 --- a/rungdbserver +++ b/rungdbserver @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" -set -- ${cli_rungdbserver:-} "$@" while getopts a:g OPT; do case "$OPT" in a) diff --git a/runtc b/runtc index 1dd6590..73de5f6 100755 --- a/runtc +++ b/runtc @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" -set -- ${cli_runtc:-} "$@" while getopts a:gh OPT; do case "$OPT" in a) diff --git a/trace-boot b/trace-boot index f567ecb..a7e327c 100755 --- a/trace-boot +++ b/trace-boot @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" -set -- ${cli_trace_boot:-} "$@" while getopts a:g OPT; do case "$OPT" in a) diff --git a/trace2line b/trace2line index 503c4d6..da1542a 100755 --- a/trace2line +++ b/trace2line @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" -set -- ${cli_trace2line:-} "$@" while getopts a:g OPT; do case "$OPT" in a)