2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
12 # This script tests jjb templates by comparing the result with expected output.
15 script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
16 expected_xml_dir="$script_dir/.jjb-test/expected-xml"
18 echo "Script Directory: $script_dir"
19 echo "Test Directory: $test_dir"
21 jenkins-jobs test --recursive -o "$test_dir" "$script_dir":.jjb-test
24 for xml in "$test_dir"/*; do
25 job=$(basename "$xml")
26 if ! cmp "$expected_xml_dir/$job" "$xml"; then
27 echo "Differences detected in $job"
28 diff "$expected_xml_dir/$job" "$xml"
37 echo "Differences detected. Check above for jobs that have been changed."