-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·80 lines (63 loc) · 2.24 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# MIT License
# Copyright (c) 2024 Saab AB
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
ROOT_DIR=$(pwd)
CONTAINER_ARTIFACTS_DIR=/models/app/src/main/java/models/artifacts
HOST_ARTIFACTS_DIR=$ROOT_DIR$CONTAINER_ARTIFACTS_DIR
gradle_run() {
$ROOT_DIR/saab-dse-wrapper.sh "--args=$@"
if [[ $? -ne 0 ]]; then
echo "Gradle command 'gradle run $@' failed"
exit 1
fi
}
if [[ $# -lt 2 ]]; then
echo "USAGE: ./run.sh <platform_name> <application_name>";
exit 1
fi
### store created files in unique folder
dirname=$1-$2-$(date +%T)
host_dirp=$HOST_ARTIFACTS_DIR/$dirname
mkdir -p $host_dirp
container_dirp=$CONTAINER_ARTIFACTS_DIR/$dirname
gradle_run "build $1 $2 $container_dirp"
plat=$1.fiodl
appl=$2.fiodl
### visualize specifications
gradle_run "to_kgt $container_dirp/$plat $container_dirp"
gradle_run "to_kgt $container_dirp/$appl $container_dirp"
### dse on constructed system models
$ROOT_DIR/idesyde-wrapper.sh \
"$container_dirp/$plat" \
"$container_dirp/$appl" \
--run-path $container_dirp \
-v DEBUG \
--x-total-time-out 6000
if [[ $? -ne 0 ]]; then
echo "DSE failed"
exit 1
fi
### quit if there are no reverse identified solutions
if [[ -z "$(ls -A $host_dirp/reversed)" ]]; then
echo "No solution found"
exit 1
fi
### visualize and parse solution
i=1
for fiodl_file in $host_dirp/reversed/*.fiodl; do
solution_name=solution_$i.fiodl
echo "Copying $fiodl_file to $host_dirp/$solution_name"
cp $fiodl_file $host_dirp/$solution_name
container_solultion_path=$container_dirp/$solution_name
gradle_run "to_kgt $container_solultion_path $container_dirp"
gradle_run "parse_solution $container_solultion_path $container_dirp"
((i++))
done