summaryrefslogtreecommitdiffstats
path: root/build-gluster-org/scripts/netbsd7-regression.sh
blob: 75b2fddef476886cd20cd99c9038881df9165a35 (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
MY_ENV=$(env | sort)
BURL=${BUILD_URL}consoleFull

# Display all environment variables in the debugging log
echo "Start time $(date)"
echo
echo "Display all environment variables"
echo "*********************************"
echo
echo "$MY_ENV"
echo


# Exit early with success if the change is on release-3.{5,6}
# NetBSD regression doesn't run successfully on release-3.{5,6}
# FB gets a pass on regressions on their branch.
# Experimental also gets a pass
if [ "$GERRIT_BRANCH" = "release-3.5" ] || [ "$GERRIT_BRANCH" = "release-3.6" ] || [ "$GERRIT_BRANCH" = "release-3.8-fb" ] || [ "$GERRIT_BRANCH" = "experimental" ]; then
    echo "Skipping regression run for ${GERRIT_BRANCH}"
    RET=0
    VERDICT="Skipped for ${GERRIT_BRANCH}"
    V="+1"
    ssh nb7build@review.gluster.org gerrit review --message "'$BURL : $VERDICT'" --project=glusterfs --code-review=0 --label NetBSD-regression=$V $GIT_COMMIT
    exit $RET
fi

# Remove any gluster daemon leftovers from aborted runs
ps -axl | grep gluster
su -l root -c "pkill gluster"
su -l root -c /opt/qa/cleanup.sh >/dev/null 2>&1

# Fix installation permissions
su -l root -c "chown -R jenkins /usr/pkg/lib/python2.7/site-packages/gluster"

# Clean up the git repo
su -l root -c "rm -rf $WORKSPACE/.gitignore $WORKSPACE/*"
su -l root -c "chown -R jenkins $WORKSPACE"
cd $WORKSPACE || exit 1
git reset --hard HEAD

# Clean up other Gluster dirs
su -l root -c "rm -rf /var/lib/glusterd/* /build/install /build/scratch"

# Remove the many left over socket files in /var/run
su -l root -c "rm -f /var/run/glusterd.socket"

# Remove GlusterFS log files from previous runs
su -l root -c "rm -rf /var/log/glusterfs/* /var/log/glusterfs/.cmd_log_history"

# Skip tests for certain folders
SKIP=true
for file in $(git diff-tree --no-commit-id --name-only -r HEAD); do
    if [[ $file != doc/* ]] && [[ $file != build-aux/* ]] && [[ $file != tests/distaf/* ]]; then
        SKIP=false
        break
    fi
done
if [[ "$SKIP" == true ]]; then
    echo "Patch only modifies doc/*, build-aux/* or tests/distaf/*. Skipping further tests"
    RET=0
    VERDICT="Skipped tests for doc/*, build-aux/* or tests/distaf/* only change"
    V="+1"
    ssh nb7build@review.gluster.org gerrit review --message "'$BURL : $VERDICT'" --project=glusterfs --code-review=0 --label NetBSD-regression=$V $GIT_COMMIT
    exit $RET
fi

# Build Gluster
echo "Start time $(date)"
echo
echo "Build GlusterFS"
echo "***************"
echo
/opt/qa/build.sh
RET=$?
if [ $RET != 0 ]; then
    # Build failed, so abort early
    VERDICT="FAILED"
    V="-1"
    ssh nb7build@review.gluster.org gerrit review --message "'$BURL : $VERDICT'" --project=glusterfs --code-review=0 --label NetBSD-regression=$V $GIT_COMMIT
    exit $RET
fi
echo

# regression tests assumes build is done inside source directory
# which is not the case here. The simpliest fix is to copy the
# required object back to source directory
cp /build/scratch/contrib/argp-standalone/libargp.a \
   $WORKSPACE/contrib/argp-standalone

# Run the regression test
echo "Start time $(date)"
echo "Run the regression test"
echo "***********************"
echo
su -l root -c "cd $WORKSPACE && /opt/qa/regression.sh"