* [LTP] [PATCH] mv/mv_tests.sh: Add test02 to test "mv -b"
@ 2015-04-09 12:11 Cui Bixuan
2015-04-10 14:01 ` Alexey Kodanev
0 siblings, 1 reply; 4+ messages in thread
From: Cui Bixuan @ 2015-04-09 12:11 UTC (permalink / raw)
To: ltp-list; +Cc: , huawei.com.zhuyanpeng, zhanyongming
Add test02 to test "mv -b".
Run it in ubuntu 12.02:
<<<test_start>>>
tag=mv_tests01 stime=1428322533
cmdline="mv_tests.sh"
contacts=""
analysis=exit
<<<test_output>>>
incrementing stop
mv 0 TINFO : INIT: Inititalizing tests.
mv01 0 TINFO : Test #1: mv <dir1> <dir2> will move dir1 to dir2 and all its contents
mv01 0 TINFO : Test #1: Creating 10 directories.
mv01 0 TINFO : Test #1: filling each dir with 10 files.
mv01 0 TINFO : Test #1: creating output file
mv01 0 TINFO : Test #1: creating expected output file
mv01 0 TINFO : Test #1: comparing expected out and actual output file
mv01 0 TINFO : Test #1: expected same as actual
mv01 1 TPASS : Test #1: mv success
mv 0 TINFO : INIT: Inititalizing tests.
mv02 0 TINFO : Test #2: mv -b <file1> <file2> will move dir1 to dir2 and backup the file2
mv02 1 TPASS : Test #2: mv -b success
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=0 corefile=no
cutime=1 cstime=8
<<<test_end>>>
---
.../commands/fileutils/mv/00_Descriptions.txt | 3 +-
testcases/commands/fileutils/mv/mv_tests.sh | 82 +++++++++++++++++++-
2 files changed, 83 insertions(+), 2 deletions(-)
diff --git a/testcases/commands/fileutils/mv/00_Descriptions.txt b/testcases/commands/fileutils/mv/00_Descriptions.txt
index 6d52868..57199bf 100644
--- a/testcases/commands/fileutils/mv/00_Descriptions.txt
+++ b/testcases/commands/fileutils/mv/00_Descriptions.txt
@@ -1,3 +1,4 @@
test01
mv <dir1> <dir2> will move dir1 to dir2 and all its contents.
-
+test02
+ mv -b <file1> <file2> will move file1 to file2 and backup the file2.
diff --git a/testcases/commands/fileutils/mv/mv_tests.sh b/testcases/commands/fileutils/mv/mv_tests.sh
index 207e945..80f7507 100755
--- a/testcases/commands/fileutils/mv/mv_tests.sh
+++ b/testcases/commands/fileutils/mv/mv_tests.sh
@@ -24,7 +24,8 @@
# Description: Test basic functionality of mv command
# - Test #1: mv <dir1> <dir2> will move dir1 to dir2 and all its
# contents.
-#
+# - Test #2: mv -b <file1> <file2> will move file1 to file2 and
+# backup the file2.
# Author: Manoj Iyer, manjo@mail.utexas.edu
#
# History: Feb 03 2003 - Created - Manoj Iyer.
@@ -238,6 +239,76 @@ test01()
return $RC
}
+# Function: test02
+#
+# Description - Test #2: Test that mv -b <file1> <file2> will move
+# file1 to file2 and backup the file2.
+# - create file1 and file2.
+# - get the MD5 message of file2.
+# - mv -b dir1 to dir2
+# - get the MD5 message of backup file2.
+# - compare with MD5 messages.
+#
+# Return - zero on success
+# - non zero on failure. return value from commands ($RC)
+
+test02()
+{
+ RC=0 # Return value from commands.
+ export TCID=mv02 # Name of the test case.
+ export TST_COUNT=1 # Test number.
+
+ tmpfile1=$LTPTMP/tst_mv.tmp/tmpfile1
+ tmpfile2=$LTPTMP/tst_mv.tmp/tmpfile2
+ backup_tmpfile2=$LTPTMP/tst_mv.tmp/tmpfile2~
+
+ $LTPBIN/tst_resm TINFO \
+ "Test #2: mv -b <file1> <file2> will move dir1 to dir2 and backup the file2"
+
+ touch $tmpfile1 $tmpfile2 > $LTPTMP/tst_mv.err 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_mv.err NULL \
+ "Test #2: can not touch file1 and file2. Reason:"
+ return $RC
+ fi
+
+ MD5_old=`md5sum $tmpfile2 |awk '{print $1}'` > $LTPTMP/tst_mv.err 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_mv.err NULL \
+ "Test #2: can not get the MD5 message of file2. Reason:"
+ return $RC
+ fi
+
+ mv -b $tmpfile1 $tmpfile2 > $LTPTMP/tst_mv.err 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_mv.err NULL \
+ "Test #2: mv -b file1 file2 failed. Reason:"
+ return $RC
+ fi
+
+ # if mv -b file1 file2 succeed,there will be "file2~" file
+
+ MD5_backup=`md5sum $tmpfile2 |awk '{print $1}'` > $LTPTMP/tst_mv.err 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_mv.err NULL \
+ "Test #2: can not get the MD5 message of backup file2. Reason:"
+ return $RC
+ fi
+
+ if [ "$MD5_old" != "$MD5_backup" ]
+ then
+ $LTPBIN/tst_resm TFAIL "Test #2: the MD5 number of file2 is not equal to MD5 number of backup file2"
+ return $(($RC+1))
+ else
+ $LTPBIN/tst_resm TPASS "Test #2: mv -b success"
+ fi
+
+ return $RC
+}
# Function: main
#
@@ -258,6 +329,15 @@ then
TFAILCNT=$(($TFAILCNT+1))
fi
+rm -fr $LTPTMP/tst_mv.*
+
+init || return $RC # Exit if initializing testcases fails.
+
+test02 || RC=$?
+if [ $RC -ne 0 ]
+then
+ TFAILCNT=$(($TFAILCNT+1))
+fi
rm -fr $LTPTMP/tst_mv.*
--
1.6.0.2
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] mv/mv_tests.sh: Add test02 to test "mv -b"
2015-04-09 12:11 [LTP] [PATCH] mv/mv_tests.sh: Add test02 to test "mv -b" Cui Bixuan
@ 2015-04-10 14:01 ` Alexey Kodanev
2015-04-14 12:25 ` Cui Bixuan
2015-04-15 11:37 ` [LTP] [PATCH v2] mv/mv_tests.sh: Add test02 to test 'mv -b' Cui Bixuan
0 siblings, 2 replies; 4+ messages in thread
From: Alexey Kodanev @ 2015-04-10 14:01 UTC (permalink / raw)
To: Cui Bixuan; +Cc: ltp-list, zhanyongming, huawei.com.zhuyanpeng
Hi!
On 04/09/2015 03:11 PM, Cui Bixuan wrote:
> Add test02 to test "mv -b".
> Run it in ubuntu 12.02:
>
> <<<test_start>>>
> tag=mv_tests01 stime=1428322533
> cmdline="mv_tests.sh"
> contacts=""
> analysis=exit
> <<<test_output>>>
> incrementing stop
> mv 0 TINFO : INIT: Inititalizing tests.
> mv01 0 TINFO : Test #1: mv <dir1> <dir2> will move dir1 to dir2 and all its contents
> mv01 0 TINFO : Test #1: Creating 10 directories.
> mv01 0 TINFO : Test #1: filling each dir with 10 files.
> mv01 0 TINFO : Test #1: creating output file
> mv01 0 TINFO : Test #1: creating expected output file
> mv01 0 TINFO : Test #1: comparing expected out and actual output file
> mv01 0 TINFO : Test #1: expected same as actual
> mv01 1 TPASS : Test #1: mv success
> mv 0 TINFO : INIT: Inititalizing tests.
> mv02 0 TINFO : Test #2: mv -b <file1> <file2> will move dir1 to dir2 and backup the file2
> mv02 1 TPASS : Test #2: mv -b success
> <<<execution_status>>>
> initiation_status="ok"
> duration=0 termination_type=exited termination_id=0 corefile=no
> cutime=1 cstime=8
> <<<test_end>>>
It's not a good idea to include test output in the commit message. IMHO,
there should be a general description of the new test-case. Also, please
check the patch with 'checkpatch.pl' script, fix warnings and errors,
then resend.
Thanks,
Alexey
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] mv/mv_tests.sh: Add test02 to test "mv -b"
2015-04-10 14:01 ` Alexey Kodanev
@ 2015-04-14 12:25 ` Cui Bixuan
2015-04-15 11:37 ` [LTP] [PATCH v2] mv/mv_tests.sh: Add test02 to test 'mv -b' Cui Bixuan
1 sibling, 0 replies; 4+ messages in thread
From: Cui Bixuan @ 2015-04-14 12:25 UTC (permalink / raw)
To: Alexey Kodanev; +Cc: ltp-list, zhanyongming, huawei.com.zhuyanpeng
Hi!
Thank you for your advice, I will check it.
Thanks,
Cui bixuan
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH v2] mv/mv_tests.sh: Add test02 to test 'mv -b'
2015-04-10 14:01 ` Alexey Kodanev
2015-04-14 12:25 ` Cui Bixuan
@ 2015-04-15 11:37 ` Cui Bixuan
1 sibling, 0 replies; 4+ messages in thread
From: Cui Bixuan @ 2015-04-15 11:37 UTC (permalink / raw)
To: Alexey Kodanev; +Cc: zhuyanpeng, ltp-list, zhanyongming
Add a new case to test 'mv -b':
* Create file1 and file2
* Mv -b file1 to file2
* Check backup file of file2
Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
.../commands/fileutils/mv/00_Descriptions.txt | 3 +-
testcases/commands/fileutils/mv/mv_tests.sh | 84 ++++++++++++++++++++
2 files changed, 86 insertions(+), 1 deletions(-)
diff --git a/testcases/commands/fileutils/mv/00_Descriptions.txt b/testcases/commands/fileutils/mv/00_Descriptions.txt
index 6d52868..57199bf 100644
--- a/testcases/commands/fileutils/mv/00_Descriptions.txt
+++ b/testcases/commands/fileutils/mv/00_Descriptions.txt
@@ -1,3 +1,4 @@
test01
mv <dir1> <dir2> will move dir1 to dir2 and all its contents.
-
+test02
+ mv -b <file1> <file2> will move file1 to file2 and backup the file2.
diff --git a/testcases/commands/fileutils/mv/mv_tests.sh b/testcases/commands/fileutils/mv/mv_tests.sh
index 207e945..cda9901 100755
--- a/testcases/commands/fileutils/mv/mv_tests.sh
+++ b/testcases/commands/fileutils/mv/mv_tests.sh
@@ -24,6 +24,8 @@
# Description: Test basic functionality of mv command
# - Test #1: mv <dir1> <dir2> will move dir1 to dir2 and all its
# contents.
+# - Test #2: mv -b <file1> <file2> will move file1 to file2 and
+# backup the file2.
#
# Author: Manoj Iyer, manjo@mail.utexas.edu
#
@@ -238,6 +240,79 @@ test01()
return $RC
}
+# Function: test02
+#
+# Description - Test #2: Test that mv -b <file1> <file2> will move
+# file1 to file2 and backup the file2.
+# - create file1 and file2.
+# - get the MD5 message of file2.
+# - mv -b file1 to file2
+# - get the MD5 message of backup file2.
+# - compare with MD5 messages.
+#
+# Return - zero on success
+# - non zero on failure. return value from commands ($RC)
+
+test02()
+{
+ RC=0 # Return value from commands.
+ export TCID=mv02 # Name of the test case.
+ export TST_COUNT=1 # Test number.
+
+ tmpfile1=$LTPTMP/tst_mv.tmp/tmpfile1
+ tmpfile2=$LTPTMP/tst_mv.tmp/tmpfile2
+ backup_tmpfile2=$LTPTMP/tst_mv.tmp/tmpfile2~
+
+ $LTPBIN/tst_resm TINFO \
+ "Test #2: mv -b <file1> <file2> will move dir1 to dir2"
+
+ touch $tmpfile1 $tmpfile2 > $LTPTMP/tst_mv.err 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_mv.err NULL \
+ "Test #2: can not touch file1 and file2. Reason:"
+ return $RC
+ fi
+
+ MD5_old=`md5sum $tmpfile2 |awk '{print $1}'` > $LTPTMP/tst_mv.err \
+ 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_mv.err NULL \
+ "Test #2: can't get the MD5 message of file2. Reason:"
+ return $RC
+ fi
+
+ mv -b $tmpfile1 $tmpfile2 > $LTPTMP/tst_mv.err 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_mv.err NULL \
+ "Test #2: mv -b file1 file2 failed. Reason:"
+ return $RC
+ fi
+
+ # if mv -b file1 file2 succeed,there will be "file2~" file
+
+ MD5_backup=`md5sum $tmpfile2 |awk '{print $1}'` > $LTPTMP/tst_mv.err \
+ 2>&1 || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_mv.err NULL \
+ "Test #2: can not get the MD5 message of backup file2. Reason:"
+ return $RC
+ fi
+
+ if [ "$MD5_old" != "$MD5_backup" ]
+ then
+ $LTPBIN/tst_resm TFAIL \
+ "Test #2: mv -b failed"
+ return $(($RC+1))
+ else
+ $LTPBIN/tst_resm TPASS "Test #2: mv -b success"
+ fi
+
+ return $RC
+}
# Function: main
#
@@ -258,6 +333,15 @@ then
TFAILCNT=$(($TFAILCNT+1))
fi
+rm -fr $LTPTMP/tst_mv.*
+
+init || return $RC # Exit if initializing testcases fails.
+
+test02 || RC=$?
+if [ $RC -ne 0 ]
+then
+ TFAILCNT=$(($TFAILCNT+1))
+fi
rm -fr $LTPTMP/tst_mv.*
--
1.6.0.2
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-04-15 11:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-09 12:11 [LTP] [PATCH] mv/mv_tests.sh: Add test02 to test "mv -b" Cui Bixuan
2015-04-10 14:01 ` Alexey Kodanev
2015-04-14 12:25 ` Cui Bixuan
2015-04-15 11:37 ` [LTP] [PATCH v2] mv/mv_tests.sh: Add test02 to test 'mv -b' Cui Bixuan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.