Recent changes (master)

Jens Axboe
2020-05-26T12:00:15Z

The following changes since commit 5df5882b267b1cc7d08f7e9038e6c1046d492936:

Merge branch 'parse-and-fill-pattern' of https://github.com/bvanassche/fio (2020-05-24 12:03:56 -0600)

are available in the Git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to c96b385b6e0c78478697713e6da9174fba2432d3:

t/zbd: make the test script easier to terminate (2020-05-25 18:21:45 -0600)

----------------------------------------------------------------
Dmitry Fomichev (4):
libzbc: cleanup init code
libzbc: fix whitespace errors
t/zbd: beautify test script output
t/zbd: make the test script easier to terminate

engines/libzbc.c | 33 +++++++++++++++++----------------
t/zbd/test-zbd-support | 20 ++++++++++++++++++--
2 files changed, 35 insertions(+), 18 deletions(-)

---

Diff of recent changes:

diff --git a/engines/libzbc.c b/engines/libzbc.c
index 8c682de6..9e568334 100644
--- a/engines/libzbc.c
+++ b/engines/libzbc.c
@@ -47,7 +47,7 @@ static int libzbc_open_dev(struct thread_data *td, struct fio_file *f,
struct libzbc_data **p_ld)
{
struct libzbc_data *ld = td->io_ops_data;
- int ret, flags = OS_O_DIRECT;
+ int ret, flags = OS_O_DIRECT;

if (ld) {
/* Already open */
@@ -61,7 +61,7 @@ static int libzbc_open_dev(struct thread_data *td, struct fio_file *f,
return -EINVAL;
}

- if (td_write(td)) {
+ if (td_write(td)) {
if (!read_only)
flags |= O_RDWR;
} else if (td_read(td)) {
@@ -71,17 +71,15 @@ static int libzbc_open_dev(struct thread_data *td, struct fio_file *f,
flags |= O_RDONLY;
} else if (td_trim(td)) {
td_verror(td, EINVAL, "libzbc does not support trim");
- log_err("%s: libzbc does not support trim\n",
- f->file_name);
- return -EINVAL;
+ log_err("%s: libzbc does not support trim\n", f->file_name);
+ return -EINVAL;
}

- if (td->o.oatomic) {
+ if (td->o.oatomic) {
td_verror(td, EINVAL, "libzbc does not support O_ATOMIC");
- log_err("%s: libzbc does not support O_ATOMIC\n",
- f->file_name);
- return -EINVAL;
- }
+ log_err("%s: libzbc does not support O_ATOMIC\n", f->file_name);
+ return -EINVAL;
+ }

ld = calloc(1, sizeof(*ld));
if (!ld)
@@ -92,15 +90,12 @@ static int libzbc_open_dev(struct thread_data *td, struct fio_file *f,
if (ret) {
log_err("%s: zbc_open() failed, err=%d\n",
f->file_name, ret);
- return ret;
+ goto err;
}

ret = libzbc_get_dev_info(ld, f);
- if (ret) {
- zbc_close(ld->zdev);
- free(ld);
- return ret;
- }
+ if (ret)
+ goto err_close;

td->io_ops_data = ld;
out:
@@ -108,6 +103,12 @@ out:
*p_ld = ld;

return 0;
+
+err_close:
+ zbc_close(ld->zdev);
+err:
+ free(ld);
+ return ret;
}

static int libzbc_close_dev(struct thread_data *td)
diff --git a/t/zbd/test-zbd-support b/t/zbd/test-zbd-support
index de05f438..4001be3b 100755
--- a/t/zbd/test-zbd-support
+++ b/t/zbd/test-zbd-support
@@ -929,20 +929,36 @@ logfile=$0.log

passed=0
failed=0
+if [ -t 1 ]; then
+ red="\e[1;31m"
+ green="\e[1;32m"
+ end="\e[m"
+else
+ red=""
+ green=""
+ end=""
+fi
rc=0
+
+intr=0
+trap 'intr=1' SIGINT
+
for test_number in "${tests[@]}"; do
rm -f "${logfile}.${test_number}"
- echo -n "Running test $test_number ... "
+ echo -n "Running test $(printf "%02d" $test_number) ... "
if eval "test$test_number"; then
status="PASS"
+ cc_status="${green}${status}${end}"
((passed++))
else
status="FAIL"
+ cc_status="${red}${status}${end}"
((failed++))
rc=1
fi
- echo "$status"
+ echo -e "$cc_status"
echo "$status" >> "${logfile}.${test_number}"
+ [ $intr -ne 0 ] && exit 1
done

echo "$passed tests passed"