Skip to content

Commit

Permalink
Merge pull request #401 from proftpd/rpmbuild
Browse files Browse the repository at this point in the history
Do an rpmbuild during Travis CI builds
  • Loading branch information
Castaglia committed Jan 29, 2017
2 parents 1e10e65 + f43a4d0 commit 0f00a5e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 18 deletions.
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
env: TRAVIS_CI=true
env:
- PACKAGE_VERSION=1.3.6rc5 TRAVIS_CI=true

language: c

compiler:
- gcc
- clang

services:
- docker
- redis-server

install:
# Need to add other repos for e.g. libsodium
- sudo add-apt-repository -y ppa:jbboehr/ppa
- sudo add-apt-repository -y ppa:chris-lea/libsodium
- echo "deb http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list > /dev/null
- echo "deb-src http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list > /dev/null
Expand Down Expand Up @@ -61,12 +65,13 @@ before_script:
script:
# - find . -type f -name "*.c" -print | grep -v tests | xargs cppcheck 2>&1
# - find . -type f -name "*.c" -print | grep -v tests | xargs rats --language=c
- ./configure LIBS=-lodbc --enable-devel=coverage --enable-ctrls --enable-facl --enable-memcache --enable-nls --enable-pcre --enable-redis --enable-tests --with-modules=mod_sql:mod_sql_mysql:mod_sql_odbc:mod_sql_postgres:mod_sql_sqlite:mod_sql_passwd:mod_sftp:mod_sftp_sql:mod_sftp_pam:mod_tls:mod_tls_fscache:mod_tls_shmcache:mod_tls_memcache:mod_tls_redis:mod_ban:mod_copy:mod_ctrls_admin:mod_deflate:mod_dnsbl:mod_dynmasq:mod_exec:mod_facl:mod_geoip:mod_ifversion:mod_ldap:mod_load:mod_log_forensic:mod_qos:mod_quotatab:mod_quotatab_file:mod_quotatab_ldap:mod_quotatab_radius:mod_quotatab_sql:mod_radius:mod_readme:mod_rewrite:mod_shaper:mod_site_misc:mod_snmp:mod_wrap:mod_wrap2:mod_wrap2_file:mod_wrap2_sql:mod_digest:mod_auth_otp:mod_statcache:mod_ifsession
- ./configure LIBS="-lodbc -lm -lrt -pthread" --enable-devel=coverage --enable-ctrls --enable-facl --enable-memcache --enable-nls --enable-pcre --enable-redis --enable-tests --with-modules=mod_sql:mod_sql_mysql:mod_sql_odbc:mod_sql_postgres:mod_sql_sqlite:mod_sql_passwd:mod_sftp:mod_sftp_sql:mod_sftp_pam:mod_tls:mod_tls_fscache:mod_tls_shmcache:mod_tls_memcache:mod_tls_redis:mod_ban:mod_copy:mod_ctrls_admin:mod_deflate:mod_dnsbl:mod_dynmasq:mod_exec:mod_facl:mod_geoip:mod_ifversion:mod_ldap:mod_load:mod_log_forensic:mod_qos:mod_quotatab:mod_quotatab_file:mod_quotatab_ldap:mod_quotatab_radius:mod_quotatab_sql:mod_radius:mod_readme:mod_rewrite:mod_shaper:mod_site_misc:mod_snmp:mod_wrap:mod_wrap2:mod_wrap2_file:mod_wrap2_sql:mod_digest:mod_auth_otp:mod_statcache:mod_ifsession
- make
- make TEST_VERBOSE=1 check-api
- make clean
- ./configure LIBS=-lodbc --enable-devel --enable-ctrls --enable-dso --enable-facl --enable-memcache --enable-nls --enable-pcre --enable-tests --with-shared=mod_sql:mod_sql_mysql:mod_sql_odbc:mod_sql_postgres:mod_sql_sqlite:mod_sql_passwd:mod_sftp:mod_sftp_sql:mod_sftp_pam:mod_tls:mod_tls_fscache:mod_tls_shmcache:mod_tls_memcache:mod_ban:mod_copy:mod_ctrls_admin:mod_deflate:mod_dnsbl:mod_dynmasq:mod_exec:mod_facl:mod_geoip:mod_ifversion:mod_ldap:mod_load:mod_log_forensic:mod_qos:mod_quotatab:mod_quotatab_file:mod_quotatab_ldap:mod_quotatab_radius:mod_quotatab_sql:mod_radius:mod_readme:mod_rewrite:mod_shaper:mod_site_misc:mod_snmp:mod_wrap:mod_wrap2:mod_wrap2_file:mod_wrap2_sql:mod_digest:mod_auth_otp:mod_statcache:mod_ifsession
- ./configure LIBS="-lodbc -lm -lrt -pthread" --enable-devel --enable-ctrls --enable-dso --enable-facl --enable-memcache --enable-nls --enable-pcre --enable-tests --with-shared=mod_sql:mod_sql_mysql:mod_sql_odbc:mod_sql_postgres:mod_sql_sqlite:mod_sql_passwd:mod_sftp:mod_sftp_sql:mod_sftp_pam:mod_tls:mod_tls_fscache:mod_tls_shmcache:mod_tls_memcache:mod_ban:mod_copy:mod_ctrls_admin:mod_deflate:mod_dnsbl:mod_dynmasq:mod_exec:mod_facl:mod_geoip:mod_ifversion:mod_ldap:mod_load:mod_log_forensic:mod_qos:mod_quotatab:mod_quotatab_file:mod_quotatab_ldap:mod_quotatab_radius:mod_quotatab_sql:mod_radius:mod_readme:mod_rewrite:mod_shaper:mod_site_misc:mod_snmp:mod_wrap:mod_wrap2:mod_wrap2_file:mod_wrap2_sql:mod_digest:mod_auth_otp:mod_statcache:mod_ifsession
- make
- (cd contrib/travis && sudo docker run -v `pwd`:`pwd` -w `pwd` centos:centos7 /bin/bash `pwd`/docker-rpmbuild.sh)

