author | Edouard Tisserant <edouard@beremiz.fr> |
Fri, 30 Aug 2024 11:50:23 +0200 | |
changeset 4008 | f30573e98600 |
parent 3955 | 792ae5ff01ca |
permissions | -rw-r--r-- |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
1 |
#! gmake |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
2 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
3 |
# beremiz/tests/Makefile : |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
4 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
5 |
# Makefile to prepare and run Beremiz tests. |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
6 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
7 |
# For developper to: |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
8 |
# - quickly run a test (TDD) on current code |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
9 |
# - write new tests, debug existing tests |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
10 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
11 |
# Use cases : |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
12 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
13 |
# run given tests |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
14 |
# $ make run_python_exemple.sikuli |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
15 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
16 |
# run tests from particular test classes |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
17 |
# $ make ide_tests |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
18 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
19 |
# run one particular test in a Xnest window |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
20 |
# $ make xnest_run_python_exemple.sikuli |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
21 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
22 |
# run Xnest window with just xterm |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
23 |
# $ make xnest_xterm |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
24 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
25 |
# run Xnest window with sikuli IDE and xterm |
3430
c2171d87b587
Documentation/comment fix.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3428
diff
changeset
|
26 |
# $ make xnest_sikuli |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
27 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
28 |
# build minimal beremiz and matiec to run tests |
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
29 |
# $ make built_apps |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
30 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
31 |
# For CI/CD scripts to catch and report all failures. Use cases : |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
32 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
33 |
# run all tests |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
34 |
# $ make |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
35 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
36 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
37 |
# Test results, and other test byproducts are in $(test_dir), |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
38 |
# $(test_dir) defaults to $(HOME)/test and can be overloaded: |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
39 |
# $ make test_dir=${HOME}/other_test_dir |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
40 |
# |
3428
803ce245f72f
Tests: Add a Makefile variable to allow changing standalone headless X server command (Xvfb by default)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
41 |
# Makefile attemps to use xvfb-run to run each test individually with its own |
803ce245f72f
Tests: Add a Makefile variable to allow changing standalone headless X server command (Xvfb by default)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
42 |
# X server instance. This behavior can be overloaded |
803ce245f72f
Tests: Add a Makefile variable to allow changing standalone headless X server command (Xvfb by default)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
43 |
# $ DISPLAY=:42 make xserver_command='echo "Using $DISPLAY X Server !";' |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
44 |
# |
3430
c2171d87b587
Documentation/comment fix.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3428
diff
changeset
|
45 |
# Matiec and Beremiz code are expected to be clean, ready to build |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
46 |
# Any change in Matiec directory triggers rebuild of matiec. |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
47 |
# Any change in Matiec and Beremiz directory triggers copy of source code |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
48 |
# to $(test_dir)/build. |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
49 |
# |
3438
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
50 |
# BEREMIZPYTHONPATH is expected to be absolute path to python interpreter |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
51 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
52 |
# Please note: |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
53 |
# In order to run asside a freshly build Matiec, tested beremiz instance |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
54 |
# needs to run on code from $(test_dir)/build/beremiz, a fresh copy |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
55 |
# of the Beremiz directory $(src)/beremiz, where we run tests from. |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
56 |
# |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
57 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
58 |
all: source_check cli_tests ide_tests runtime_tests |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
59 |
|
3430
c2171d87b587
Documentation/comment fix.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3428
diff
changeset
|
60 |
# Variable $(src) is directory such that executed |
c2171d87b587
Documentation/comment fix.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3428
diff
changeset
|
61 |
# $(src)/Makefile is this file. |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
62 |
src := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) |
3430
c2171d87b587
Documentation/comment fix.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3428
diff
changeset
|
63 |
|
c2171d87b587
Documentation/comment fix.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3428
diff
changeset
|
64 |
# $(workspace) is directory containing this project |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
65 |
workspace ?= $(abspath $(src)/../..) |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
66 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
67 |
test_dir ?= $(HOME)/test |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
68 |
build_dir = $(test_dir)/build |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
69 |
|
3541
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
70 |
# |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
71 |
# SOURCE and BUILD |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
72 |
# |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
73 |
|
3955
792ae5ff01ca
Tests: Add minimal C runtime test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3926
diff
changeset
|
74 |
BUILT_PROJECTS=beremiz matiec open62541 Modbus erpc |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
75 |
|
3432
40b8b2ffb3fd
Tests: Various enhancements in Makefile and sikuli common python code.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3430
diff
changeset
|
76 |
tar_opts=--absolute-names --exclude=.hg --exclude=.git --exclude=.*.pyc --exclude=.*.swp |
40b8b2ffb3fd
Tests: Various enhancements in Makefile and sikuli common python code.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3430
diff
changeset
|
77 |
|
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
78 |
# sha1 checksum of source is used to force copy/compile on each change |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
79 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
80 |
define make_checksum_assign |
3432
40b8b2ffb3fd
Tests: Various enhancements in Makefile and sikuli common python code.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3430
diff
changeset
|
81 |
$(1)_checksum = $(shell tar $(tar_opts) -c $(workspace)/$(1) | sha1sum | cut -d ' ' -f 1) |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
82 |
endef |
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
83 |
$(foreach project,$(BUILT_PROJECTS),$(eval $(call make_checksum_assign,$(project)))) |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
84 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
85 |
$(build_dir): |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
86 |
mkdir -p $(build_dir) |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
87 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
88 |
define make_src_rule |
3550
45e482f279f4
tests: fix tests being systematically re-executed
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3549
diff
changeset
|
89 |
$(build_dir)/$(1)/$($(1)_checksum).sha1: | $(build_dir) $(workspace)/$(1) |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
90 |
rm -rf $(build_dir)/$(1) |
3432
40b8b2ffb3fd
Tests: Various enhancements in Makefile and sikuli common python code.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3430
diff
changeset
|
91 |
tar -C $(workspace) $(tar_opts) -c $(1) | tar -C $(build_dir) -x |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
92 |
touch $$@ |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
93 |
endef |
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
94 |
$(foreach project,$(BUILT_PROJECTS),$(eval $(call make_src_rule,$(project)))) |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
95 |
|
3822
d311880b9d15
Tests: fix systematically rebuilding matiec
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3730
diff
changeset
|
96 |
$(build_dir)/matiec/iec2c: | $(build_dir)/matiec/$(matiec_checksum).sha1 |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
97 |
cd $(build_dir)/matiec && \ |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
98 |
autoreconf -i && \ |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
99 |
./configure && \ |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
100 |
make |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
101 |
|
3822
d311880b9d15
Tests: fix systematically rebuilding matiec
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3730
diff
changeset
|
102 |
$(build_dir)/open62541/build/bin/libopen62541.a: | $(build_dir)/open62541/$(open62541_checksum).sha1 |
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
103 |
cd $(build_dir)/open62541 && \ |
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
104 |
rm -rf build && mkdir build && cd build && \ |
3610
06c6b9fd88b8
tests: missing SSL support in open62541 build parameters
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3552
diff
changeset
|
105 |
cmake -D UA_ENABLE_ENCRYPTION=OPENSSL .. && \ |
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
106 |
make |
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
107 |
|
3926
a6ec38dcbfb5
Modbus: add CI test + test project
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3834
diff
changeset
|
108 |
$(build_dir)/Modbus/libmb.a: | $(build_dir)/Modbus/$(Modbus_checksum).sha1 |
a6ec38dcbfb5
Modbus: add CI test + test project
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3834
diff
changeset
|
109 |
cd $(build_dir)/Modbus && \ |
a6ec38dcbfb5
Modbus: add CI test + test project
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3834
diff
changeset
|
110 |
make |
a6ec38dcbfb5
Modbus: add CI test + test project
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3834
diff
changeset
|
111 |
|
3955
792ae5ff01ca
Tests: Add minimal C runtime test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3926
diff
changeset
|
112 |
$(build_dir)/beremiz/C_runtime/beremiz_runtime: | $(build_dir)/erpc/$(erpc_checksum).sha1 |
792ae5ff01ca
Tests: Add minimal C runtime test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3926
diff
changeset
|
113 |
cd $(build_dir)/beremiz/C_runtime && \ |
792ae5ff01ca
Tests: Add minimal C runtime test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3926
diff
changeset
|
114 |
make |
792ae5ff01ca
Tests: Add minimal C runtime test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3926
diff
changeset
|
115 |
|
792ae5ff01ca
Tests: Add minimal C runtime test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3926
diff
changeset
|
116 |
built_apps: $(build_dir)/matiec/iec2c $(build_dir)/beremiz/$(beremiz_checksum).sha1 $(build_dir)/open62541/build/bin/libopen62541.a $(build_dir)/Modbus/libmb.a $(build_dir)/beremiz/C_runtime/beremiz_runtime |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
117 |
touch $@ |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
118 |
|
3541
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
119 |
define log_command |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
120 |
$(call $(1),$(2)) | tee test_stdout.txt; exit $$$${PIPESTATUS[0]} |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
121 |
endef |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
122 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
123 |
define prep_test |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
124 |
rm -rf $(test_dir)/$(1)_results |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
125 |
mkdir $(test_dir)/$(1)_results |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
126 |
cd $(test_dir)/$(1)_results |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
127 |
endef |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
128 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
129 |
# |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
130 |
# IDE TESTS |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
131 |
# |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
132 |
|
3438
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
133 |
ide_test_dir = $(src)/ide_tests |
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
134 |
sikuli_ide_tests = $(subst $(ide_test_dir)/,,$(wildcard $(ide_test_dir)/*.sikuli)) |
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
135 |
pytest_ide_tests = $(subst $(ide_test_dir)/,,$(wildcard $(ide_test_dir)/*.pytest)) |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
136 |
|
3730
87dac789bdaf
Test: Customize Fluxbox launch to get rid of toolbar in IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3610
diff
changeset
|
137 |
fluxbox_command ?= echo "session.screen0.toolbar.placement: TopCenter" > fluxbox_init; (fluxbox -rc fluxbox_init >/dev/null 2>&1 &) |
87dac789bdaf
Test: Customize Fluxbox launch to get rid of toolbar in IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3610
diff
changeset
|
138 |
|
3438
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
139 |
define sikuli_idetest_command |
3730
87dac789bdaf
Test: Customize Fluxbox launch to get rid of toolbar in IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3610
diff
changeset
|
140 |
$(fluxbox_command); BEREMIZPATH=$(build_dir)/beremiz sikulix -r $(src)/ide_tests/$(1) |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
141 |
endef |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
142 |
|
3438
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
143 |
|
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
144 |
DELAY=400 |
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
145 |
KILL_DELAY=430 |
3834
0010719d0dea
Tests: pytests: only one wxpython app per process lifetime... Strip test_application.py
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3822
diff
changeset
|
146 |
PYTEST=$(dir $(BEREMIZPYTHONPATH))pytest |
3438
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
147 |
define pytest_idetest_command |
3730
87dac789bdaf
Test: Customize Fluxbox launch to get rid of toolbar in IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3610
diff
changeset
|
148 |
$(fluxbox_command); PYTHONPATH=$(ide_test_dir) timeout -k $(KILL_DELAY) $(DELAY) $(PYTEST) --maxfail=1 --timeout=100 $(src)/ide_tests/$(1) |
3438
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
149 |
endef |
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
150 |
|
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
151 |
# Xnest based interactive sessions for tests edit and debug. |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
152 |
# Would be nice with something equivalent to xvfb-run, waiting for USR1. |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
153 |
# Arbitrary "sleep 1" is probably enough for interactive use |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
154 |
define xnest_run |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
155 |
Xnest :42 -geometry 1920x1080+0+0 & export xnestpid=$$!; sleep 1; DISPLAY=:42 $(1); export res=$$?; kill $${xnestpid} 2>/dev/null; exit $${res} |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
156 |
endef |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
157 |
|
3428
803ce245f72f
Tests: Add a Makefile variable to allow changing standalone headless X server command (Xvfb by default)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
158 |
xserver_command ?= xvfb-run -s '-screen 0 1920x1080x24' |
803ce245f72f
Tests: Add a Makefile variable to allow changing standalone headless X server command (Xvfb by default)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
159 |
|
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
160 |
define make_idetest_rule |
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
161 |
$(test_dir)/$(1)_results/.passed: built_apps |
3541
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
162 |
$(call prep_test,$(1)); $(xserver_command) bash -c '$(call log_command,$(2),$(1))' |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
163 |
touch $$@ |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
164 |
|
3428
803ce245f72f
Tests: Add a Makefile variable to allow changing standalone headless X server command (Xvfb by default)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
165 |
# Manually invoked rule {testname}.sikuli |
3541
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
166 |
$(1): $(test_dir)/$(1)_results/.passed |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
167 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
168 |
# Manually invoked rule xnest_{testname}.sikuli |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
169 |
# runs test in xnest so that one can see what happens |
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
170 |
xnest_$(1): built_apps |
3541
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
171 |
$(call prep_test,$(1)); $$(call xnest_run, bash -c '$(call log_command,$(2),$(1))') |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
172 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
173 |
ide_tests_targets += $(test_dir)/$(1)_results/.passed |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
174 |
endef |
3438
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
175 |
$(foreach idetest,$(sikuli_ide_tests),$(eval $(call make_idetest_rule,$(idetest),sikuli_idetest_command))) |
24fbd4d1fe80
Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3435
diff
changeset
|
176 |
$(foreach idetest,$(pytest_ide_tests),$(eval $(call make_idetest_rule,$(idetest),pytest_idetest_command))) |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
177 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
178 |
ide_tests : $(ide_tests_targets) |
3435
c17155fd8573
Tests: re-introduce xvfb+x11vnc target in Makefile : xvfb_sikuli
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3433
diff
changeset
|
179 |
echo "$(ide_tests_targets) : Passed" |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
180 |
|
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
181 |
xnest_xterm: built_apps |
3730
87dac789bdaf
Test: Customize Fluxbox launch to get rid of toolbar in IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3610
diff
changeset
|
182 |
$(call xnest_run, bash -c '$(fluxbox_command);xterm') |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
183 |
|
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
184 |
xnest_sikuli: built_apps |
3730
87dac789bdaf
Test: Customize Fluxbox launch to get rid of toolbar in IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3610
diff
changeset
|
185 |
$(call xnest_run, bash -c '$(fluxbox_command);(BEREMIZPATH=$(build_dir)/beremiz xterm -e sikulix &);xterm') |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
186 |
|
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
187 |
xvfb_sikuli: built_apps |
3435
c17155fd8573
Tests: re-introduce xvfb+x11vnc target in Makefile : xvfb_sikuli
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3433
diff
changeset
|
188 |
echo "******************************************" |
c17155fd8573
Tests: re-introduce xvfb+x11vnc target in Makefile : xvfb_sikuli
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3433
diff
changeset
|
189 |
echo "On host, run 'xvncviewer 127.0.0.1:5900' to see sikuli X session" |
c17155fd8573
Tests: re-introduce xvfb+x11vnc target in Makefile : xvfb_sikuli
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3433
diff
changeset
|
190 |
echo "Docker container must be created with TESTDEBUG=YES. For example :" |
3527
fbe924df437b
tests: rename build_in_docker.sh to do_test_in_docker.sh
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3438
diff
changeset
|
191 |
echo "./clean_docker_container.sh && ./build_docker_image.sh && TESTDEBUG=YES ./create_docker_container.sh && ./do_test_in_docker.sh xvfb_sikuli" |
3435
c17155fd8573
Tests: re-introduce xvfb+x11vnc target in Makefile : xvfb_sikuli
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3433
diff
changeset
|
192 |
echo "******************************************" |
c17155fd8573
Tests: re-introduce xvfb+x11vnc target in Makefile : xvfb_sikuli
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3433
diff
changeset
|
193 |
$(xserver_command) bash -c '(fluxbox &);(x11vnc &);(BEREMIZPATH=$(build_dir)/beremiz xterm -e sikulix &);xterm' |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
194 |
|
3541
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
195 |
# |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
196 |
# CLI TESTS |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
197 |
# |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
198 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
199 |
cli_test_dir = $(src)/cli_tests |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
200 |
cli_tests = $(subst $(cli_test_dir)/,,$(wildcard $(cli_test_dir)/*.bash)) |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
201 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
202 |
define clitest_command |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
203 |
BEREMIZPATH=$(build_dir)/beremiz source $(src)/cli_tests/$(1) |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
204 |
endef |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
205 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
206 |
define make_clitest_rule |
3549
0af7b6a96c53
CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3541
diff
changeset
|
207 |
$(test_dir)/$(1)_results/.passed: built_apps |
3541
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
208 |
$(call prep_test,$(1)); bash -c '$(call log_command,$(2),$(1))' |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
209 |
touch $$@ |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
210 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
211 |
# Manually invoked rule |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
212 |
$(1): $(test_dir)/$(1)_results/.passed |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
213 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
214 |
cli_tests_targets += $(test_dir)/$(1)_results/.passed |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
215 |
endef |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
216 |
$(foreach clitest,$(cli_tests),$(eval $(call make_clitest_rule,$(clitest),clitest_command))) |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
217 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
218 |
cli_tests: $(cli_tests_targets) |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
219 |
echo "$(cli_tests_targets) : Passed" |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
220 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
221 |
clean_results: |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
222 |
rm -rf $(test_dir)/*_results |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
223 |
|
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
224 |
clean: clean_results |
916f553a74c3
tests: add support for CLI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3527
diff
changeset
|
225 |
rm -rf $(build_dir) |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
226 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
227 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
228 |
# TODOs |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
229 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
230 |
source_check: |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
231 |
echo TODO $@ |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
232 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
233 |
runtime_tests: |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
234 |
echo TODO $@ |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
235 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
236 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
237 |