~ubuntu-branches/ubuntu/karmic/gnupg2/karmic-updates

« back to all changes in this revision

Viewing changes to tests/openpgp/defs.inc

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Definitions for the OpenPGP test scripts                     -*- sh -*-
 
2
# Copyright 1998,1999,2000,2001,2002,2003,2004,2005,2006,
 
3
#           2007 Free Software Foundation, Inc.
 
4
# This file is free software; as a special exception the author gives
 
5
# unlimited permission to copy and/or distribute it, with or without
 
6
# modifications, as long as this notice is preserved.  This file is
 
7
# distributed in the hope that it will be useful, but WITHOUT ANY
 
8
# WARRANTY, to the extent permitted by law; without even the implied
 
9
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
10
 
 
11
#--------------------------------
 
12
#------ constants ---------------
 
13
#--------------------------------
 
14
 
 
15
# Note that usrpass1 is also used in Makefile.am
 
16
usrname1="one"
 
17
usrpass1="def"
 
18
usrname2="two"
 
19
usrpass2=""
 
20
usrname3="three"
 
21
usrpass3=""
 
22
 
 
23
 
 
24
dsa_usrname1="pgp5"
 
25
# we use the sub key because we do not yet have the logic to
 
26
# to derive the first encryption key from a keyblock (I guess)
 
27
dsa_usrname2="0xCB879DE9"
 
28
 
 
29
dsa_keyrings="--keyring ./pubring.pkr --secret-keyring ./secring.skr"
 
30
 
 
31
 
 
32
plain_files="plain-1 plain-2 plain-3"
 
33
data_files="data-500 data-9000 data-32000 data-80000"
 
34
exp_files=""
 
35
 
 
36
# The testscripts expect the original language
 
37
LANG=
 
38
LANGUAGE=
 
39
LC_ALL=
 
40
LC_MESSAGES=
 
41
 
 
42
# Internal use.
 
43
defs_stop_on_error=no
 
44
defs_error_seen=no
 
45
 
 
46
#--------------------------------
 
47
#------ utility functions -------
 
48
#--------------------------------
 
49
 
 
50
fatal () {
 
51
    echo "$pgmname: fatal:" $* >&2
 
52
    echo "$pgmname: fatal:" $* >&5
 
53
    exit 1;
 
54
}
 
55
 
 
56
error () {
 
57
    echo "$pgmname:" $* >&2
 
58
    defs_error_seen=yes
 
59
    echo "$pgmname:" $* >&5
 
60
    if [ x$defs_stop_on_error != xyes ]; then
 
61
      exit 1 
 
62
    fi
 
63
}
 
64
 
 
65
# Call this at the start of a test and resume_error at the end to keep
 
66
# on running all subtests without immediately exiting on error.
 
67
suspend_error () {
 
68
   defs_stop_on_error=yes
 
69
}
 
70
 
 
71
resume_error () {
 
72
    if [ x$defs_error_seen = xyes ]; then
 
73
        exit 1
 
74
    fi
 
75
    defs_stop_on_error=no
 
76
    defs_error_seen=no
 
77
}
 
78
 
 
79
info () {
 
80
    echo "$pgmname:" $* >&2
 
81
    if [ -n "${verbose+set}" ]; then
 
82
      echo "$pgmname:" $* >&5
 
83
    fi
 
84
}
 
85
 
 
86
linefeed () {
 
87
    echo >&2
 
88
}
 
89
 
 
90
 
 
91
echo_n_init=no
 
92
echo_n () {
 
93
  if test "$echo_n_init" = "no"; then
 
94
    if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
 
95
      if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
 
96
        echo_n_n=
 
97
        echo_n_c='
 
98
'
 
99
      else
 
100
        echo_n_n='-n'
 
101
        echo_n_c=
 
102
      fi
 
103
    else
 
104
      echo_n_n=
 
105
      echo_n_c='\c'
 
106
    fi
 
107
    echo_n_init=yes
 
108
  fi
 
109
  echo $echo_n_n "${1}$echo_n_c"
 
110
}
 
111
 
 
112
 
 
113
#cleanup () {
 
114
#    rm $cleanup_files 2>/dev/null || true
 
115
#    echo "#empty" >./gpg.conf
 
116
#}
 
117
 
 
118
 
 
119
#add_cleanup () {
 
120
#    cleanup_files="$cleanup_files $*"
 
121
#}
 
122
 
 
123
have_pubkey_algo () {
 
124
  if  ../../g10/gpg2 --homedir .  --version | grep "Pubkey:.*$1" >/dev/null
 
125
  then
 
126
        true
 
127
  else
 
128
        false
 
129
  fi
 
130
}
 
131
 
 
132
have_cipher_algo () {
 
133
  if  ../../g10/gpg2 --homedir .  --version | grep "Cipher:.*$1" >/dev/null
 
134
  then
 
135
        true
 
136
  else
 
137
        false
 
138
  fi
 
139
}
 
140
 
 
141
have_hash_algo () {
 
142
  if  ../../g10/gpg2 --homedir .  --version | grep "Hash:.*$1" >/dev/null
 
143
  then
 
144
        true
 
145
  else
 
146
        false
 
147
  fi
 
148
}
 
149
 
 
150
all_cipher_algos () {
 
151
  ../../g10/gpg2 --homedir . --version | grep "Cipher" | sed 's/^Cipher: //; s/,//g'
 
152
}
 
153
 
 
154
all_hash_algos () {
 
155
  ../../g10/gpg2 --homedir . --version | grep "Hash" | sed 's/^Hash: //; s/,//g'
 
156
}
 
157
 
 
158
 
 
159
set -e
 
160
pgmname=`basename $0`
 
161
#trap cleanup SIGHUP SIGINT SIGQUIT
 
162
 
 
163
[ -z "$srcdir" ] && fatal "not called from make"
 
164
 
 
165
# Make sure we have a valid option files even with VPATH builds.
 
166
if [ -f ./gpg.conf ]; then
 
167
  :
 
168
elif [ -f $srcdir/gpg.conf.tmpl ]; then
 
169
  cat $srcdir/gpg.conf.tmpl >gpg.conf
 
170
fi
 
171
 
 
172
GPG="../../g10/gpg2 --no-permission-warning --homedir . "
 
173
 
 
174
exec 5>&2 2>${pgmname}.log
 
175
 
 
176
:
 
177
# end