Skip to content

Commit ca81de7

Browse files
committed
Merge branch 'develop'
2 parents ad4f582 + 3813e71 commit ca81de7

4 files changed

Lines changed: 75 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### citustools v0.7.10 (May 28, 2019) ###
2+
3+
* Add custom branch support for valgrind tests
4+
5+
* Add `--diff` option to `citus_indent`
6+
17
### citustools v0.7.9 (August 15, 2018) ###
28

39
* Update PG11 build to use `REL_11_STABLE`, not `master`

uncrustify/citus_indent

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@ use POSIX qw(setlocale LC_ALL);
99
local $ENV{'PATH'} = '/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin';
1010
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
1111

12-
my ($quiet, $check);
13-
exit 64 unless GetOptions ('quiet' => \$quiet, 'check' => \$check);
12+
my ($quiet, $check, $diff);
13+
exit 64 unless GetOptions ('quiet' => \$quiet, 'check' => \$check, 'diff' => \$diff);
1414

15-
my $null_delimited_triples = `git ls-files -z | git check-attr --stdin -z citus-style`;
15+
my $null_delimited_triples = ($diff ?
16+
`git diff --cached --name-only -z | git check-attr --stdin -z citus-style` :
17+
`git ls-files -z | git check-attr --stdin -z citus-style`
18+
);
1619
my @flattened_triples = split(/\x00/, $null_delimited_triples);
1720
my $exit_code = $? >> 8;
1821

1922
die "could not list files under source control\n" if $exit_code;
2023

24+
# exit if there are no files to check
25+
print "no files to check" if !@flattened_triples && !$quiet;
26+
exit if !@flattened_triples;
27+
2128
my @files_to_format = ();
2229
my @formatter_args = qw(-c /usr/local/etc/citustools/citus-style.cfg);
2330

@@ -88,6 +95,11 @@ Do not modify any files, instead simply verify that all files eligible for
8895
formatting are compliant with Citus Data style. The exit code I<EXIT_SUCCESS>
8996
signals that a codebase is compliant, otherwise I<EXIT_FAILURE> is used.
9097
98+
=item B<--diff>
99+
100+
Only check files that are staged for commit. This is primarily useful when used
101+
in a pre-commit hook as it is generally faster to only check the changed files.
102+
91103
=back
92104
93105
=head1 FILES

valgrind/launch-test-instance

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
set -euo pipefail
44

5+
REPORT_EMAIL=${REPORT_EMAIL:-burak@citusdata.com metin@citusdata.com furkan@citusdata.com}
6+
POSTGRES_GITREF=${POSTGRES_GITREF:-REL_11_STABLE}
7+
CITUS_GITREF=${CITUS_GITREF:-master}
8+
9+
echo "ENV:"
10+
echo " REPORT_EMAIL:" $REPORT_EMAIL
11+
echo " POSTGRES_GITREF:" $POSTGRES_GITREF
12+
echo " CITUS_GITREF:" $CITUS_GITREF
13+
14+
# when running in a tty wait for the human to press enter, this is to allow the human to verify the settings
15+
# when running as a crontab it will just continue
16+
if [ -t 1 ] ; then
17+
read -p "Press enter to continue"
18+
fi
19+
520
# create a key pair just for valgrind tests and store it in valgrind-test.pem
621
echo "Creating key pair..."
722
key_name=valgrind_$RANDOM
@@ -16,9 +31,10 @@ valgrind_instance_id=$(aws ec2 run-instances \
1631
--instance-type r3.2xlarge \
1732
--key-name $key_name \
1833
--instance-initiated-shutdown-behavior terminate \
19-
--user-data file:///usr/local/bin/download-test-scripts \
34+
--user-data file://download-test-scripts \
2035
--query 'Instances[0].InstanceId' \
2136
--output text)
37+
echo " instance id:" $valgrind_instance_id
2238