after_success:
- cd ${TRAVIS_BUILD_DIR}
Expand Down
25 changes: 25 additions & 0 deletions contrib/travis/docker-rpmbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -x

VERSION=${PACKAGE_VERSION:-1.3.6rc5}

# Make sure that the necessary packages/tools are installed
yum install -y gcc make git rpm-build

# These are for the basic proftpd build
yum install -y gettext pkgconfig pam-devel ncurses-devel zlib-devel libacl-devel libcap-devel

# And these are for --with everything
yum install -y openldap-devel libmemcached-devel mysql-devel pcre-devel postgresql-devel openssl-devel tcp_wrappers-devel

mkdir git
cd git
git clone --depth 10 https://github.com/proftpd/proftpd.git proftpd-${VERSION}
cd proftpd-${VERSION}/
./configure
rm -fr .git/
make dist
cd ..
tar zcvf proftpd-${VERSION}.tar.gz proftpd-${VERSION}
rpmbuild -ta proftpd-${VERSION}.tar.gz --with everything
4 changes: 2 additions & 2 deletions tests/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TEST_API_DEPS=\
$(top_srcdir)/src/json.o \
$(top_srcdir)/src/redis.o

TEST_API_LIBS=-lcheck
TEST_API_LIBS=-lcheck -lm

TEST_API_OBJS=\
api/pool.o \
Expand Down Expand Up @@ -110,7 +110,7 @@ api/.c.o:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<

