scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 8f98c55af9048f83db4d2ea523078639732617c3
parent b4da40396c2e3ff08eb19e52055cf220a4dfdcdb
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 22 Feb 2018 20:37:28 +0000

[tests/ar] Add tests for update

Diffstat:
Atests/ar/execute/0032-update.sh | 24++++++++++++++++++++++++
Atests/ar/execute/0033-update.sh | 24++++++++++++++++++++++++
Atests/ar/execute/0034-update.sh | 34++++++++++++++++++++++++++++++++++
Atests/ar/execute/0035-update.sh | 34++++++++++++++++++++++++++++++++++
Atests/ar/execute/0036-update.sh | 35+++++++++++++++++++++++++++++++++++
Atests/ar/execute/0037-update.sh | 35+++++++++++++++++++++++++++++++++++
Atests/ar/execute/0038-update.sh | 24++++++++++++++++++++++++
7 files changed, 210 insertions(+), 0 deletions(-)

diff --git a/tests/ar/execute/0032-update.sh b/tests/ar/execute/0032-update.sh @@ -0,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 diff --git a/tests/ar/execute/0033-update.sh b/tests/ar/execute/0033-update.sh @@ -0,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 diff --git a/tests/ar/execute/0034-update.sh b/tests/ar/execute/0034-update.sh @@ -0,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 diff --git a/tests/ar/execute/0035-update.sh b/tests/ar/execute/0035-update.sh @@ -0,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 diff --git a/tests/ar/execute/0036-update.sh b/tests/ar/execute/0036-update.sh @@ -0,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 diff --git a/tests/ar/execute/0037-update.sh b/tests/ar/execute/0037-update.sh @@ -0,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 diff --git a/tests/ar/execute/0038-update.sh b/tests/ar/execute/0038-update.sh @@ -0,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