Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP2
erlang.30244
feature-upstream-testsuite-enhancement.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File feature-upstream-testsuite-enhancement.patch of Package erlang.30244
From 2f246b551cca5ca7ca9187282e42650976a65cbb Mon Sep 17 00:00:00 2001 From: Kjell Winblad <kjellwinblad@gmail.com> Date: Tue, 11 Jun 2019 17:36:04 +0200 Subject: [PATCH] Add "make test" command for root and application directories The added make target is described in HOWTO/TESTING.md. --- HOWTO/TESTING.md | 46 +++++++ Makefile.in | 5 + erts/Makefile | 2 + erts/emulator/Makefile.in | 2 + erts/epmd/Makefile | 2 + lib/asn1/Makefile | 2 + lib/common_test/Makefile | 1 + lib/compiler/Makefile | 1 + lib/crypto/Makefile | 1 + lib/debugger/Makefile | 2 + lib/dialyzer/Makefile | 1 + lib/diameter/Makefile | 2 + lib/edoc/Makefile | 3 + lib/eldap/Makefile | 1 + lib/erl_docgen/Makefile | 1 + lib/erl_interface/Makefile | 2 + lib/et/Makefile | 1 + lib/eunit/Makefile | 2 + lib/ftp/Makefile | 2 + lib/hipe/Makefile | 1 + lib/inets/Makefile | 2 + lib/jinterface/Makefile | 1 + lib/kernel/Makefile | 2 + lib/megaco/Makefile | 2 + lib/mnesia/Makefile | 1 + lib/observer/Makefile | 1 + lib/odbc/Makefile | 2 + lib/os_mon/Makefile | 1 + lib/parsetools/Makefile | 1 + lib/public_key/Makefile | 1 + lib/reltool/Makefile | 1 + lib/runtime_tools/Makefile | 1 + lib/sasl/Makefile | 1 + lib/snmp/Makefile | 4 +- lib/ssh/Makefile | 1 + lib/ssl/Makefile | 2 +- lib/stdlib/Makefile | 2 + lib/syntax_tools/Makefile | 2 + lib/tftp/Makefile | 2 + lib/tools/Makefile | 1 + lib/wx/Makefile | 2 + lib/xmerl/Makefile | 1 + make/app_targets.mk | 25 ++++ make/test_target_script.sh | 254 +++++++++++++++++++++++++++++++++++++ 44 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 make/app_targets.mk create mode 100755 make/test_target_script.sh Index: otp-OTP-22.2.7/HOWTO/TESTING.md =================================================================== --- otp-OTP-22.2.7.orig/HOWTO/TESTING.md +++ otp-OTP-22.2.7/HOWTO/TESTING.md @@ -130,6 +130,52 @@ i.e. Running [ct_run][] from the command line still requires you to do the `ts:install()` step above. +### Convenience for running tests without the release and configuration steps + +It can be convenient to run tests with a single command. This way, one +do not need to worry about missing to run `make release_tests` after +changing a test suite. The `make test` command can be used for this +purpose. The `make test` command works when the current directory +contains a directory called test and in the root directory of the +source code tree. + +*(Waring)* Some test cases do not run correctly or cannot be run at +all through the `make test` command (typically test cases that require +test specific C code to be compiled) because `make test` runs tests +directly by invoking the `ct_run` command instead of using the `ts` +wrapper. One has to follow the procedure described above to run test +cases that do not work with `make test`. + +Below are some examples that illustrate how `make test` can be +used: + + # ERL_TOP needs to be set correctly + cd /path/to/otp + export ERL_TOP=`pwd` + + # Build Erlang/OTP + # + # Note that make test will only compile test code except when + # make test is executed from $ERL_TOP. + ./otp_build setup -a + + # Run a test case (The ARGS variable is passed to ct_run) + (cd $ERL_TOP/erts/emulator && make ARGS="-suite binary_SUITE -case deep_bitstr_lists" test) + + # Run a test suite + (cd $ERL_TOP/lib/stdlib && make ARGS="-suite ets_SUITE" test) + + # Run all test suites for an application + (cd $ERL_TOP/lib/asn1 && make test) + + # Run all tests + # + # When executed from $ERL_TOP, "make test" will first release and + # configure all tests and then attempt to run all tests with `ts:run`. + # This will take several hours. + (cd $ERL_TOP && make test) + + Examining the results --------------------- Index: otp-OTP-22.2.7/Makefile.in =================================================================== --- otp-OTP-22.2.7.orig/Makefile.in +++ otp-OTP-22.2.7/Makefile.in @@ -1206,3 +1206,8 @@ bootstrap_clean: || $(MAKE) BOOTSTRAP_ROOT=$(BOOTSTRAP_ROOT) bootstrap_root_clean # ---------------------------------------------------------------------- + +.PHONY: test + +test: all release release_tests + $(ERL_TOP)/make/test_target_script.sh $(ERL_TOP) Index: otp-OTP-22.2.7/erts/Makefile =================================================================== --- otp-OTP-22.2.7.orig/erts/Makefile +++ otp-OTP-22.2.7/erts/Makefile @@ -153,3 +153,5 @@ release_docs: .PHONY: xmllint xmllint: $(MAKE) -C doc/src $@ + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/erts/emulator/Makefile.in =================================================================== --- otp-OTP-22.2.7.orig/erts/emulator/Makefile.in +++ otp-OTP-22.2.7/erts/emulator/Makefile.in @@ -1290,3 +1290,5 @@ ifndef VOID_EMULATOR endif endif endif + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/erts/epmd/Makefile =================================================================== --- otp-OTP-22.2.7.orig/erts/epmd/Makefile +++ otp-OTP-22.2.7/erts/epmd/Makefile @@ -31,3 +31,5 @@ SPECIAL_TARGETS = # Default Subdir Targets # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/asn1/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/asn1/Makefile +++ otp-OTP-22.2.7/lib/asn1/Makefile @@ -100,3 +100,5 @@ tar: $(APP_TAR_FILE) $(APP_TAR_FILE): $(APP_DIR) (cd $(APP_RELEASE_DIR); gtar zcf $(APP_TAR_FILE) $(DIR_NAME)) + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/common_test/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/common_test/Makefile +++ otp-OTP-22.2.7/lib/common_test/Makefile @@ -45,3 +45,4 @@ SPECIAL_TARGETS = # include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/compiler/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/compiler/Makefile +++ otp-OTP-22.2.7/lib/compiler/Makefile @@ -36,3 +36,4 @@ SPECIAL_TARGETS = # include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/crypto/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/crypto/Makefile +++ otp-OTP-22.2.7/lib/crypto/Makefile @@ -38,3 +38,4 @@ SPECIAL_TARGETS = include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/debugger/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/debugger/Makefile +++ otp-OTP-22.2.7/lib/debugger/Makefile @@ -34,3 +34,5 @@ SPECIAL_TARGETS = # Default Subdir Targets # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/dialyzer/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/dialyzer/Makefile +++ otp-OTP-22.2.7/lib/dialyzer/Makefile @@ -42,3 +42,4 @@ SPECIAL_TARGETS = # include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/diameter/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/diameter/Makefile +++ otp-OTP-22.2.7/lib/diameter/Makefile @@ -31,3 +31,5 @@ info: @echo "APP_VSN = $(APP_VSN)" .PHONY: info + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/edoc/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/edoc/Makefile +++ otp-OTP-22.2.7/lib/edoc/Makefile @@ -124,3 +124,6 @@ tar: $(APP_TAR_FILE) $(APP_TAR_FILE): $(APP_DIR) (cd $(APP_RELEASE_DIR); gtar zcf $(APP_TAR_FILE) $(DIR_NAME)) + + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/eldap/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/eldap/Makefile +++ otp-OTP-22.2.7/lib/eldap/Makefile @@ -38,3 +38,4 @@ SPECIAL_TARGETS = # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/erl_docgen/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/erl_docgen/Makefile +++ otp-OTP-22.2.7/lib/erl_docgen/Makefile @@ -37,3 +37,4 @@ SPECIAL_TARGETS = include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/erl_interface/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/erl_interface/Makefile +++ otp-OTP-22.2.7/lib/erl_interface/Makefile @@ -31,3 +31,5 @@ SPECIAL_TARGETS = # Default Subdir Targets # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/et/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/et/Makefile +++ otp-OTP-22.2.7/lib/et/Makefile @@ -35,3 +35,4 @@ SPECIAL_TARGETS = # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/eunit/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/eunit/Makefile +++ otp-OTP-22.2.7/lib/eunit/Makefile @@ -94,3 +94,5 @@ tar: $(APP_TAR_FILE) $(APP_TAR_FILE): $(APP_DIR) (cd $(APP_RELEASE_DIR); gtar zcf $(APP_TAR_FILE) $(DIR_NAME)) + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/hipe/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/hipe/Makefile +++ otp-OTP-22.2.7/lib/hipe/Makefile @@ -75,3 +75,4 @@ distclean: realclean: $(V_at)$(MAKE) MAKETARGET="realclean" all-subdirs all-subdirs-x +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/inets/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/inets/Makefile +++ otp-OTP-22.2.7/lib/inets/Makefile @@ -76,3 +76,5 @@ dialyzer: $(DIA_PLT) @dialyzer --plt $< \ ../$(APPLICATION)/ebin \ --verbose + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/jinterface/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/jinterface/Makefile +++ otp-OTP-22.2.7/lib/jinterface/Makefile @@ -39,3 +39,4 @@ SPECIAL_TARGETS = # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/kernel/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/kernel/Makefile +++ otp-OTP-22.2.7/lib/kernel/Makefile @@ -34,3 +34,5 @@ SPECIAL_TARGETS = # Default Subdir Targets # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/megaco/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/megaco/Makefile +++ otp-OTP-22.2.7/lib/megaco/Makefile @@ -232,3 +232,5 @@ dialyzer: $(DIA_PLT) @dialyzer --plt $< \ ../$(APPLICATION)/ebin \ --verbose + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/mnesia/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/mnesia/Makefile +++ otp-OTP-22.2.7/lib/mnesia/Makefile @@ -38,3 +38,4 @@ SPECIAL_TARGETS = # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/observer/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/observer/Makefile +++ otp-OTP-22.2.7/lib/observer/Makefile @@ -37,3 +37,4 @@ SPECIAL_TARGETS = include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/odbc/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/odbc/Makefile +++ otp-OTP-22.2.7/lib/odbc/Makefile @@ -114,3 +114,5 @@ tar: $(APP_TAR_FILE) $(APP_TAR_FILE): $(APP_DIR) (cd $(APP_RELEASE_DIR); gtar zcf $(APP_TAR_FILE) $(DIR_NAME)) + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/os_mon/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/os_mon/Makefile +++ otp-OTP-22.2.7/lib/os_mon/Makefile @@ -35,3 +35,4 @@ SPECIAL_TARGETS = # include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/parsetools/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/parsetools/Makefile +++ otp-OTP-22.2.7/lib/parsetools/Makefile @@ -37,3 +37,4 @@ SPECIAL_TARGETS = # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/public_key/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/public_key/Makefile +++ otp-OTP-22.2.7/lib/public_key/Makefile @@ -38,3 +38,4 @@ SPECIAL_TARGETS = # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/reltool/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/reltool/Makefile +++ otp-OTP-22.2.7/lib/reltool/Makefile @@ -36,3 +36,4 @@ SPECIAL_TARGETS = # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/runtime_tools/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/runtime_tools/Makefile +++ otp-OTP-22.2.7/lib/runtime_tools/Makefile @@ -37,3 +37,4 @@ SPECIAL_TARGETS = include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/sasl/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/sasl/Makefile +++ otp-OTP-22.2.7/lib/sasl/Makefile @@ -36,3 +36,4 @@ SPECIAL_TARGETS = # include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/snmp/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/snmp/Makefile +++ otp-OTP-22.2.7/lib/snmp/Makefile @@ -157,3 +157,4 @@ dialyzer: $(DIA_PLT) @dialyzer --plt $< \ ../$(APPLICATION)/ebin \ --verbose +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/ssh/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/ssh/Makefile +++ otp-OTP-22.2.7/lib/ssh/Makefile @@ -38,3 +38,4 @@ SPECIAL_TARGETS = include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/ssl/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/ssl/Makefile +++ otp-OTP-22.2.7/lib/ssl/Makefile @@ -38,4 +38,4 @@ SPECIAL_TARGETS = # include $(ERL_TOP)/make/otp_subdir.mk - +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/stdlib/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/stdlib/Makefile +++ otp-OTP-22.2.7/lib/stdlib/Makefile @@ -35,3 +35,5 @@ SPECIAL_TARGETS = # Default Subdir Targets # include $(ERL_TOP)/make/otp_subdir.mk + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/syntax_tools/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/syntax_tools/Makefile +++ otp-OTP-22.2.7/lib/syntax_tools/Makefile @@ -91,3 +91,5 @@ tar: $(APP_TAR_FILE) $(APP_TAR_FILE): $(APP_DIR) (cd $(APP_RELEASE_DIR); gtar zcf $(APP_TAR_FILE) $(DIR_NAME)) + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/tools/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/tools/Makefile +++ otp-OTP-22.2.7/lib/tools/Makefile @@ -36,3 +36,4 @@ SPECIAL_TARGETS = # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/wx/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/wx/Makefile +++ otp-OTP-22.2.7/lib/wx/Makefile @@ -40,3 +40,5 @@ CLEANDIRS = $(SUBDIRS) api_gen SUB_DIRECTORIES=$(SUBDIRS) include $(ERL_TOP)/make/otp_subdir.mk + +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/lib/xmerl/Makefile =================================================================== --- otp-OTP-22.2.7.orig/lib/xmerl/Makefile +++ otp-OTP-22.2.7/lib/xmerl/Makefile @@ -97,3 +97,4 @@ tar: $(APP_TAR_FILE) $(APP_TAR_FILE): $(APP_DIR) (cd $(APP_RELEASE_DIR); gtar zcf $(APP_TAR_FILE) $(DIR_NAME)) +include $(ERL_TOP)/make/app_targets.mk Index: otp-OTP-22.2.7/make/app_targets.mk =================================================================== --- /dev/null +++ otp-OTP-22.2.7/make/app_targets.mk @@ -0,0 +1,25 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2019. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# %CopyrightEnd% +# + + +.PHONY: test + +test: + $(ERL_TOP)/make/test_target_script.sh $(ERL_TOP) Index: otp-OTP-22.2.7/make/test_target_script.sh =================================================================== --- /dev/null +++ otp-OTP-22.2.7/make/test_target_script.sh @@ -0,0 +1,254 @@ +#!/bin/sh + +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2019. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# %CopyrightEnd% +# + + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +LIGHT_CYAN='\033[1;36m' +BOLD='\033[1m' +NC='\033[0m' + + +print_highlighted_msg_with_printer () { + COLOR=$1 + MSG_PRINTER=$2 + printf "\n${COLOR}======================================================================${NC}\n" + echo + $MSG_PRINTER + echo + printf "${COLOR}======================================================================${NC}\n" +} + +print_highlighted_msg () { + COLOR=$1 + MSG=$2 + print_msg () { + echo "$MSG" + } + print_highlighted_msg_with_printer $COLOR print_msg +} + +print_all_tests_takes_long_time_warning () { + print_msg () { + cat << EOM + +WARNING + +All tests will require several hours to run. You may want to check the +following text file that describes how to run tests for a specific +application. + +EOM + echo $ERL_TOP/HOWTO/TESTING.md + } + print_highlighted_msg_with_printer $YELLOW print_msg +} + +print_all_tests_for_application_notes () { + print_msg () { + cat << EOM + +NOTE 1 + +ct_run will now attempt to execute tests in the test directory, which +may take a long time to do. One can pass arguments to ct_run by +setting the ARGS variable when invoking "make test". + +Example: + +make ARGS="-suite asn1_SUITE -case ticket_7407" test + +NOTE 2 + +You may want to look at the more established way of running tests that +is described in the following text file if you encounter strange +errors: + +EOM + echo "$ERL_TOP/HOWTO/TESTING.md" + } + print_highlighted_msg_with_printer $LIGHT_CYAN print_msg +} + +print_c_files_warning () { + print_msg () { + cat << EOM + +WARNING + +The test directory contains .c files which means that some test cases +will probably not work correctly when run through "make test". The +text file at the following location describes how one can compile and +run all test cases: + + +EOM + echo $ERL_TOP/HOWTO/TESTING.md + } + print_highlighted_msg_with_printer $YELLOW print_msg +} + + +print_on_error_note () { + print_msg () { + cat << EOM +NOTE: + +Some test cases do not work correctly when run through "make test" as +they are designed to be run through the method that is described in +the "$ERL_TOP/HOWTO/TESTING.md" text file. You may want to check this +text file if you encounter strange errors. Note also that you can +rerun a specific test case by passing parameters to ct_run as in the +example below: + +make ARGS="-suite asn1_SUITE -case ticket_7407" test + +EOM + } + print_highlighted_msg_with_printer $NC print_msg +} + +# Check ERL_TOP + +if [ -d "$1" ] +then + ERL_TOP="$1" + shift +fi + +if [ -z $ERL_TOP ] +then + ERL_TOP=`git rev-parse --show-toplevel` + if [ $? = 0 ] + then + print_highlighted_msg $LIGHT_CYAN "The environment variable ERL_TOP has been set to the git root" + else + echo "The ERL_TOP environment variable need to be set before this script is executed." + exit 1 + fi +fi + +export ERL_TOP=$ERL_TOP + + +if [ -z "${ARGS}" ] +then + ARGS="$@" +fi + +# make test in root +DIR=`pwd` +if [ "$DIR" -ef "$ERL_TOP" ] +then + TARGET_SYS=`$ERL_TOP/erts/autoconf/config.guess` + REL_DIR="$ERL_TOP/release/$TARGET_SYS" + cd "$REL_DIR" + ./Install -minimal "`pwd`" + export PATH="$REL_DIR/bin:$PATH" + cd "$ERL_TOP/release/tests/test_server" + print_all_tests_takes_long_time_warning + echo "The tests will start in a few seconds..." + sleep 45 + cd "$ERL_TOP/release/tests/test_server" + erl -eval "ts:install(),erlang:halt()" + erl -noinput -eval "ts:run([all_tests,batch]),erlang:halt()" + exit $? +fi + +# check that there is a test directory +if [ ! -d test ] +then + print_highlighted_msg $RED "This target only works in directories containing a test directory or\nin the root directory." + exit 1 +fi + + +APPLICATION="`basename $DIR`" +CT_RUN="$ERL_TOP/bin/ct_run" +MAKE_TEST_DIR="`pwd`/make_test_dir" +MAKE_TEST_REL_DIR="$MAKE_TEST_DIR/${APPLICATION}_test" +MAKE_TEST_CT_LOGS="$MAKE_TEST_DIR/ct_logs" +RELEASE_TEST_SPEC_LOG="$MAKE_TEST_CT_LOGS/release_tests_spec_log" + +cd test +echo "The tests in test directory for $APPLICATION will be executed with ct_run" +if [ -z "${ARGS}" ] +then + if [ ! -d "$MAKE_TEST_DIR" ] + then + print_all_tests_for_application_notes + fi + if find . -type f -name '*.c' | grep -q "." + then + print_c_files_warning + fi +fi + +mkdir -p "$MAKE_TEST_DIR" +mkdir -p "$MAKE_TEST_REL_DIR" +mkdir -p "$MAKE_TEST_CT_LOGS" +make RELSYSDIR=$MAKE_TEST_REL_DIR release_tests_spec > $RELEASE_TEST_SPEC_LOG 2>&1 + +if [ $? != 0 ] +then + cat $RELEASE_TEST_SPEC_LOG + print_highlighted_msg $RED "\"make RELSYSDIR="$MAKE_TEST_REL_DIR" release_tests_spec\" failed." + exit 1 +fi +SPEC_FLAG="" +SPEC_FILE="" +if [ -z "${ARGS}" ] +then + SPEC_FLAG="-spec" + SPEC_FILE="$MAKE_TEST_REL_DIR/$APPLICATION.spec" + ARGS="$SPEC_FLAG $SPEC_FILE" +fi +# Compile test server +(cd "$ERL_TOP/lib/common_test/test_server" && make) +# Run ct_run +cd $MAKE_TEST_REL_DIR +$CT_RUN -logdir $MAKE_TEST_CT_LOGS\ + -pa "$ERL_TOP/lib/common_test/test_server"\ + ${ARGS}\ + -erl_args\ + -env "$PATH"\ + -env ERL_CRASH_DUMP "$MAKE_TEST_DIR/${APPLICATION}_erl_crash.dump"\ + -boot start_sasl\ + -sasl errlog_type error\ + -pz "$ERL_TOP/lib/common_test/test_server"\ + -pz "."\ + -ct_test_vars "{net_dir,\"\"}"\ + -noshell\ + -sname test_server\ + -rsh ssh\ + ${ERL_ARGS} +CT_RUN_STATUS=$? +if [ $CT_RUN_STATUS = "0" ] +then + print_highlighted_msg $GREEN "The test(s) ran successfully (ct_run returned a success code)\nTest logs: file://$MAKE_TEST_CT_LOGS/index.html" + exit 0 +else + print_on_error_note + print_highlighted_msg $RED "ct_run returned the error code $CT_RUN_STATUS\nTest logs: file://$MAKE_TEST_CT_LOGS/index.html" + exit $CT_RUN_STATUS +fi
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor