Skip to content

Commit

Permalink
Issue gearman#293: Bootstrap on Alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
esabol committed Aug 1, 2020
1 parent 36c1e23 commit bc5ff83
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
15 changes: 14 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ set_VENDOR_DISTRIBUTION ()
opensuse*)
VENDOR_DISTRIBUTION='opensuse'
;;
alpine)
VENDOR_DISTRIBUTION='alpine'
;;
*)
die "attempt to set an invalid VENDOR_DISTRIBUTION=$dist"
;;
Expand Down Expand Up @@ -263,6 +266,9 @@ set_VENDOR_RELEASE ()
opensuse)
VENDOR_RELEASE="$release"
;;
alpine)
VENDOR_RELEASE="$release"
;;
unknown)
die "attempt to set VENDOR_RELEASE without setting VENDOR_DISTRIBUTION"
;;
Expand All @@ -273,13 +279,16 @@ set_VENDOR_RELEASE ()
}


# Valid values are: apple, redhat, centos, canonical, oracle, suse
# Valid values are: alpine, apple, redhat, centos, canonical, oracle, suse
set_VENDOR ()
{
local vendor
vendor="$(echo "$1" | tr '[:upper:]' '[:lower:]')"

case $vendor in
alpine)
VENDOR='alpine'
;;
apple)
VENDOR='apple'
;;
Expand Down Expand Up @@ -372,6 +381,10 @@ determine_target_platform ()
# shellcheck disable=SC1091
source '/etc/lsb-release'
set_VENDOR 'canonical' "$DISTRIB_ID" "$DISTRIB_CODENAME"
elif [[ -f '/etc/alpine-release' ]]; then
local alpine_version
alpine_version="$(cat /etc/alpine-release)"
set_VENDOR 'alpine' 'alpine' "$alpine_version"
fi

rebuild_host_os
Expand Down
15 changes: 12 additions & 3 deletions libhashkit/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,26 @@

#include "libhashkit/hashkitcon.h"

#include <limits.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#ifndef __WORDSIZE
# ifdef __MINGW32__
# if defined(__MINGW32__)
# define __WORDSIZE 32
# endif
#endif
# elif defined(LONG_BITS)
# if (LONG_BITS == 32)
# define __WORDSIZE 32
# else
# define __WORDSIZE 64
# endif /* defined(LONG_BITS) */
# else
# define __WORDSIZE 64
# endif /* defined(__MINGW32__) */
#endif /* __WORDSIZE */

#include <libhashkit-1.0/hashkit.h>
#include "libhashkit/algorithm.h"
Expand Down
6 changes: 6 additions & 0 deletions tests/vector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,13 @@ static test_return_t INT64_MAX_resize_TEST(void*)
for (size_t x= 0; x < 20; x++)
{
gearman_vector_st vec(random() % max_block);
#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
ASSERT_FALSE(vec.resize(INT64_MAX));
#else
// SIZE_MAX is ((size_t)(-1)), but we need to subtract 1 because the
// gearman_vector_st implementation adds 1 to the capacity.
ASSERT_FALSE(vec.resize(((size_t)(-1)) -1));
#endif
}

return TEST_SUCCESS;
Expand Down

0 comments on commit bc5ff83

Please sign in to comment.