Changeset 6030

Show
Ignore:
Timestamp:
11/08/12 12:15:04 (7 years ago)
Author:
leonwlaw
Message:

Fix to allow fully parallel runs of the seash unit tests. (#1124)

Location:
seattle/trunk/seash/tests
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • seattle/trunk/seash/tests/nminit_test.mix

    r6020 r6030  
    3535justinpubkey = {'e':22599311712094481841033180665237806588790054310631222126405381271924089573908627143292516781530652411806621379822579071415593657088637116149593337977245852950266439908269276789889378874571884748852746045643368058107460021117918657542413076791486130091963112612854591789518690856746757312472362332259277422867, 'n':12178066700672820207562107598028055819349361776558374610887354870455226150556699526375464863913750313427968362621410763996856543211502978012978982095721782038963923296750730921093699612004441897097001474531375768746287550135361393961995082362503104883364653410631228896653666456463100850609343988203007196015297634940347643303507210312220744678194150286966282701307645064974676316167089003178325518359863344277814551559197474590483044733574329925947570794508677779986459413166439000241765225023677767754555282196241915500996842713511830954353475439209109249856644278745081047029879999022462230957427158692886317487753201883260626152112524674984510719269715422340038620826684431748131325669940064404757120601727362881317222699393408097596981355810257955915922792648825991943804005848347665699744316223963851263851853483335699321871483966176480839293125413057603561724598227617736944260269994111610286827287926594015501020767105358832476708899657514473423153377514660641699383445065369199724043380072146246537039577390659243640710339329506620575034175016766639538091937167987100329247642670588246573895990251211721839517713790413170646177246216366029853604031421932123167115444834908424556992662935981166395451031277981021820123445253} 
    3636 
    37 guest3pubkey = {'e': long(65537), 'n': long(159420595394899537400949198681329092638505562223970630041492566650613675559133948848398454837527027586741170463115880087433828723668317563909634711777466522690752742810681389471120674915435392437226086034664966136941959369232414531366921640883830944854412778097759464095634464467503508739603835394500400421527)} 
    38  
    39 guest2pubkey = {'e': long(65537), 'n': long(110009629964375532963962701865830912129138354201528766010760467199629255182046516295185692273532956885314913863768575205484254675703252086790327783183827881381206633010749246640191078294575544695230811818346523676132173814612789319465950220398588695273283209719157758754182146757097180274601644059681819447519)} 
    40  
    41 guest1pubkey = {'e': long(65537), 'n': long(129937548244295744493411102477927616946054741848922332442364274439380023286218483047949484754803654367393646378952539599237832202610868331544163479242717233271442711492045008411292680806561269759854909005440033040533870009820017255220394656420641812992252056173382552030970799695904852037593330218154892098289)} 
    42  
    43 guest0pubkey = {'e': long(65537), 'n': long(91484590674817532755663795098370573339722747497239669435866367436765128724595658959030848265264866774018061310637097111588068424006389927853504303021941018413903821016870474584346561439321727041093253814709037736885624099032135017587026107594471556005189458221659439288035249681316869154538357634516166379961)} 
     37# Vessels need to have a public key in order to be accessed 
     38print "Generating user keys..." 
     39keylen = 2 ** 10 
     40publickeys = [] 
     41 
     42# Our unit tests need access to 4 guest users, from guest0...guest3 
     43num_guests = 4 
     44 
     45for i in range(num_guests): 
     46  publickey, privatekey = rsa_gen_pubpriv_keys(keylen) 
     47  publickeys.append(publickey) 
     48  # The unit tests need access to these keys 
     49  rsa_publickey_to_file(publickey, 'guest' + str(i) + '.publickey') 
     50  rsa_privatekey_to_file(privatekey, 'guest' + str(i) + '.privatekey') 
     51 
     52( guest0pubkey, 
     53  guest1pubkey, 
     54  guest2pubkey, 
     55  guest3pubkey) = publickeys 
    4456 
    4557 
     
    272284  configuration['ports'] = [<nodemanager_port>, 2888, 9625, 10348, 39303, 48126, 52862, 57344, 64310] 
    273285 
    274   print "Generating key..." 
     286  print "Generating owner key..." 
    275287  keys = rsa_gen_pubpriv_keys(100) 
    276288  configuration['publickey'] = keys[0] 
  • seattle/trunk/seash/tests/ut_seash_loadkeys.py

    r4335 r6030  
    44import seash 
    55import sys 
     6import repyhelper 
    67 
     8repyhelper.translate_and_import('rsa.repy') 
    79 
    810orig_stdout = sys.stdout 
     11 
     12# Prepare the expected results. 
     13 
     14# This list of tuples dictates whether the specified guest has its  
     15# public/private keys loaded. 
     16# Each tuple represents: (guestname, publickey, privatekey) 
     17guest_has_keys = [('guest2', True, True), 
     18                  ('guest0', True, False), 
     19                  ('guest1', False, True)] 
     20 
     21sys.stdout = open("loadkeys_test_results.txt", "w") 
     22 
     23# show keys 
     24# Guestname Publickey/None Privatekey/None 
     25# None is printed only if that key isn't loaded. 
     26# e.g.: 
     27# guest0 {'e': 65537L, 'n': 899L} {'q': 31L, 'p': 29L, 'd': 593L} 
     28# guest1 None {'q': 31L, 'p': 29L, 'd': 593L} 
     29# guest2 {'e': 65537L, 'n': 899L} None 
     30 
     31for (guest, haspublic, hasprivate) in guest_has_keys: 
     32  print guest, 
     33  print rsa_file_to_publickey(guest + ".publickey") if haspublic else None, 
     34  print rsa_file_to_privatekey(guest + ".privatekey") if hasprivate else None 
     35 
     36# show identities 
     37# Same as show keys, except: 
     38#   Keys are replaced by the tokens "PUB" and "PRIV" 
     39#   If a key is not found, it is simply not printed 
     40for (guest, haspublic, hasprivate) in guest_has_keys: 
     41  print guest,  
     42  if haspublic: 
     43    print "PUB",  
     44  if hasprivate: 
     45    print "PRIV", 
     46  print 
     47 
     48sys.stdout.close() 
     49 
     50# Begin testing 
    951sys.stdout = open("test_results.txt", "w") 
    1052command_list = [