def test_module_with_classes():
    sut = utils.BinaryUnderTest(
        utils.find_binary("spawn_process_from_filesystem"))
    sut.start()
    sut.expect("Device geometry")
    sut.expect("Size: 128")
    sut.expect("Read size: 1")
    sut.expect("Write size: 1")
    sut.expect("Erase size: 1")
    sut.expect("Creating file with name: /test.txt")
    sut.expect("File is not null")
    sut.expect("Content of file")
    sut.expect("Storing some data in file")
    sut.expect("Started testing ROMFS disk")
    sut.expect("Opening file /rom/test.txt")
    sut.expect("Content of file")
    sut.expect("This is simple file")
    sut.expect("ImplementationA value: 10", 2)
    sut.expect("ImplementationB value: 15")
    sut.expect("ChildA value: 10")
    sut.expect("ImplementationA is printing")
    sut.expect("I am working! I_AM_B")
    sut.expect("ChildA is printing")
    sut.expect("ImplementationA is printing")
    sut.expect("Interface value: 10")
    sut.expect("Hello from module")
    sut.stop(1)
Ejemplo n.º 2
0
def test_ram_block_device():
    sut = utils.BinaryUnderTest(utils.find_binary("ram_block_device_test"))
    sut.start()
    sut.expect("Device geometry:", 1)
    sut.expect("Size: 2048", 1)
    sut.expect("Read size: 1", 1)
    sut.expect("Write size: 1", 1)
    sut.expect("Erase size: 1", 1)
    sut.expect("Erase 24 bytes at 0x0", 1)
    sut.expect("Write Hello at address 0x4", 1)
    sut.expect("Read", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("48 : H", 1)
    sut.expect("65 : e", 1)
    sut.expect("6c : l", 1)
    sut.expect("6c : l", 1)
    sut.expect("6f : o", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.expect("0 :", 1)
    sut.stop(1)
Ejemplo n.º 3
0
def test_bss_section():
    sut = utils.BinaryUnderTest(utils.find_binary("test_bss_section"))
    sut.start()
    sut.expect("Hello from bss test", 1)
    sut.expect("Array 1: 1, 2, 3, 4,", 1)
    sut.expect("Integer 1: 0", 1)
    sut.expect("Integer 2: 15", 1)
    sut.expect("Integer 3: 5", 1)
    sut.expect("Array 2: 5, 6, 19, 8,", 1)
    sut.stop(1)
def test_use_module_with_data_relocation():
    sut = utils.BinaryUnderTest(utils.find_binary("module_with_data"))
    sut.start()
    sut.expect("Module started", 1)
    sut.expect("Integer: -12345", 1)
    sut.expect("Constexpr integer: 21234", 1)
    sut.expect("Global integer: 177177", 1)
    sut.expect("Local data 1: 1, 2, 3, 8", 1)
    sut.expect("Local data 2: 5, 6, 7, 8", 1)
    sut.expect("Global integer: 19", 1)
    sut.expect("Global integer ptr: 19", 1)
    sut.stop(1)
Ejemplo n.º 5
0
def test_mutex_synchronization():
    sut = utils.BinaryUnderTest(utils.find_binary("mutex_test"))
    sut.start()
    sut.expect("Parent is starting", 1)
    sut.expect("Parent is going to sleep", 1)
    sut.expect("Child is starting", 1)
    sut.expect("Parent finished waiting", 1)
    # sut.expect("Parent is working", 1)
    sut.expect("Child is going to sleep", 1)
    sut.expect("Parent is working", 1)
    sut.expect("Child finished waiting", 1)
    sut.expect("Child is working", 1)
    sut.stop(1)
def test_module_with_classes():
    sut = utils.BinaryUnderTest(utils.find_binary("interface_and_classes"))
    sut.start()
    sut.expect("ImplementationA value: 10", 1)
    sut.expect("ImplementationB value: 15", 1)
    sut.expect("ChildA value: 10", 1)
    sut.expect(r"Printing tests :\)", 1)
    sut.expect("ImplementationA is printing", 1)
    sut.expect("I am working! I_AM_B", 1)
    sut.expect("ChildA is printing", 1)
    sut.expect("ImplementationA is printing", 1)
    sut.expect("Interface value: 10", 1)
    sut.expect("ChildA is printing", 1)
    sut.expect("Hello from module", 1)
    sut.stop(1)
Ejemplo n.º 7
0
def test_process_creation_deletion():
    sut = utils.BinaryUnderTest(
        utils.find_binary("process_creation_deletion_test"))
    sut.start()
    sut.expect("Hello from Kernel", 1)
    sut.expect("Parent", 1)
    sut.expect("Parent going to sleep", 1)
    sut.expect("Child process started", 1)
    sut.expect("Child is going to sleep", 1)
    sut.expect("Child Done", 1)
    sut.expect("Child has additional print", 1)
    sut.expect("Child A", 1)
    sut.expect("Child A finished", 1)
    sut.expect("Child B", 1)
    sut.expect("B finished", 1)
    sut.expect("Child C is starting: a", 1)

    sut.stop(1)
Ejemplo n.º 8
0
def test_verify_args():
    sut = utils.BinaryUnderTest(utils.find_binary("module_with_args"))
    sut.start()
    sut.expect("Execute binary", 1)
    sut.expect("Returned 123", 1)
    sut.stop(1)
Ejemplo n.º 9
0
def test_1():
    sut = utils.BinaryUnderTest(utils.find_binary("simple_module"))
    sut.start()
    sut.expect("Hello from simple single module", 1)
    sut.stop(1)