~ed.so/duplicity/reuse-passphrase-for-signing-fix

« back to all changes in this revision

Viewing changes to testing/gpgtest2.py

  • Committer: bescoto
  • Date: 2002-10-29 01:49:46 UTC
  • Revision ID: vcs-imports@canonical.com-20021029014946-3m4rmm5plom7pl6q
Initial checkin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import sys, os, time
 
2
sys.path.insert(0, "../src")
 
3
 
 
4
import GnuPGInterface, thread
 
5
 
 
6
def main():
 
7
        gnupg = GnuPGInterface.GnuPG()
 
8
        gnupg.options.meta_interactive = 0
 
9
        gnupg.passphrase = "foobar"
 
10
 
 
11
        p1 = gnupg.run(['--symmetric'], create_fhs=['stdin', 'stdout'])
 
12
        
 
13
        if os.fork() == 0: # child
 
14
                p1.handles['stdin'].write("hello, world!")
 
15
                p1.handles['stdin'].close()
 
16
                os._exit(0)
 
17
        else: # parent
 
18
                p1.handles['stdin'].close()
 
19
                s = p1.handles['stdout'].read()
 
20
                p1.handles['stdout'].close()
 
21
                p1.wait()
 
22
 
 
23
 
 
24
def main2():
 
25
        a = range(500000)
 
26
        thread.start_new_thread(tmp, (a,))
 
27
        tmp(a)
 
28
 
 
29
def tmp(a):
 
30
        for i in range(10):
 
31
                for i in a: pass
 
32
 
 
33
 
 
34
main2()