tests/cli_tests/run_python_example.bash
author GP Orcullo <kinsamanka@gmail.com>
Sat, 04 Feb 2023 07:19:52 +0800
branchpython3
changeset 3784 a5f58ca4629b
parent 3719 4906295e0be6
permissions -rw-r--r--
fix name clash
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