tests/Makefile
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sun, 13 Feb 2022 20:59:42 +0100
branchwxPython4
changeset 3424 7db96e011fe7
child 3428 803ce245f72f
permissions -rw-r--r--
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
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
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
    26
#           $ 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
    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
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
    29
#           $ make own_apps
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
#   Variable $(src) is directory such that executed 
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
#   $(src)/beremiz/tests/Makefile is this file.
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
#   
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
#   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
    41
#   $(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
    42
#       $ 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
    43
#
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
#
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
    45
#   Matiec and Beremiz code are expected to be clean as if after hg clean --all.
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
#
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
    50
#
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
#   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
    52
#       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
    53
#       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
    54
#       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
    55
#   
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
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
    58
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
src := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
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
    60
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
    61
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
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
    63
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
    64
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
OWN_PROJECTS=beremiz 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
    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
# 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
    68
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
define make_checksum_assign
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
    70
$(1)_checksum = $(shell tar --exclude=.hg --exclude=.git --exclude=.*.swp -c $(workspace)/$(1) | sha1sum | cut -d ' ' -f 1)
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
    71
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
    72
$(foreach project,$(OWN_PROJECTS),$(eval $(call make_checksum_assign,$(project))))
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
    73
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
    74
$(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
    75
	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
    76
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
    77
define make_src_rule
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
$(build_dir)/$(1)/$($(1)_checksum).sha1: $(build_dir) $(workspace)/$(1)
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
	rm -rf $(build_dir)/$(1)
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
	cp -a $(workspace)/$(1) $(build_dir)/$(1)
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
    81
	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
    82
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
    83
$(foreach project,$(OWN_PROJECTS),$(eval $(call make_src_rule,$(project))))
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)/matiec/iec2c: | $(build_dir)/matiec/$(matiec_checksum).sha1
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
	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
    87
    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
    88
    ./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
    89
    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
    90
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
    91
# TODO: use packge (deb/snap ?)
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
own_apps: $(build_dir)/matiec/iec2c $(build_dir)/beremiz/$(beremiz_checksum).sha1
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
	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
    94
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
ide_tests = $(subst $(src)/ide_tests/,,$(wildcard $(src)/ide_tests/*.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
    96
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
define idetest_command
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
	(fluxbox &); BEREMIZPATH=$(build_dir)/beremiz sikulix -r $(src)/ide_tests/$(1) | tee test_stdout.txt; exit $$$${pipestatus[0]}
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
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
   100
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
# 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
   102
# 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
   103
# 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
   104
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
   105
	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
   106
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
   107
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
   108
# Manually invoked rule {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
   109
define make_idetest_rule
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
   110
$(test_dir)/$(1)_idetest/.passed: own_apps
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
   111
	rm -rf $(test_dir)/$(1)_idetest
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
   112
	mkdir $(test_dir)/$(1)_idetest
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
   113
	cd $(test_dir)/$(1)_idetest; xvfb-run -s '-screen 0 1920x1080x24' bash -c '$$(call idetest_command, $(1))'
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
   114
	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
   115
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
   116
$(1): $(test_dir)/$(1)_idetest/.passed
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
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
# 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
   119
# runs test in xnest so that one can see what happens
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
   120
# depends on docker arguments "-v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -e DISPLAY=$DISPLAY"
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
   121
xnest_$(1): own_apps
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
   122
	rm -rf $(test_dir)/$(1)_idetest
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
   123
	mkdir $(test_dir)/$(1)_idetest
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
   124
	cd $(test_dir)/$(1)_idetest; $$(call xnest_run, bash -c '$(call idetest_command, $(1))')
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
   125
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
   126
ide_tests_targets += $(test_dir)/$(1)_idetest/.passed
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
   127
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
   128
$(foreach idetest,$(ide_tests),$(eval $(call make_idetest_rule,$(idetest))))
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
   129
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
   130
ide_tests : $(ide_tests_targets)
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
   131
	echo "$(ide_tests_targets)" : Passed
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
   132
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
   133
xnest_xterm: own_apps
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
   134
	$(call xnest_run, bash -c '(fluxbox &);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
   135
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
xnest_sikuli: own_apps
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
   137
	$(call xnest_run, bash -c '(fluxbox &);(xterm -e sikulix &);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
   138
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
   139
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
   140
# in case VNC would be used 
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
	#xvfb-run -s '-screen 0 1920x1080x24' bash -c '(fluxbox &);(x11vnc &);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
   142
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
   143
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
   144
clean:
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
   145
	rm -rf $(ide_tests_targets) $(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
   146
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
   147
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
   148
# 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
   149
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
   150
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
   151
	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
   152
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
cli_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
   154
	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
   155
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
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
   157
	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
   158
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
   159
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