From e3f230946d5f24f6cf8f0f372241ceb99db0b3fb Mon Sep 17 00:00:00 2001 From: James Sully Date: Sun, 4 Aug 2024 12:19:11 +1000 Subject: [PATCH] add test for executable size --- test_daemon.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test_daemon.py b/test_daemon.py index 9f168f3..fd0e7f0 100755 --- a/test_daemon.py +++ b/test_daemon.py @@ -12,6 +12,7 @@ import subprocess import json import pytest +import warnings from contextlib import contextmanager @@ -95,5 +96,18 @@ def test_sand_operations(daemon, client_socket, test_input, expected_output): response = msg_and_response(test_input, client_socket) assert response == expected_output, f"Test failed. Expected {expected_output}, got {response}" +''' +Need to get this down. I think by eliminating any `import Lean`. +Hopefully we'll be able to make the warn_threshold the fail_threshold +''' +def test_executable_size(): + exe_size = os.path.getsize("./.lake/build/bin/sand") + warn_threshold = 15_000_000 + if exe_size > warn_threshold: + warnings.warn(f"Sand executable size is more than 20MB") + + fail_threshold = 100_000_000 + assert exe_size < fail_threshold, f"Sand executable size is more than 100MB" + if __name__ == "__main__": pytest.main([__file__])