on test failure, switch to a third event loop

akkartik
Dec 12, 2024, 6:22 AM
27CGGCHX4SNKOUGOXYL25MKEFXX3RC2PZXZBZRZIARGXZM4HAEBQC

Dependencies

  • [2] ZKH2N6MN Merge text0
  • [3] HATSIZ4A simplify
  • [4] AVTNUQYR basic test-enabled framework
  • [5] F2P336NO resolve conflicts
  • [6] 36Z442IV back to commit 8123959e52f without code editing
  • [7] JNJ4R56X support running tests multiple times
  • [8] TSV3KPBR tweak format of test failures
  • [9] 2NTKHMLG configurable error handler when running tests
  • [10] A3Z3S62K get rid of dubious heuristic helper
  • [11] ARYMNK52 merge bugfix: show test failures
  • [12] POQ23S4H fix startup test failures from the driver
  • [13] ULKNZUZK resolve conflicts
  • [*] 3QNOKBFM beginnings of a test harness

Change contents

  • replacement in app.lua at line 141
    [4.48][4.1829:1850](),[4.72][4.1829:1850](),[4.8462][4.1829:1850]()
    -- example handler
    [4.48]
    [2.19]
    -- if we encounter an error, wait for a fix
  • edit in app.lua at line 143
    [4.61][4.676:714](),[4.714][4.0:50](),[4.61][4.0:50]()
    print('tests failed; mode error')
    Mode = 'error'
    Redo_initialization = true
  • edit in app.lua at line 144
    [3.201]
    [4.895]
    print(Error_message)
  • edit in app.lua at line 146
    [4.949]
    [4.131]
    local current_time, previous_read = 0, 0
    while true do
    if love.event then
    love.event.pump()
    for name, a,b,c,d,e,f in love.event.poll() do
    if name == 'quit' then
    os.exit(1)
    end
    end
    end
    local dt = love.timer.step()
    current_time = current_time + dt
    if current_time - previous_read > 0.1 then
    local buf = live.receive_from_driver()
    if buf then
    local maybe_mutated = live.run(buf)
    if maybe_mutated then
    Test_errors = {}
    App.run_tests(record_error)
    if #Test_errors == 0 then
    break
    end
    Error_message = 'There were test failures:\n\n'..table.concat(Test_errors, '\n')
    print(Error_message)
    live.send_run_time_error_to_driver(Error_message)
    end
    end
    end
    love.graphics.origin()
    love.graphics.clear(0,0,1)
    love.graphics.setColor(1,1,1)
    love.graphics.printf(Error_message, 40,40, 600)
    love.graphics.present()
    love.timer.sleep(0.001)
    end