config: replace cli with direct common_ options

This commit is contained in:
Ciro Santilli
2018-08-09 07:12:20 +01:00
parent 1cb056a995
commit b1bd45684f
14 changed files with 10 additions and 45 deletions

View File

@@ -846,14 +846,10 @@ It gets annoying to retype `-a aarch64` for every single command, or to remember
So simplify that, do: So simplify that, do:
.... ....
cp cli.example data/cli cp config.example data/config
.... ....
and then edit the `data/cli` file to your needs. and then edit the `data/config` 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.
=== Clean the build === Clean the build
@@ -7342,7 +7338,7 @@ printf '' > data/readfile
./run -a "$arch" -g -- -r 1 ./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[]. 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[].

View File

@@ -1,16 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Run all benchmarks for this repo, and save the results to the # Run all benchmarks for this repo, and save the results to the
# benchmark repo, which should be cloned at ../linux-kernel-module-cheat-benchmarks. # benchmark repo, which should be cloned at ../linux-kernel-module-cheat-benchmarks.
set -eux
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
set -x
bench_build=false bench_build=false
bench_buildroot_baseline=false bench_buildroot_baseline=false
bench_gem5_build=false bench_gem5_build=false
bench_linux_boot=false bench_linux_boot=false
default_arch=x86_64 default_arch=x86_64
update_repo=false update_repo=false
set -- ${cli_bench_all:-} "$@"
while getopts Aa:Bbglu OPT; do while getopts Aa:Bbglu OPT; do
case "$OPT" in case "$OPT" in
A) A)

2
build
View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
set -- ${cli_build:-} "$@"
mkdir -p "${common_out_dir}" mkdir -p "${common_out_dir}"
br2_cli_file="${common_out_dir}/br2_cli" br2_cli_file="${common_out_dir}/br2_cli"
rm -f "$br2_cli_file" rm -f "$br2_cli_file"

View File

@@ -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}"

4
common
View File

@@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
common_abspath() ( common_abspath() (
echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")" echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
) )
@@ -146,7 +148,7 @@ common_qemu_variant=default
common_run_id=0 common_run_id=0
common_suffix= common_suffix=
f="${common_data_dir}/cli" f="${common_data_dir}/config"
if [ -f "$f" ]; then if [ -f "$f" ]; then
. "$f" . "$f"
fi fi

3
config.example Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
common_arch=aarch64
common_gem5=true

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
set -- ${cli_qemu_trace2txt:-} "$@"
while getopts a: OPT; do while getopts a: OPT; do
case "$OPT" in case "$OPT" in
a) a)

2
run
View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
set -- ${cli_run:-} "$@"
# CLI handling. # CLI handling.
cpus=1 cpus=1

2
rungdb
View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
set -- ${cli_rungdb:-} "$@"
after= after=
before= before=
lx_symbols="-ex 'lx-symbols ../kernel_module-1.0/' \\ lx_symbols="-ex 'lx-symbols ../kernel_module-1.0/' \\

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
set -- ${cli_rungdb_user:-} "$@"
usage="$0 <exec-relative-path> [<brk-symbol>]" usage="$0 <exec-relative-path> [<brk-symbol>]"
gem5_opt= gem5_opt=
while getopts a:gh OPT; do while getopts a:gh OPT; do

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
set -- ${cli_rungdbserver:-} "$@"
while getopts a:g OPT; do while getopts a:g OPT; do
case "$OPT" in case "$OPT" in
a) a)

2
runtc
View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
set -- ${cli_runtc:-} "$@"
while getopts a:gh OPT; do while getopts a:gh OPT; do
case "$OPT" in case "$OPT" in
a) a)

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
set -- ${cli_trace_boot:-} "$@"
while getopts a:g OPT; do while getopts a:g OPT; do
case "$OPT" in case "$OPT" in
a) a)

View File

@@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
set -- ${cli_trace2line:-} "$@"
while getopts a:g OPT; do while getopts a:g OPT; do
case "$OPT" in case "$OPT" in
a) a)