2339
# tag the instance as ValgrindTest
2440
echo "Tagging the instance..."
@@ -41,7 +57,19 @@ valgrind_instance_ip=$(aws ec2 describe-instances \
4157
# run valgrind tests
4258
echo "Running the valgrind tests..."
4359
echo "This will take hours, test results will be sent via e-mail."
44-
ssh -o StrictHostKeyChecking=no -i $key_name.pem ubuntu@$valgrind_instance_ip "screen -d -m run-valgrind-tests"
60+
ssh \
61+
-o IdentitiesOnly=yes \
62+
-o StrictHostKeyChecking=no \
63+
-i $key_name.pem \
64+
ubuntu@$valgrind_instance_ip \
65+
REPORT_EMAIL="${REPORT_EMAIL}" \
66+
POSTGRES_GITREF="${POSTGRES_GITREF}" \
67+
CITUS_GITREF="${CITUS_GITREF}" \
68+
screen -d -m run-valgrind-tests
69+
70+
echo login:
71+
echo " " ssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -i $key_name.pem ubuntu@$valgrind_instance_ip
72+
echo
4573

4674
#delete the key pair after we are done with tests
4775
aws ec2 delete-key-pair --key-name $key_name

valgrind/run-valgrind-tests

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
set -euo pipefail
44

5+
REPORT_EMAIL=${REPORT_EMAIL:-burak@citusdata.com metin@citusdata.com furkan@citusdata.com}
6+
CITUS_GITREF=${CITUS_GITREF:-master}
7+
POSTGRES_GITREF=${POSTGRES_GITREF:-REL_11_STABLE}
8+
9+
echo "ENV:"
10+
echo " REPORT_EMAIL:" $REPORT_EMAIL
11+
echo " POSTGRES_GITREF:" $POSTGRES_GITREF
12+
echo " CITUS_GITREF:" $CITUS_GITREF
13+
14+
ulimit -c unlimited
15+
516
# download and install required packages
617
sudo apt-get update
718
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq \
@@ -20,31 +31,30 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq \
2031
export LC_ALL=en_US.UTF-8
2132
export LANG=en_US.UTF-8
2233
export LANGUAGE=en_US.UTF-8
23-
export PG_CONFIG=/usr/local/pgsql/bin/pg_config
34+
export PATH=$HOME/pgsql/bin:$PATH
2435

2536
# download and install PostgreSQL
26-
git clone -b "REL_10_STABLE" --depth 1 git://git.postgresql.org/git/postgresql.git
37+
git clone -b "${POSTGRES_GITREF}" --depth 1 git://git.postgresql.org/git/postgresql.git
2738
cd postgresql/
28-
./configure --enable-cassert --enable-debug CFLAGS="-ggdb -Og -DUSE_VALGRIND"
39+
./configure \
40+
--prefix=$HOME/pgsql \
41+
--with-openssl \
42+
--enable-cassert \
43+
--enable-debug \
44+
CFLAGS="-ggdb -Og -DUSE_VALGRIND"
2945

3046
# we will use this to parallelize PostgreSQL compilation
3147
procs="$(nproc)"
3248
mjobs="$((procs + 1))"
33-
make -j "${mjobs}" -s
34-
sudo make install
35-
export PATH=/usr/local/pgsql/bin:$PATH
49+
make install -j "${mjobs}" -s
3650

3751
# download and install Citus
3852
cd ..
39-
git clone https://github.com/citusdata/citus.git
53+
git clone -b "${CITUS_GITREF}" --depth 1 https://github.com/citusdata/citus.git
4054
cd citus/
4155
./configure
4256
make clean
43-
make -j8 -s
44-
sudo make install
45-
46-
# this is necessary to start tests
47-
sudo chown ubuntu /usr/local/pgsql/bin/ -R
57+
make install -j "${mjobs}" -s
4858

4959
# run valgrind tests
5060
cd src/test/regress
@@ -60,9 +70,9 @@ if [ -s regression.diffs ]; then
6070
fi
6171

6272
if [ -z "$attachments" ]; then
63-
mail -aFrom:valgrind-test@citusdata.com -s "[Valgrind Test Results] - Success" burak@citusdata.com metin@citusdata.com furkan@citusdata.com < /dev/null
73+
mail -aFrom:valgrind-test@citusdata.com -s "[Valgrind Test Results] - Success" $REPORT_EMAIL < /dev/null
6474
else
65-
mail -aFrom:valgrind-test@citusdata.com -s "[Valgrind Test Results] - Failure" $attachments burak@citusdata.com metin@citusdata.com furkan@citusdata.com < /dev/null
75+
mail -aFrom:valgrind-test@citusdata.com -s "[Valgrind Test Results] - Failure" $attachments $REPORT_EMAIL < /dev/null
6676
fi
6777

6878
# just to ensure everything is completed in the test instance

0 commit comments

Comments
 (0)