api-tests$(EXEEXT): $(TEST_API_OBJS) $(TEST_API_DEPS)
$(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -o $@ $(TEST_API_DEPS) $(TEST_API_OBJS) $(LIBS) $(TEST_API_LIBS)
$(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -o $@ $(TEST_API_DEPS) $(TEST_API_OBJS) $(TEST_API_LIBS) $(LIBS)
./$@

running-tests:
Expand Down
25 changes: 12 additions & 13 deletions tests/api/inet.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ProFTPD - FTP server testsuite
* Copyright (c) 2014-2016 The ProFTPD Project team
* Copyright (c) 2014-2017 The ProFTPD Project team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -575,9 +575,9 @@ START_TEST (inet_connect_ipv6_test) {

res = pr_inet_connect(p, conn, addr, 80);
fail_unless(res < 0, "Connected to ::1#80 unexpectedly");
fail_unless(errno == ECONNREFUSED || errno == ENETUNREACH,
"Expected ECONNREFUSED (%d) or ENETUNREACH (%d), got %s (%d)",
ECONNREFUSED, ENETUNREACH, strerror(errno), errno);
fail_unless(errno == ECONNREFUSED || errno == ENETUNREACH || errno == EADDRNOTAVAIL,
"Expected ECONNREFUSED (%d), ENETUNREACH (%d), or EADDRNOTAVAIL (%d), got %s (%d)",
ECONNREFUSED, ENETUNREACH, EADDRNOTAVAIL, strerror(errno), errno);

/* Try connecting to Google's DNS server. */

Expand All @@ -591,9 +591,9 @@ START_TEST (inet_connect_ipv6_test) {
* to connect to a different address. Interestingly, trying to connect(2)
* using that same fd to a different address yields EINVAL.
*/
fail_unless(errno == EINVAL || errno == ENETUNREACH,
"Expected EINVAL (%d) or ENETUNREACH (%d), got %s (%d)",
EINVAL, ENETUNREACH, strerror(errno), errno);
fail_unless(errno == EINVAL || errno == ENETUNREACH || errno == EADDRNOTAVAIL,
"Expected EINVAL (%d), ENETUNREACH (%d) or EADDRNOTAVAIL (%d), got %s (%d)",
EINVAL, ENETUNREACH, EADDRNOTAVAIL, strerror(errno), errno);
}
pr_inet_close(p, conn);

Expand All @@ -603,17 +603,16 @@ START_TEST (inet_connect_ipv6_test) {
res = pr_inet_connect(p, conn, addr, 53);
if (res < 0) {
/* This could be expected, e.g. if there's no route. */
fail_unless(errno == EHOSTUNREACH || errno == ENETUNREACH,
"Expected EHOSTUNREACH (%d) or ENETUNREACH (%d), got %s (%d)",
EHOSTUNREACH, ENETUNREACH, strerror(errno), errno);
fail_unless(errno == EHOSTUNREACH || errno == ENETUNREACH || errno == EADDRNOTAVAIL,
"Expected EHOSTUNREACH (%d) or ENETUNREACH (%d) or EADDRNOTAVAIL (%d), got %s (%d)",
EHOSTUNREACH, ENETUNREACH, EADDRNOTAVAIL, strerror(errno), errno);
}

res = pr_inet_connect(p, conn, addr, 53);
fail_unless(res < 0, "Failed to connect to 2001:4860:4860::8888#53: %s",
strerror(errno));
fail_unless(errno == EISCONN || errno == EHOSTUNREACH || errno == ENETUNREACH,
"Expected EISCONN (%d) or EHOSTUNREACH (%d) or ENETUNREACH (%d), "
"got %s (%d)", EISCONN, EHOSTUNREACH, ENETUNREACH, strerror(errno), errno);
fail_unless(errno == EISCONN || errno == EHOSTUNREACH || errno == ENETUNREACH || errno == EADDRNOTAVAIL,
"Expected EISCONN (%d) or EHOSTUNREACH (%d) or ENETUNREACH (%d) or EADDRNOTAVAIL (%d), got %s (%d)", EISCONN, EHOSTUNREACH, ENETUNREACH, EADDRNOTAVAIL, strerror(errno), errno);
pr_inet_close(p, conn);

pr_inet_set_default_family(p, AF_INET);
Expand Down

0 comments on commit 0f00a5e

Please sign in to comment.