From: Radosław Korzeniewski Date: Tue, 22 Dec 2020 14:58:23 +0000 (+0100) Subject: regress: Add long filename metaplugin tests. X-Git-Tag: Release-11.3.2~739 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=189b3aa551786b6e9c8489e66ab251e4dba8747c;p=thirdparty%2Fbacula.git regress: Add long filename metaplugin tests. --- diff --git a/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c b/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c index e2856fe34..9b3156433 100644 --- a/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c +++ b/bacula/src/plugins/fd/pluginlib/test_metaplugin_backend.c @@ -16,13 +16,12 @@ */ /* * File: test_rhv_backend.c - * Author: radekk + * Author: radekk, radoslaw@korzeniewski.net * * Copyright (c) 2017 by Inteos sp. z o.o. * All rights reserved. IP transferred to Bacula Systems according to agreement. * This is a dumb and extremely simple backend simulator used for test swift Plugin. * - * Created on 18 September 2017, 13:13 */ #include @@ -363,6 +362,30 @@ void perform_backup() write_plugin('W', "Make some warning messages."); signal_eod(); + const char longfilenamestr[] = + "cb1e1926239b467c8e9affd7d22cea4993940d1e8f5377a1540d2b58e10be5669888c7e729fc9fe98f1400ca2e68c93075fd26e2806bebd727c71022de47f37b" + "cb1e1926239b467c8e9affd7d22cea4993940d1e8f5377a1540d2b58e10be5669888c7e729fc9fe98f1400ca2e68c93075fd26e2806bebd727c71022de47f37b" + "cb1e1926239b467c8e9affd7d22cea4993940d1e8f5377a1540d2b58e10be5669888c7e729fc9fe98f1400ca2e68c93075fd26e2806bebd727c71022de47f37b" + "cb1e1926239b467c8e9affd7d22cea4993940d1e8f5377a1540d2b58e10be5669888c7e729fc9fe98f1400ca2e68c93075fd26e2806bebd727c71022de47f37b" + "ENDOFNAME"; + const char *longfilename = longfilenamestr; + + // test for fname > 500c + static_assert(sizeof(longfilenamestr) > 500); + snprintf(buf, BIGBUFLEN, "FNAME:%s/%s\n", PLUGINPREFIX, longfilename); + write_plugin('C', buf); + write_plugin('C', "STAT:F 234560 901 901 0100640 1\n"); + write_plugin('C', "TSTAMP:1504271937 1504271937 1504271937\n"); + signal_eod(); + write_plugin('I', "TEST13 - long FNAME test"); + write_plugin('C', "DATA\n"); + write_plugin('D', "/* here comes a file data contents */"); + write_plugin('D', "/* here comes another file line */"); + write_plugin('D', "/* here comes another file line */"); + write_plugin('D', "/* here comes another file line */"); + write_plugin('D', "/* here comes another file line */"); + signal_eod(); + /* this is the end of all data */ signal_eod(); } diff --git a/regress/scripts/metaplugin-protocol-tests.sh b/regress/scripts/metaplugin-protocol-tests.sh index 705147388..b7358c9a3 100755 --- a/regress/scripts/metaplugin-protocol-tests.sh +++ b/regress/scripts/metaplugin-protocol-tests.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Copyright (C) 2020 Radosław Korzeniewski # License: BSD 2-Clause; see file LICENSE-FOSS @@ -180,75 +180,83 @@ done stop_bacula -RET=`grep "jobstatus:" ${cwd}/tmp/log1.out | awk '{print $2}'` -BFILE1=`grep "$Plugin/bucket" ${cwd}/tmp/log1.out | grep vm2.iso | wc -l` -BFILE2=`grep "$Plugin/bucket" ${cwd}/tmp/log1.out | grep SHELL | wc -l` -BFILE3=`grep "$Plugin/bucket" ${cwd}/tmp/log1.out | grep lockfile | wc -l` -BFILE4=`grep "$Plugin/bucket" ${cwd}/tmp/log1.out | grep file.xattr | wc -l` -BFILE5=`grep "$Plugin/bucket" ${cwd}/tmp/log1.out | grep vmsnap.iso | wc -l` -BEND=`grep -w "TESTEND" ${cwd}/tmp/log1.out | wc -l` -if [ "x$RET" != "xT" -o $BFILE1 -ne 1 -o $BFILE2 -ne 1 -o $BFILE3 -ne 1 -o $BFILE4 -ne 1 -o $BFILE5 -ne 1 -o $BEND -ne 1 ] +RET=$(grep "jobstatus:" ${cwd}/tmp/log1.out | awk '{print $2}') +BFILE1=$(grep "$Plugin/bucket" ${cwd}/tmp/log1.out | grep -c vm2.iso) +BFILE2=$(grep "$Plugin/bucket" ${cwd}/tmp/log1.out | grep -c SHELL) +BFILE3=$(grep "$Plugin/bucket" ${cwd}/tmp/log1.out | grep -c lockfile) +BFILE4=$(grep "$Plugin/bucket" ${cwd}/tmp/log1.out | grep -c file.xattr) +BFILE5=$(grep "$Plugin/bucket" ${cwd}/tmp/log1.out | grep -c vmsnap.iso) +BEND=$(grep -w -c "TESTEND" ${cwd}/tmp/log1.out) +if [ "x$RET" != "xT" -o "$BFILE1" -ne 1 -o "$BFILE2" -ne 1 -o "$BFILE3" -ne 1 -o $BFILE4 -ne 1 -o $BFILE5 -ne 1 -o $BEND -ne 1 ] then echo "log1" $RET $BFILE1 $BFILE2 $BFILE3 $BFILE4 $BFILE5 $BEND bstat=1 fi -RET=`grep "objectid:" ${cwd}/tmp/log2.out | wc -l` -if [ $RET -ne 1 ] +# test long fname +ENDOFNAME=$(grep -c ENDOFNAME ${cwd}/tmp/log1.out) +if [ "$ENDOFNAME" -lt 1 ] then - echo "log2" $RET + echo "ENDOFNAME" "$ENDOFNAME" bstat=$((bstat+2)) fi -RET=`grep "jobstatus:" ${cwd}/tmp/log5.out | awk '{print $2}'` -BFILE1=`grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep vm2.iso | wc -l` -BFILE2=`grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep SHELL | wc -l` -BFILE3=`grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep lockfile | wc -l` -BFILE4=`grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep file.xattr | wc -l` -BFILE5=`grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep vmsnap.iso | wc -l` -BFILE6=`grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep vm222-other-file.iso | wc -l` -BEND=`grep -w "TESTEND" ${cwd}/tmp/log5.out | wc -l` -if [ "x$RET" != "xT" -o $BFILE1 -ne 2 -o $BFILE2 -ne 2 -o $BFILE3 -ne 2 -o $BFILE4 -ne 2 -o $BFILE5 -ne 2 -o $BFILE6 -ne 1 -o $BEND -ne 2 ] +RET=$(grep -c "objectid:" ${cwd}/tmp/log2.out) +if [ "$RET" -ne 1 ] then - echo "log5" $RET $BFILE1 $BFILE2 $BFILE3 $BFILE4 $BFILE5 $BFILE6 $BEND + echo "log2" "$RET" bstat=$((bstat+4)) fi -RET=`grep "jobstatus:" ${cwd}/tmp/log6.out | awk '{print $2}'` -COMME=`grep COMM_STDERR ${cwd}/tmp/log6.out | wc -l` -BEND=`grep -w "TESTEND" ${cwd}/tmp/log6.out | wc -l` -if [ "x$RET" != "xT" -o $COMME -ne 1 -o $BEND -ne 1 ] +RET=$(grep "jobstatus:" ${cwd}/tmp/log5.out | awk '{print $2}') +BFILE1=$(grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep -c vm2.iso) +BFILE2=$(grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep -c SHELL) +BFILE3=$(grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep -c lockfile) +BFILE4=$(grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep -c file.xattr) +BFILE5=$(grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep -c vmsnap.iso) +BFILE6=$(grep "$Plugin/bucket" ${cwd}/tmp/log5.out | grep -c vm222-other-file.iso) +BEND=$(grep -w -c "TESTEND" ${cwd}/tmp/log5.out) +if [ "x$RET" != "xT" -o $BFILE1 -ne 2 -o $BFILE2 -ne 2 -o $BFILE3 -ne 2 -o $BFILE4 -ne 2 -o $BFILE5 -ne 2 -o $BFILE6 -ne 1 -o $BEND -ne 2 ] then - echo "log6" $RET $COMME $BEND + echo "log5" "$RET" "$BFILE1" "$BFILE2" "$BFILE3" "$BFILE4" "$BFILE5" "$BFILE6" "$BEND" bstat=$((bstat+8)) fi -EFILE1=`grep vm1.iso ${cwd}/tmp/log3.out | wc -l` -EFILE2=`grep vm2.iso ${cwd}/tmp/log3.out | wc -l` -EFILE3=`grep lockfile ${cwd}/tmp/log3.out | wc -l` -EFILE4=`grep vmsnap.iso ${cwd}/tmp/log3.out | wc -l` -if [ $EFILE1 -ne 2 -o $EFILE2 -ne 1 -o $EFILE3 -ne 1 -o $EFILE4 -ne 1 ] +RET=$(grep "jobstatus:" ${cwd}/tmp/log6.out | awk '{print $2}') +COMME=$(grep -c COMM_STDERR ${cwd}/tmp/log6.out) +BEND=$(grep -w -c "TESTEND" ${cwd}/tmp/log6.out) +if [ "x$RET" != "xT" -o "$COMME" -ne 1 -o "$BEND" -ne 1 ] +then + echo "log6" "$RET" "$COMME" "$BEND" + bstat=$((bstat+16)) +fi + +EFILE1=$(grep -c vm1.iso ${cwd}/tmp/log3.out) +EFILE2=$(grep -c vm2.iso ${cwd}/tmp/log3.out) +EFILE3=$(grep -c lockfile ${cwd}/tmp/log3.out) +EFILE4=$(grep -c vmsnap.iso ${cwd}/tmp/log3.out) +if [ "$EFILE1" -ne 2 -o "$EFILE2" -ne 1 -o "$EFILE3" -ne 1 -o "$EFILE4" -ne 1 ] then - echo "log3" $EFILE1 $EFILE2 $EFILE3 + echo "log3" "$EFILE1" "$EFILE2" "$EFILE3" estat=1 fi -LFILE1=`grep "drwxr-xr-x" ${cwd}/tmp/llog1.out | grep containers | wc -l` -LFILE2=`grep "drwxr-xr-x" ${cwd}/tmp/llog2.out | grep bucket | wc -l` -LFILE3=`grep "rw-r-----" ${cwd}/tmp/llog3.out | grep bucket | wc -l` -LFILE4=`grep "rw-r-----" ${cwd}/tmp/llog4.out | grep vm2.iso | wc -l` -LFILE5=`grep "lrwxrwxrwx" ${cwd}/tmp/llog4.out | grep vmsnap.iso | wc -l` -if [ $LFILE1 -ne 1 -o $LFILE2 -ne 2 -o $LFILE3 -ne 2 -o $LFILE4 -ne 1 -o $LFILE5 -ne 1 ] +LFILE1=$(grep "drwxr-xr-x" ${cwd}/tmp/llog1.out | grep -c containers) +LFILE2=$(grep "drwxr-xr-x" ${cwd}/tmp/llog2.out | grep -c bucket) +LFILE3=$(grep "rw-r-----" ${cwd}/tmp/llog3.out | grep -c bucket) +LFILE4=$(grep "rw-r-----" ${cwd}/tmp/llog4.out | grep -c vm2.iso) +LFILE5=$(grep "lrwxrwxrwx" ${cwd}/tmp/llog4.out | grep -c vmsnap.iso) +if [ "$LFILE1" -ne 1 -o "$LFILE2" -ne 2 -o "$LFILE3" -ne 2 -o "$LFILE4" -ne 1 -o "$LFILE5" -ne 1 ] then - echo "llog1" $LFILE1 $LFILE2 $LFILE3 $LFILE4 $LFILE5 + echo "llog1" "$LFILE1" "$LFILE2" "$LFILE3" "$LFILE4" "$LFILE5" dstat=1 fi -REND=`grep -w "TESTEND" ${cwd}/tmp/log4.out | wc -l` -RET=`grep "jobstatus:" ${cwd}/tmp/log4.out | awk '{print $2}'` -if [ "x$RET" != "xT" -o $REND -ne 1 ] +RET=$(grep "jobstatus:" ${cwd}/tmp/log4.out | awk '{print $2}') +REND=$(grep -w -c "TESTEND" ${cwd}/tmp/log4.out) +if [ "x$RET" != "xT" -o "$REND" -ne 1 ] then - echo "log4" $RET $REND + echo "log4" "$RET" "$REND" rstat=1 fi