Merge lp:~dooferlad/linaro-license-protection/MANIFEST_generation_fix_and_test into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by James Tunnicliffe
Status: Merged
Approved by: Paul Sokolovsky
Approved revision: 43
Merged at revision: 43
Proposed branch: lp:~dooferlad/linaro-license-protection/MANIFEST_generation_fix_and_test
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 82 lines (+55/-1)
2 files modified
scripts/jenkins-post-www.sh (+10/-1)
scripts/test_jenkins-post-www.sh_test_structure.sh (+45/-0)
To merge this branch: bzr merge lp:~dooferlad/linaro-license-protection/MANIFEST_generation_fix_and_test
Reviewer Review Type Date Requested Status
Paul Sokolovsky Approve
Review via email: mp+91262@code.launchpad.net

Description of the change

Unfortunately the last change to MANIFEST generation didn't create MANIFEST files in the correct directory. This one does, and it now has a test, which clearly it needed all the time since there have been so many fixes to it.

To post a comment you must log in.
Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

Writing tests in shell is fun ;-). I'd at least add set -e there.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/jenkins-post-www.sh'
2--- scripts/jenkins-post-www.sh 2012-02-01 15:49:30 +0000
3+++ scripts/jenkins-post-www.sh 2012-02-02 12:52:19 +0000
4@@ -5,6 +5,14 @@
5 # Expected argument: ~username_jobname/buildno
6 build_path="$1"
7
8+if [[ -n $2 ]]; then
9+ BASE_PATH=$2
10+fi
11+
12+if [[ -n $3 ]]; then
13+ TARGET_PATH=$3
14+fi
15+
16 if [ -z "$build_path" ]; then
17 echo "Missing build path"
18 exit 1;
19@@ -22,6 +30,7 @@
20 fi
21
22 job_dir=$(dirname $build_path)
23+build_number=$(basename $build_path)
24 username=`echo "$job_dir" | cut -d_ -f1`
25 jobname=`echo "$job_dir" | cut -d_ -f2-`
26
27@@ -31,4 +40,4 @@
28 rm -rf $BASE_PATH/"$build_path" && \
29 echo "done")
30
31-cd "$TARGET_PATH/~$username/$jobname/" && find * -xtype f > MANIFEST
32+cd "$TARGET_PATH/~$username/$jobname/$build_number" && find * -xtype f > MANIFEST
33
34=== added file 'scripts/test_jenkins-post-www.sh_test_structure.sh'
35--- scripts/test_jenkins-post-www.sh_test_structure.sh 1970-01-01 00:00:00 +0000
36+++ scripts/test_jenkins-post-www.sh_test_structure.sh 2012-02-02 12:52:19 +0000
37@@ -0,0 +1,45 @@
38+#/bin/env bash
39+
40+# Test MANIFEST creation for jenkins-post-www.sh
41+
42+root=`mktemp -d`
43+
44+mkdir -p $root/from/user_build/1/subdir/anotherdir/yetanotherdir
45+touch $root/from/user_build/1/file1
46+touch $root/from/user_build/1/file2
47+touch $root/from/user_build/1/file3
48+touch $root/from/user_build/1/subdir/subfile1
49+touch $root/from/user_build/1/subdir/subfile2
50+touch $root/from/user_build/1/subdir/subfile3
51+
52+mkdir -p $root/from/user_build/2/subdir/anotherdir/yetanotherdir
53+touch $root/from/user_build/2/file1
54+touch $root/from/user_build/2/file2
55+touch $root/from/user_build/2/file3
56+touch $root/from/user_build/2/subdir/subfile1
57+touch $root/from/user_build/2/subdir/subfile2
58+touch $root/from/user_build/2/subdir/subfile3
59+
60+mkdir -p $root/to
61+
62+./jenkins-post-www.sh user_build/1 $root/from $root/to
63+
64+# MANIFEST should list all files, but no directories, in $root/from/user_build/1
65+
66+cat > $root/expected << EOF
67+file1
68+file2
69+file3
70+subdir/subfile3
71+subdir/subfile2
72+subdir/subfile1
73+EOF
74+
75+diff $root/expected $root/to/~user/build/1/MANIFEST
76+if [[ $? == 0 ]]; then
77+ echo "Passed"
78+else
79+ echo "Failed"
80+fi
81+
82+rm -r $root

Subscribers

People subscribed via source and target branches