Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 1 | #!/bin/sh -e |
| 2 | PROJECT="$1" |
| 3 | PROJECT_UPPER="$(echo "$PROJECT" | tr '[:lower:]' '[:upper:]')" |
| 4 | DIR_OSMODEV="$(readlink -f "$(dirname $0)/..")" |
| 5 | DIR_MAKE="${DIR_MAKE:-${DIR_OSMODEV}/ttcn3/make}" |
| 6 | DIR_OUTPUT="${DIR_OUTPUT:-${DIR_OSMODEV}/ttcn3/out}" |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 7 | DIR_USR_LOCAL="$DIR_OSMODEV/ttcn3/usr_local" |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 8 | JOBS="${JOBS:-9}" |
| 9 | |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 10 | # Osmocom libraries and programs relevant for the current testsuite will be |
| 11 | # built in this container. It must have all build dependencies available and |
| 12 | # be based on the same distribution that master-* containers are based on, so |
| 13 | # there are no incompatibilities with shared libraries. |
Oliver Smith | d88ae26 | 2022-05-03 12:53:25 +0200 | [diff] [blame] | 14 | DOCKER_IMG_BUILD="debian-bullseye-build" |
Oliver Smith | 9326b36 | 2023-04-20 12:56:15 +0200 | [diff] [blame] | 15 | DOCKER_IMG_TITAN="debian-bullseye-titan" |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 16 | |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 17 | check_usage() { |
Oliver Smith | 6711b4f | 2023-03-06 11:20:15 +0100 | [diff] [blame] | 18 | local name="$(basename $0)" |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 19 | if [ -z "$PROJECT" ]; then |
Oliver Smith | 6711b4f | 2023-03-06 11:20:15 +0100 | [diff] [blame] | 20 | echo "usage: $name PROJECT" |
| 21 | echo "examples:" |
| 22 | echo " * $name bsc" |
| 23 | echo " * $name bsc-sccplite" |
| 24 | echo " * $name hlr" |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 25 | exit 1 |
| 26 | fi |
| 27 | } |
| 28 | |
| 29 | # Returns the name of the testsuite binary |
| 30 | get_testsuite_name() { |
| 31 | case "$PROJECT" in |
| 32 | bts-*) echo "BTS_Tests" ;; |
| 33 | mgw) echo "MGCP_Test" ;; |
| 34 | pcu-sns) echo "PCU_Tests" ;; |
| 35 | *) echo "${PROJECT_UPPER}_Tests" ;; |
| 36 | esac |
| 37 | } |
| 38 | |
| 39 | get_testsuite_dir() { |
| 40 | local hacks="${DIR_OSMODEV}/src/osmo-ttcn3-hacks" |
| 41 | |
| 42 | case "$PROJECT" in |
| 43 | bts-*) echo "$hacks/bts" ;; |
Oliver Smith | 6711b4f | 2023-03-06 11:20:15 +0100 | [diff] [blame] | 44 | bsc-*) echo "$hacks/bsc" ;; |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 45 | pcu-sns) echo "$hacks/pcu" ;; |
| 46 | *) echo "$hacks/$PROJECT" ;; |
| 47 | esac |
| 48 | } |
| 49 | |
| 50 | get_testsuite_config() { |
| 51 | case "$PROJECT" in |
| 52 | bts-gprs) echo "BTS_Tests_GPRS.cfg" ;; |
| 53 | bts-oml) echo "BTS_Tests_OML.cfg" ;; |
| 54 | pcu-sns) echo "PCU_Tests_SNS.cfg" ;; |
| 55 | *) echo "$(get_testsuite_name).cfg" ;; |
| 56 | esac |
| 57 | } |
| 58 | |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 59 | get_testsuite_dir_docker() { |
| 60 | local dp="${DIR_OSMODEV}/src/docker-playground" |
| 61 | |
| 62 | case "$PROJECT" in |
Oliver Smith | 6711b4f | 2023-03-06 11:20:15 +0100 | [diff] [blame] | 63 | bsc-*) |
| 64 | echo "$dp/ttcn3-bsc-test-$(echo "$PROJECT" | cut -d - -f 2-)" |
| 65 | ;; |
| 66 | *) |
| 67 | echo "$dp/ttcn3-$PROJECT-test" |
| 68 | ;; |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 69 | esac |
| 70 | } |
| 71 | |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 72 | get_testsuite_image() { |
| 73 | case "$PROJECT" in |
Oliver Smith | 6711b4f | 2023-03-06 11:20:15 +0100 | [diff] [blame] | 74 | bsc-*) |
| 75 | echo "$USER/ttcn3-bsc-test" |
| 76 | ;; |
| 77 | *) |
| 78 | echo "$USER/ttcn3-$PROJECT-test" |
| 79 | ;; |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 80 | esac |
| 81 | } |
| 82 | |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 83 | # Programs that need to be built |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 84 | get_programs() { |
| 85 | case "$PROJECT" in |
Oliver Smith | 6711b4f | 2023-03-06 11:20:15 +0100 | [diff] [blame] | 86 | bsc|bsc-*) echo "osmo-stp osmo-bsc osmo-bts-omldummy" ;; |
Oliver Smith | 855d66e | 2021-08-12 16:58:26 +0200 | [diff] [blame] | 87 | bts) echo "osmo-bsc osmo-bts-trx" ;; |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 88 | msc) echo "osmo-stp osmo-msc" ;; |
| 89 | pcu-sns) echo "osmo-pcu" ;; |
Oliver Smith | 855d66e | 2021-08-12 16:58:26 +0200 | [diff] [blame] | 90 | pcu) echo "osmo-pcu osmo-bsc osmo-bts-virtual" ;; |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 91 | sgsn) echo "osmo-stp osmo-sgsn" ;; |
Oliver Smith | 01401bc | 2019-11-28 12:19:28 +0100 | [diff] [blame] | 92 | sip) echo "osmo-sip-connector" ;; |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 93 | *) echo "osmo-$PROJECT" ;; |
| 94 | esac |
| 95 | } |
| 96 | |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 97 | # Return the git repository name, which has the source for a specific program. |
| 98 | # $1: program name |
| 99 | get_program_repo() { |
| 100 | case "$1" in |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 101 | osmo-bts-*) echo "osmo-bts" ;; |
Oliver Smith | f03dfa3 | 2021-08-09 09:09:04 +0200 | [diff] [blame] | 102 | osmo-pcap-*) echo "osmo-pcap" ;; |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 103 | osmo-stp) echo "libosmo-sccp" ;; |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 104 | *) echo "$1" ;; |
| 105 | esac |
| 106 | } |
| 107 | |
| 108 | check_ttcn3_install() { |
| 109 | if ! command -v ttcn3_compiler > /dev/null; then |
| 110 | echo "ERROR: ttcn3_compiler is not installed." |
| 111 | echo "Install eclipse-titan from the Osmocom latest repository." |
| 112 | echo "Details: https://osmocom.org/projects/cellular-infrastructure/wiki/Titan_TTCN3_Testsuites" |
| 113 | exit 1 |
| 114 | fi |
| 115 | } |
| 116 | |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 117 | setup_dir_make() { |
| 118 | cd "$DIR_OSMODEV" |
| 119 | |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 120 | local docker_cmd="$DIR_OSMODEV/ttcn3/scripts/docker_configure_make.sh" |
| 121 | docker_cmd="$docker_cmd $USER/$DOCKER_IMG_BUILD" |
| 122 | |
Oliver Smith | 10da26d | 2020-01-07 13:17:54 +0100 | [diff] [blame] | 123 | ./gen_makefile.py \ |
Oliver Smith | 10da26d | 2020-01-07 13:17:54 +0100 | [diff] [blame] | 124 | default.opts \ |
| 125 | iu.opts \ |
| 126 | no_systemd.opts \ |
| 127 | no_doxygen.opts \ |
| 128 | no_dahdi.opts \ |
| 129 | no_optimization.opts \ |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 130 | ttcn3/ttcn3.opts \ |
Oliver Smith | d327106 | 2021-08-25 11:47:48 +0200 | [diff] [blame] | 131 | werror.opts \ |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 132 | --docker-cmd "$docker_cmd" \ |
| 133 | --make-dir "$DIR_MAKE" \ |
Oliver Smith | 7ece249 | 2021-08-23 16:56:39 +0200 | [diff] [blame] | 134 | --no-ldconfig \ |
Oliver Smith | 6c7fed8 | 2021-10-04 13:30:31 +0200 | [diff] [blame] | 135 | --no-make-check \ |
| 136 | --auto-distclean |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | # $1: name of repository (e.g. osmo-ttcn3-hacks) |
| 140 | clone_repo() { |
Oliver Smith | 5f611c7 | 2021-08-26 18:03:17 +0200 | [diff] [blame] | 141 | if ! [ -e "$DIR_OSMODEV/ttcn3/make/.make.${1}.clone" ]; then |
| 142 | make -C "$DIR_MAKE" ".make.${1}.clone" |
| 143 | fi |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 144 | } |
| 145 | |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 146 | # Require testsuite dir and docker-playground dir |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 147 | check_dir_testsuite() { |
| 148 | local program |
| 149 | local config_testsuite |
| 150 | local dir_testsuite="$(get_testsuite_dir)" |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 151 | local dir_testsuite_docker="$(get_testsuite_dir_docker)" |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 152 | |
| 153 | if ! [ -d "$dir_testsuite" ]; then |
| 154 | echo "ERROR: project '$PROJECT' is invalid, resulting path not found: $dir_testsuite" |
| 155 | exit 1 |
| 156 | fi |
| 157 | |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 158 | if ! [ -d "$dir_testsuite_docker" ]; then |
Oliver Smith | 78a1e05 | 2023-03-06 11:12:23 +0100 | [diff] [blame] | 159 | echo "ERROR: could not find docker dir for project: $PROJECT: $dir_testsuite_docker" |
| 160 | echo "Adjust get_testsuite_dir_docker?" |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 161 | exit 1 |
| 162 | fi |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 163 | |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 164 | # Sanity check for jenkins.sh |
| 165 | if ! grep -q DOCKER_ARGS $dir_testsuite_docker/jenkins.sh; then |
| 166 | echo "ERROR: DOCKER_ARGS not found in $dir_testsuite_docker/jenkins.sh!" |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 167 | exit 1 |
| 168 | fi |
| 169 | } |
| 170 | |
Oliver Smith | 1b471a9 | 2020-04-27 12:00:25 +0200 | [diff] [blame] | 171 | # Copy scripts from docker-playground to /usr/local/bin, so we don't miss them when mounting the outside /usr/local/bin |
| 172 | # inside the docker container |
| 173 | prepare_local_bin() { |
| 174 | local scripts=" |
Oliver Smith | 7531cea | 2021-06-01 13:29:56 +0200 | [diff] [blame] | 175 | ${DIR_OSMODEV}/src/docker-playground/common/respawn.sh |
Oliver Smith | 837d4d6 | 2023-04-17 14:20:34 +0200 | [diff] [blame] | 176 | ${DIR_OSMODEV}/src/docker-playground/common/ttcn3-docker-run.sh |
Oliver Smith | 1b471a9 | 2020-04-27 12:00:25 +0200 | [diff] [blame] | 177 | " |
| 178 | |
| 179 | for script in $scripts; do |
Oliver Smith | 6f7954e | 2021-06-01 14:14:06 +0200 | [diff] [blame] | 180 | local script_path_localbin |
| 181 | local name_install="$(basename "$script")" |
| 182 | |
| 183 | case "$name_install" in |
| 184 | ttcn3-docker-run.sh) name_install="ttcn3-docker-run" ;; |
| 185 | esac |
| 186 | |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 187 | script_path_localbin="$DIR_USR_LOCAL/bin/$name_install" |
Oliver Smith | 1b471a9 | 2020-04-27 12:00:25 +0200 | [diff] [blame] | 188 | if [ -x "$script_path_localbin" ]; then |
| 189 | continue |
| 190 | fi |
| 191 | |
Oliver Smith | 7531cea | 2021-06-01 13:29:56 +0200 | [diff] [blame] | 192 | install -v -Dm755 "$script" "$script_path_localbin" |
Oliver Smith | 1b471a9 | 2020-04-27 12:00:25 +0200 | [diff] [blame] | 193 | done |
| 194 | } |
| 195 | |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 196 | prepare_docker_build_container() { |
Oliver Smith | 3115b12 | 2023-04-20 13:10:30 +0200 | [diff] [blame] | 197 | local dp="${DIR_OSMODEV}/src/docker-playground" |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 198 | |
Oliver Smith | 3115b12 | 2023-04-20 13:10:30 +0200 | [diff] [blame] | 199 | if docker_image_exists "$USER/$DOCKER_IMG_BUILD"; then |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 200 | return |
| 201 | fi |
| 202 | |
Oliver Smith | 3115b12 | 2023-04-20 13:10:30 +0200 | [diff] [blame] | 203 | echo "Building docker image: $USER/$DOCKER_IMG_BUILD" |
| 204 | make -C "$dp/$DOCKER_IMG_BUILD" |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 205 | } |
| 206 | |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 207 | prepare_docker_testsuite_container() { |
Oliver Smith | 3115b12 | 2023-04-20 13:10:30 +0200 | [diff] [blame] | 208 | local testsuite_image="$(get_testsuite_image)" |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 209 | |
Oliver Smith | 3115b12 | 2023-04-20 13:10:30 +0200 | [diff] [blame] | 210 | if docker_image_exists "$testsuite_image"; then |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 211 | return |
| 212 | fi |
| 213 | |
Oliver Smith | 3115b12 | 2023-04-20 13:10:30 +0200 | [diff] [blame] | 214 | if ! docker_image_exists "$USER/$DOCKER_IMG_TITAN"; then |
| 215 | echo "Building docker image: $USER/$DOCKER_IMG_TITAN" |
| 216 | local dp="${DIR_OSMODEV}/src/docker-playground" |
| 217 | make -C "$dp/$DOCKER_IMG_TITAN" |
| 218 | fi |
| 219 | |
| 220 | echo "Building docker image: $testsuite_image" |
| 221 | local testsuite_dir="$(get_testsuite_dir_docker)" |
| 222 | make -C "$testsuite_dir" |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 223 | } |
| 224 | |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 225 | # Use osmo-dev to build one Osmocom program and its dependencies |
| 226 | build_osmo_programs() { |
| 227 | local program |
Oliver Smith | 8d8ddf4 | 2021-08-26 17:56:02 +0200 | [diff] [blame] | 228 | local programs="$(get_programs)" |
| 229 | local make_args="-C $DIR_MAKE" |
| 230 | |
| 231 | for program in $programs; do |
| 232 | local repo="$(get_program_repo "$program")" |
| 233 | make_args="$make_args $repo" |
| 234 | done |
| 235 | |
| 236 | set -x |
| 237 | make $make_args |
| 238 | set +x |
| 239 | |
| 240 | for program in $programs; do |
| 241 | local repo="$(get_program_repo "$program")" |
| 242 | local usr_local_bin="$DIR_USR_LOCAL/bin" |
| 243 | |
| 244 | if [ -z "$(find "$usr_local_bin" -name "$program")" ]; then |
| 245 | echo "ERROR: program was not installed properly: $program" |
| 246 | echo "Expected it to be in path: $PATH_dest" |
| 247 | exit 1 |
| 248 | fi |
| 249 | |
| 250 | local reference="$DIR_MAKE/.make.$repo.build" |
| 251 | if [ -z "$(find "$usr_local_bin" -name "$program" -newer "$reference")" ]; then |
| 252 | echo "ERROR: $path is outdated!" |
| 253 | echo "Maybe you need to pass a configure argument to $repo.git, so it builds and installs" \ |
| 254 | "$program?" |
| 255 | exit 1 |
| 256 | fi |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 257 | done |
| 258 | } |
| 259 | |
Oliver Smith | 9326b36 | 2023-04-20 12:56:15 +0200 | [diff] [blame] | 260 | docker_image_exists() { |
| 261 | test -n "$(docker images -q "$1")" |
| 262 | } |
| 263 | |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 264 | build_testsuite() { |
| 265 | cd "$(get_testsuite_dir)" |
Oliver Smith | 389dafb | 2020-04-27 14:33:15 +0200 | [diff] [blame] | 266 | |
| 267 | local deps_marker="${DIR_OSMODEV}/ttcn3/make/.ttcn3-deps" |
| 268 | if ! [ -e "$deps_marker" ]; then |
| 269 | make -C "${DIR_OSMODEV}/src/osmo-ttcn3-hacks/deps" -j"$JOBS" |
| 270 | touch "$deps_marker" |
| 271 | fi |
| 272 | |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 273 | # Build inside docker, so the resulting binary links against the |
| 274 | # libraries available in docker and not the ones from the host system, |
| 275 | # since we will run it inside docker later too. |
| 276 | local hacks="${DIR_OSMODEV}/src/osmo-ttcn3-hacks" |
| 277 | |
Oliver Smith | f44fd1b | 2023-03-06 11:24:08 +0100 | [diff] [blame] | 278 | local testsuite_image="$(get_testsuite_image)" |
| 279 | echo "testsuite_image: $testsuite_image" |
| 280 | |
Oliver Smith | ba1cfcc | 2022-10-21 12:11:18 +0200 | [diff] [blame] | 281 | # -t: add a tty, so we get color output from the compiler |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 282 | docker run \ |
| 283 | --rm \ |
Oliver Smith | ba1cfcc | 2022-10-21 12:11:18 +0200 | [diff] [blame] | 284 | -t \ |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 285 | -v "$hacks:/osmo-ttcn3-hacks" \ |
Oliver Smith | f44fd1b | 2023-03-06 11:24:08 +0100 | [diff] [blame] | 286 | "$testsuite_image" \ |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 287 | sh -exc " |
| 288 | cd /osmo-ttcn3-hacks/$(basename "$(get_testsuite_dir)"); |
| 289 | ./gen_links.sh; |
| 290 | ./regen_makefile.sh; |
| 291 | make compile; |
| 292 | make -j"$JOBS" |
| 293 | " |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 294 | } |
| 295 | |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 296 | run_docker() { |
| 297 | local hacks="${DIR_OSMODEV}/src/osmo-ttcn3-hacks" |
| 298 | local docker_dir="$(get_testsuite_dir_docker)" |
| 299 | local docker_name="$(basename "$docker_dir")" |
Oliver Smith | f3eb0ba | 2021-08-10 15:41:47 +0200 | [diff] [blame] | 300 | local marker="${DIR_OSMODEV}/ttcn3/make/.docker.$docker_name.$IMAGE_SUFFIX" |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 301 | |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 302 | # Skip building docker containers if this already ran |
| 303 | if [ -e "$marker" ]; then |
| 304 | echo "NOTE: skipping docker container build, because marker exists: $marker" |
| 305 | export NO_DOCKER_IMAGE_BUILD=1 |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 306 | fi |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 307 | |
| 308 | cd "$(get_testsuite_dir_docker)" |
Oliver Smith | bfe5929 | 2021-08-12 11:15:40 +0200 | [diff] [blame] | 309 | export DOCKER_ARGS="\ |
| 310 | -e LD_LIBRARY_PATH=/usr/local/lib \ |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 311 | -v "$DIR_USR_LOCAL":/usr/local:ro \ |
Oliver Smith | bfe5929 | 2021-08-12 11:15:40 +0200 | [diff] [blame] | 312 | -v $hacks:/osmo-ttcn3-hacks:ro \ |
| 313 | " |
Oliver Smith | 6b84b46 | 2021-07-09 10:12:18 +0200 | [diff] [blame] | 314 | export NO_LIST_OSMO_PACKAGES=1 |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 315 | ./jenkins.sh |
| 316 | |
| 317 | touch "$marker" |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 318 | } |
| 319 | |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 320 | remove_old_logs() { |
| 321 | sudo rm -rf /tmp/tmp.* 2>/dev/null |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | collect_logs() { |
| 325 | # Merge and move logs |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 326 | cd /tmp/logs/*-tester |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 327 | |
| 328 | # Format logs |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 329 | for log in *.merged; do |
| 330 | ttcn3_logformat -o "${log}.log" "$log" |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 331 | sudo rm "$log" |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 332 | done |
| 333 | |
| 334 | # Print log path |
| 335 | echo "---" |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 336 | echo "Logs: /tmp/logs" |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 337 | echo "---" |
| 338 | } |
| 339 | |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 340 | check_usage |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 341 | check_ttcn3_install |
| 342 | setup_dir_make |
| 343 | clone_repo "osmo-ttcn3-hacks" |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 344 | clone_repo "docker-playground" |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 345 | check_dir_testsuite |
Oliver Smith | 1b471a9 | 2020-04-27 12:00:25 +0200 | [diff] [blame] | 346 | prepare_local_bin |
Oliver Smith | 0fa204e | 2021-08-12 15:16:11 +0200 | [diff] [blame] | 347 | prepare_docker_build_container |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 348 | build_osmo_programs |
Oliver Smith | f3d7120 | 2022-10-18 15:43:31 +0200 | [diff] [blame] | 349 | prepare_docker_testsuite_container |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 350 | build_testsuite |
| 351 | remove_old_logs |
Oliver Smith | 01a510a | 2020-03-18 15:46:41 +0100 | [diff] [blame] | 352 | run_docker |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 353 | collect_logs |