tests/cli_tests/run_python_example.bash
author Edouard Tisserant <edouard.tisserant@gmail.com>
Wed, 16 Oct 2024 12:18:14 +0200
changeset 4030 45532de22b75
parent 3719 4906295e0be6
permissions -rw-r--r--
TESTS: Update Matiec revision in GH workflow
3543
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
#!/bin/bash
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
# Run python example throug command line, and check usual output
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
3719
4906295e0be6 Tests: Fixed wrong path (relative to $HOME) in CLI tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3543
diff changeset
     5
coproc setsid $BEREMIZPYTHONPATH $BEREMIZPATH/Beremiz_cli.py -k --project-home $BEREMIZPATH/exemples/python build transfer run;
3543
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     6
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
while read -u ${COPROC[0]} line; do 
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
    echo "$line"
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     9
    if [[ "$line" == *Grumpf* ]]; then
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    10
        pkill -9 -s $COPROC_PID 
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    11
        exit 0
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    12
    fi
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
done
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    14
6210c08c1c41 tests: CLI: add simple test running python example
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    15
exit 42