Changeset 262 for test


Ignore:
Timestamp:
06/17/11 13:51:31 (14 years ago)
Author:
tim
Message:

changed regfi_conv_charset to handle memory allocation
tweaked test cases
corrected some documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/pyregfi-smoketest.py

    r255 r262  
    6565        path = getCurrentPath(k)
    6666        try:
     67            print(repr(path))
    6768            hive_iter = hive.subtree(path)
    6869            if hive_iter.current_key() != k:
     
    174175                ssk = hive_iter.find_subkey(sk.name)
    175176                if ssk != None:
    176                     sk_stat += len(ssk.name)
     177                    if ssk.name != None:
     178                        sk_stat += len(ssk.name)
    177179                else:
    178180                    print("WARNING: ssk was None")
     
    183185                vv = hive_iter.find_value(v.name)
    184186                if vv != None:
    185                     v_stat += len(vv.name)
     187                    if vv.name != None:
     188                        v_stat += len(vv.name)
    186189                else:
    187190                    print("WARNING: vv was None")
     
    230233
    231234def loopSecurity(hive, fh):
    232     start = hive.root.fetch_security()
    233     print(start.descriptor.group)
    234     cur = start.next_security()
    235 
    236     while cur != start:
    237         print(start.descriptor.group)
    238         cur = cur.next_security()
     235    cur = hive.root.fetch_security()
     236    while True:
     237        stat += len(cur.descriptor.owner)
     238        stat += len(cur.descriptor.group)
     239        if cur.descriptor.sacl:
     240            stat += len(cur.descriptor.sacl)
     241        if cur.descriptor.dacl:
     242            stat += len(cur.descriptor.dacl)
     243       
     244        nxt = cur.next_security()
     245        if cur == nxt:
     246            break
    239247
    240248   
     
    278286
    279287def usage():
    280     sys.stderr.write("USAGE: pyregfi-smoketest.py test1[,test2[,...]] hive1 [hive2 ...]\n")
     288    sys.stderr.write("USAGE: pyregfi-smoketest.py { test1[,test2[,...]] | * } hive1 [hive2 ...]\n")
    281289    sys.stderr.write("\tAvailable tests:\n")
    282290    for t in tests.keys():
     
    288296    sys.exit(1)
    289297
    290 selected_tests = sys.argv[1].split(',')
    291 for st in selected_tests:
    292     if st not in tests:
    293         usage()
    294         sys.stderr.write("ERROR: %s not a valid test type\n\n" % st)
    295         sys.exit(1)
     298if sys.argv[1] == '*':
     299    selected_tests = tests.keys()
     300else:
     301    selected_tests = sys.argv[1].split(',')
     302    for st in selected_tests:
     303        if st not in tests:
     304            usage()
     305            sys.stderr.write("ERROR: %s not a valid test type\n\n" % st)
     306            sys.exit(1)
    296307
    297308files = []
Note: See TracChangeset for help on using the changeset viewer.