Changeset 2806b5e


Ignore:
Timestamp:
2021-03-29T11:32:17Z (2 weeks ago)
Author:
/ <>
Children:
6066443
Parents:
7b1fd83
Message:

rf3

Files:
1 added
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • .github/workflows/ci.yml

    r7b1fd83 r2806b5e  
    1919    - name: build bitlbee
    2020      run: |
    21         ./configure \
    22             --asan=1
    23            # --events=glib \
    24            # --ssl=gnutls \
    25            # --doc=0 \
    26            # --jabber=0 \
    27            # --msn=0 \
    28            # --oscar=0 \
    29            # --twitter=0 \
    30            # --yahoo=0
    31 
     21        ./configure --asan=1
    3222        cat ./.tests/gcovflags >> Makefile.settings
    3323        make
     
    3525        touch ./debuglog
    3626   
    37     - name: jabber test
     27    - name: talk to bitlbee
    3828      run: |
     29        ./.tests/setup_bitlbee.sh
     30
     31        python3 ./.tests/talk_to_bitlbee.py
     32
     33        ./.tests/cleanup_bitlbee.sh
     34
     35    - name: jabber: connect
    3936        ./.tests/setup_prosody.sh
    4037        ./.tests/setup_bitlbee.sh
  • .tests/btlib.py

    r7b1fd83 r2806b5e  
    33import time
    44import select
    5 
    6 SHOWLOG = False
    7 SHOWTESTLOG = True
    8 
    9 FUN = [
    10 "Did I ask you something?",
    11 "Oh yeah, that's right.",
    12 "Alright, alright. Now go back to work.",
    13 "Buuuuuuuuuuuuuuuurp... Excuse me!",
    14 "Yes?",
    15 "No?",
    16 ]
    175
    186SEPARATOR = "="*60
     
    9684    return received
    9785
    98 def debug_check(debug_file):
    99     error_found = False
    100     debug_log = ''
    101     while True:
    102         line = debug_file.readline()
    103         if len(line) == 0:
    104             break
    105         debug_log += line
    106         error_found = error_found or (line.lower().find('error') != -1)
    107     return error_found, debug_log
    108 
    109 def perform_test(failed, clis, test_function, test_name, debug_file):
    110     for cli in clis:
    111         cli.tmplog=""
    112 
    113     print("\n"+SEPARATOR)
    114     print("Test: "+test_name)
     86
     87def perform_test(clis, test_function):
     88    clis = []
     89    clis += [btlib.IrcClient('test1', 'asd')]
     90    clis += [btlib.IrcClient('test2', 'asd')]
     91    for cli in clis:
     92        cli.connect()
    11593
    11694    fail = not test_function(clis)
    11795
    118     debug_error, debug_log = debug_check(debug_file)
    119 
    120     fail = fail or debug_error
     96    for cli in clis:
     97        cli.receive()
     98        print(SEPARATOR)
     99        print("Test Log "+ cli.nick+":")
     100        print(cli.tmplog)
     101    print(SEPARATOR)
     102   
    121103
    122104    if fail:
    123         print("Test failed")
    124         failed += [test_name]
    125     else:
    126         print("Test passed")
    127 
    128     for cli in clis:
    129         cli.receive()
    130 
    131     if fail or SHOWTESTLOG:
    132         for cli in clis:
    133             if cli.tmplog != "":
    134                 print(SMOLPARATOR)
    135                 print("Test Log "+ cli.nick+":")
    136                 print(cli.tmplog)
    137 
    138     if debug_error:
    139         print(SMOLPARATOR)
    140         print("Debug Log:")
    141         print(debug_log)
    142 
    143     print(SEPARATOR)
     105        sys.exit(1)
     106
    144107
    145108def yes_test(clis):
     
    270233    return ret
    271234   
    272 
    273235def run_tests(failed):
    274     debug_file = open('./debuglog','r')
    275236    clis = []
    276237    clis += [IrcClient('test1', 'asd')]
     
    285246        cli.jabber_login()
    286247
    287     perform_test(failed, clis, add_buddy_test, "Add/remove buddy", debug_file)
    288     perform_test(failed, clis, message_test, "Send message", debug_file)
     248    perform_test(failed, clis, add_buddy_test, "Add/remove buddy")
     249    perform_test(failed, clis, message_test, "Send message")
    289250    #perform_test(failed, clis, block_test, "Block user", debug_file)
    290     perform_test(failed, clis, rename_test, "Rename user", debug_file)
    291     perform_test(failed, clis, status_test, "Change status", debug_file)
    292     perform_test(failed, clis, offline_test, "Go offline", debug_file)
    293     perform_test(failed, clis, default_target_test, "Change default target", debug_file)
    294     perform_test(failed, clis, help_test, "Ask for help", debug_file)
     251    perform_test(failed, clis, rename_test, "Rename user")
     252    perform_test(failed, clis, status_test, "Change status")
     253    perform_test(failed, clis, offline_test, "Go offline")
     254    perform_test(failed, clis, default_target_test, "Change default target")
     255    perform_test(failed, clis, help_test, "Ask for help")
    295256
    296257    if failed or SHOWLOG:
     
    309270        print("\n" + SEPARATOR + "\nAll tests have passed")
    310271   
    311     debug_file.close()
    312    
    313272if __name__ == "__main__":
    314273    failed = []
Note: See TracChangeset for help on using the changeset viewer.