Skip to content

Commit

Permalink
Merge branch 'release/0.2.1' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Jan 18, 2023
2 parents b876d19 + 784cbb7 commit 726cc1a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Version 0.2.1 [2023-01-18]

* Now `--assert` reports also on the CPU name.


# Version 0.2.0 [2023-01-18]

## New Features
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ $ x86-64-level
3
```

and

```sh
$ level=$(x86-64-level)
$ echo "x86-64-v${level}"
x86-64-v3
```

If you want to know an "explanation", specify option `--verbose`, e.g.

```sh
Expand Down Expand Up @@ -101,8 +109,8 @@ $ echo $?
0

$ x86-64-level --assert=4
The CPU on this host ('gandalf') supports x86-64-v3, which is less
than the required x86-64-v4
The CPU [Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz] on this host ('dev2')
supports x86-64-v3, which is less than the required x86-64-v4
$ echo $?
1
```
Expand Down Expand Up @@ -156,4 +164,3 @@ license.
[Gilles]: https://stackexchange.com/users/164368/
[gioele]: https://unix.stackexchange.com/users/14861/
[CC BY-SA 4.0]: https://creativecommons.org/licenses/by-sa/4.0/

12 changes: 7 additions & 5 deletions x86-64-level
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
#' 0
#'
#' $ x86-64-level --assert=4
#' The CPU on this host ('gandalf') supports x86-64-v3, which is less
#' than the required x86-64-v4
#' The CPU [Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz] on this host ('dev2')
#' supports x86-64-v3, which is less than the required x86-64-v4
#' $ echo $?
#' 1
#'
#' Version: 0.2.0
#' Version: 0.2.1
#' License: CC BY-SA 4.0
#' Source: https://github.com/ucsf-wynton/wynton-tools
#'
Expand Down Expand Up @@ -212,11 +212,13 @@ while [[ $# -gt 0 ]]; do
shift
done


if [[ -n $assert ]]; then
version=$(report_cpu_version)
if [[ $version < $assert ]]; then
>&2 echo "The CPU on this host ('${HOSTNAME}') supports x86-64-v${version}, which is less than the required x86-64-v${assert}"
read_input
cpu_info=$(get_cpu_name)
[[ -n ${cpu_info} ]] && cpu_info=" [${cpu_info}]"
>&2 echo "The CPU${cpu_info} on this host ('${HOSTNAME}') supports x86-64-v${version}, which is less than the required x86-64-v${assert}"
exit 1
fi
else
Expand Down

0 comments on commit 726cc1a

Please sign in to comment.