11.08., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Commit d9019566 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen

resolve merge conflict with local changes (HEAD).

parents a2895ab1 72194a05
Pipeline #68150 failed with stages
in 46 seconds
......@@ -3,6 +3,9 @@ target/
#Tools and build utils
......@@ -17,22 +20,38 @@ target/
#model test output
VadereModelTests/TestOSM/processed output/*
VadereModelTests/TestOSM_Group/processed output/*
VadereModelTests/TestSFM/processed output/*
VadereModelTests/TestGNM/processed output/*
VadereModelTests/TestOVM/processed output/*
#deprecated: can potentially be removed
#mac osx files
#linux deskopt dotfiles
# # GitLab CI Jobs
# Each of the jobs defined here is triggered by GitLab's CI pipeline.
# ## GitLab YAML Job Description Syntax
# <job_name>: # Job name which is displayed in web interface.
# stage: <stage_name> # <build|test|deploy>: these stages are executed
# # one after another. A stage can contain multiple
# # jobs.
# script:
# - <arbitrary_commands> # Here you can execute arbitratry terminal
# # commands. If any of the commands return a
# # non-zero exit code, the job fails.
# ## Maven Syntax for Skipping Unit Tests
# General syntax to execute unit tests:
# ```
# mvn test
# ```
# The comma-separated list of tests after "-Dtest=<list>" is skipped. All other
# tests are executed normally:
# ```
# mvn -Dtest=!TestClassA,!TestClassB,!TestClassC
# ```
# **Note:** on some CI instances the exclamation mark must be escaped by a
# backslash. Otherwise, it is interpreted by the executing shell as special
# command.
# ## Unit Test Limitations
# **Watch out:** OpenCL code cannot be run on virtual machines where tests are
# executed. Therefore, skip this tests.
stage: test
- mvn clean
- mvn -Dtest=!TestConvolution,!TestBitonicSort,!TestCLLinkedList test
- python3 Tools/ContinuousIntegration/collect_line_and_branch_coverage.py
stage: deploy
- mvn clean
- mvn -Dmaven.test.skip=true package
- python3 Tools/ContinuousIntegration/run_vadere_console_with_all_scenario_files.py
Copy files "post-checkout", "post-merge", "post-applypatch" and "post-commit" to .git/hooks/
The file "current_commit_hash.txt" will be created after a change to the current commit status. To create this file without changes to the current commit, you can choose "Switch/Checkout..." on the Repository folder.
\ No newline at end of file
......@@ -47,8 +47,9 @@ For this project, GPGPU with OpenCL is used to speed up some computations. There
### Run the Application
1. Get the Source: Run `git clone https://gitlab.lrz.de/vadere/vadere.git`.
2. Build the Application: Go to the project directory and run `mvn clean package` (or `mvn clean package -DskipTests` if you want to skip the unit tests).
3. Start the Application: After building the application, you can start Vadere by running `java -jar VadereGui/target/gui-0.1-SNAPSHOT-jar-with-dependencies.jar`.
2. Build the Application: Go to the project directory and run `mvn clean package` (or `mvn clean package -DskipTests` if you want to skip the unit tests). This will build `vadere.jar`and `postvis.jar`.
3. Start the Application: After building the application, you can start Vadere by running `java -jar VadereGui/target/vadere.jar`.
4. (If you only want to use the Postvisualization-Tool you can do so by running `java -jar VadereGui/target/postvis.jar`).
## Usage Example
# Extract line and branch coverage (in percentage) from HTML coverage reports
# which are created by Maven's jacoco plugin.
# Use top-level pom.xml to search in correct subdirectories.
# Wach out: call this script from root directory of project. E.g.
# python Tools/my_script.py
import xml.etree.ElementTree as ET
import os
import re
def get_modules_from_pom_file(filename="pom.xml"):
"""Return a list of submodules which where found in passed "pom.xml"."""
xml_name_spaces = {
"default": "http://maven.apache.org/POM/4.0.0"
xml_tree = ET.parse(filename)
xml_root = xml_tree.getroot()
exclude_list = ["./VadereAnnotation", "./VadereGui"]
modules = xml_root.findall("default:modules/default:module", xml_name_spaces)
module_names = [module.text for module in modules if module.text not in exclude_list]
return module_names
def extract_line_and_branch_coverage(module_names):
"""Return a dictionary which maps module name to line and branch coverage tuple."""
module_to_coverage = dict()
default_coverage_file = "target/site/coverage-reports/index.html"
for module in module_names:
coverage_path = os.path.join(module, default_coverage_file)
with open(coverage_path, "r") as file:
coverage_report = file.read()
regex_pattern = re.compile(r"Total.*?([0-9]{1,3})%.*?([0-9]{1,3})%")
match = regex_pattern.search(coverage_report)
if match:
line_coverage = float(match.group(1))
branch_coverage = float(match.group(2))
module_to_coverage[module] = (line_coverage, branch_coverage)
raise Exception("Coverage data not found for module: {}".format(module))
return module_to_coverage
def print_averaged_line_coverage(coverage_data):
"""GitLab CI tools read out the stdout output of the build process. Therefore, print coverage info to stdout."""
total_modules = len(coverage_data)
line_coverage_data = [line_coverage for (line_coverage, branch_coverage) in coverage_data.values()]
branch_coverage_data = [branch_coverage for (line_coverage, branch_coverage) in coverage_data.values()]
summed_line_coverage_data = sum(line_coverage_data)
summed_branch_coverage_data = sum(branch_coverage_data)
# By default, GitLab CI parses only integers.
averaged_line_coverage = int(round(summed_line_coverage_data / total_modules, 0))
averaged_branch_coverage = int(round(summed_branch_coverage_data / total_modules, 0))
print("Analyzed modules: {}".format(sorted(coverage_data.keys())))
print("Line Coverage: Total {}%".format(averaged_line_coverage))
print("Branch Coverage: Total {}%".format(averaged_branch_coverage))
if __name__ == "__main__":
module_names = get_modules_from_pom_file()
module_to_coverage = extract_line_and_branch_coverage(module_names)
# Use "vadere-console.jar", which is created by "mvn package", to run all
# scenario files under "VadereModelTests" subdirectory.
# Note: script contains some print statements so that progress can be tracked
# a little bit
# Wach out: call this script from root directory of project. E.g.
# python Tools/my_script.py
import fnmatch
import os
import re
import shutil
import subprocess
import time
def find_scenario_files(path="VadereModelTests", scenario_search_pattern = "*.scenario", exclude_patterns = ["TESTOVM", "output","legacy"]):
scenario_files = []
for root, dirnames, filenames in os.walk(path):
for filename in fnmatch.filter(filenames, scenario_search_pattern):
scenario_path = os.path.join(root, filename)
scenario_path_excluded = False
for exclude_pattern in exclude_patterns:
regex_pattern = re.compile(exclude_pattern)
match = regex_pattern.search(scenario_path)
if match:
scenario_path_excluded = True
if scenario_path_excluded == False:
print("Total scenario files: {}".format(len(scenario_files)))
# print("Exclude patterns: {}".format(exclude_patterns))
return sorted(scenario_files)
def run_scenario_files_with_vadere_console(scenario_files, vadere_console="VadereGui/target/vadere-console.jar", scenario_timeout_in_sec=60):
output_dir = "output"
if not os.path.exists(output_dir):
total_scenario_files = len(scenario_files)
passed_scenarios = []
failed_scenarios_with_exception = []
for i, scenario_file in enumerate(scenario_files):
# Surpress this output to print only failed scenarios.
# print("Running scenario file ({}/{}): {}".format(i + 1, total_scenario_files, scenario_file))
# Measure wall time and not cpu because it is the easiest.
wall_time_start = time.time()
# Use timout feature, check return value and capture stdout/stderr to a PIPE (use completed_process.stdout to get it).
completed_process = subprocess.run(args=["java", "-enableassertions", "-jar", vadere_console, "scenario-run", "-f", scenario_file, "-o", output_dir],
wall_time_end = time.time()
wall_time_delta = wall_time_end - wall_time_start
# Surpress this output to print only failed scenarios.
# print("Finished scenario file ({:.1f} s): {}".format(wall_time_delta, scenario_file))