ref: d724fab92904d3e8279b22f12f3c3bf633ae22ea
parent: d14ed22cd12ebae33cbe33558a216f5a1a1fa6e4
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Feb 22 15:37:28 EST 2018
[tests/ar] Add tests for update
--- /dev/null
+++ b/tests/ar/execute/0032-update.sh
@@ -1,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+trap "rm -f file* $tmp1 $tmp2" 0 2 3
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+
+############################################################################
+#Update one member that already exist
+
+echo First > file1
+
+cp master.a file.a
+ar -rv file.a file1
+
+ar -p file.a file1 > $tmp1
+
+cat <<EOF > $tmp2
+First
+EOF
+
+cmp $tmp1 $tmp2
--- /dev/null
+++ b/tests/ar/execute/0033-update.sh
@@ -1,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+trap "rm -f file* $tmp1 $tmp2" 0 2 3
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+
+############################################################################
+#Update one member that doesn't exist
+
+echo First > file-1
+
+cp master.a file.a
+ar -rv file.a file-1
+
+ar -p file.a file-1 > $tmp1
+
+cat <<EOF > $tmp2
+First
+EOF
+
+cmp $tmp1 $tmp2
--- /dev/null
+++ b/tests/ar/execute/0034-update.sh
@@ -1,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+trap "rm -f file* $tmp1 $tmp2" 0 2 3
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+
+############################################################################
+#Update one member that exists and using -a
+
+echo First > file1
+
+cp master.a file.a
+ar -rv -a file1 file.a file1
+
+ar -p file.a file1 > $tmp1
+
+cat <<EOF > $tmp2
+First
+EOF
+
+cmp $tmp1 $tmp2
+
+ar -t file.a > $tmp1
+
+cat <<EOF > $tmp2
+file1
+file2
+file3
+EOF
+
+cmp $tmp1 $tmp2
--- /dev/null
+++ b/tests/ar/execute/0035-update.sh
@@ -1,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+trap "rm -f file* $tmp1 $tmp2" 0 2 3
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+
+############################################################################
+#Update one member that exists and using -b
+
+echo First > file1
+
+cp master.a file.a
+ar -rv -b file1 file.a file1
+
+ar -p file.a file1 > $tmp1
+
+cat <<EOF > $tmp2
+First
+EOF
+
+cmp $tmp1 $tmp2
+
+ar -t file.a > $tmp1
+
+cat <<EOF > $tmp2
+file1
+file2
+file3
+EOF
+
+cmp $tmp1 $tmp2
--- /dev/null
+++ b/tests/ar/execute/0036-update.sh
@@ -1,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+trap "rm -f file* $tmp1 $tmp2" 0 2 3
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+
+############################################################################
+#Update one member that doesn't exist and using -b
+
+echo First > file-1
+
+cp master.a file.a
+ar -rv -b file1 file.a file-1
+
+ar -p file.a file-1 > $tmp1
+
+cat <<EOF > $tmp2
+First
+EOF
+
+cmp $tmp1 $tmp2
+
+ar -t file.a > $tmp1
+
+cat <<EOF > $tmp2
+file-1
+file1
+file2
+file3
+EOF
+
+cmp $tmp1 $tmp2
--- /dev/null
+++ b/tests/ar/execute/0037-update.sh
@@ -1,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+trap "rm -f file* $tmp1 $tmp2" 0 2 3
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+
+############################################################################
+#Update one member that doesn't exist and using -a
+
+echo First > file-1
+
+cp master.a file.a
+ar -rv -a file1 file.a file-1
+
+ar -p file.a file-1 > $tmp1
+
+cat <<EOF > $tmp2
+First
+EOF
+
+cmp $tmp1 $tmp2
+
+ar -t file.a > $tmp1
+
+cat <<EOF > $tmp2
+file1
+file-1
+file2
+file3
+EOF
+
+cmp $tmp1 $tmp2
--- /dev/null
+++ b/tests/ar/execute/0038-update.sh
@@ -1,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+#trap "rm -f file* $tmp1 $tmp2" 0 2 3
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+
+############################################################################
+#Update without parameters
+
+cp master.a file.a
+ar -rv file.a
+
+ar -t file.a > $tmp1
+
+cat <<EOF > $tmp2
+file1
+file2
+file3
+EOF
+
+cmp $tmp1 $tmp2