Skip to content

Commit

Permalink
Merge pull request #63 from pj8/fix/redis6-mac-patch
Browse files Browse the repository at this point in the history
特定のMacOSバージョンでRedisインストールに失敗しないようにする
  • Loading branch information
yuki777 committed Jun 19, 2024
2 parents 75b4620 + acd3c58 commit dc7d3aa
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 3 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,27 @@ jobs:
mysql-8.0.30.sh,
postgresql-12.4.sh,
postgresql-13.2.sh,
redis-6.0.16.sh,
redis-6.2.6.sh
redis-6.2.14.sh,
redis-7.2.5.sh
]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# WARNING Memory overcommit must be enabled! Without it,
# a background save or replication may fail under low memory condition. Being disabled,
# it can also cause failures without low memory condition,
# see https://github.com/jemalloc/jemalloc/issues/1328.
# To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot
# or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
- name: Enable memory overcommit
if: matrix.os == 'ubuntu-latest'
run: |
sudo sysctl vm.overcommit_memory=1
- name: Run test
run: |
cd tests
- name: Run test
run: |
cd tests
Expand Down
9 changes: 9 additions & 0 deletions lib/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,12 @@ getInstallDir() {
echo "$XDG_DATA_HOME/$suffix"
fi
}

# https://github.com/pj8/dbdb/issues/62
redisPatch() {
if [[ $1 =~ ^6\.[0-9]+\.[0-9]+$ ]] && [ "$(getOS)" = "macos" ]; then
sed -i '' '/#ifdef __APPLE__/a\
#define _DARWIN_C_SOURCE
' $2
fi
}
1 change: 1 addition & 0 deletions redis/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extractFile $dir $optFileName
if [ ! -e $dir/basedir/src/redis-server ]; then
cd $dir/basedir
echo "Installing..." 1>&2
redisPatch $optVersion $dir/basedir/src/config.h
make > /dev/null 2>&1
fi

Expand Down
50 changes: 50 additions & 0 deletions tests/redis-6.2.14.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -eu

. ../lib/functions.sh

type=redis
version=6.2.14

cd ../$type/..

date=$(date +%Y%m%d%H%M%S)
md5="md5"
[ "$(getOS)" = "linux" ] && md5="md5sum"
hash=$(echo "dbdb-$date" | $md5 | cut -d ' ' -f 1)

echo "# Test create"
./$type/create.sh dbdb-test-$hash $version random
echo "# Test port"
./$type/port.sh dbdb-test-$hash
echo "# Test start"
./$type/start.sh dbdb-test-$hash
echo "# Test status"
./$type/status.sh dbdb-test-$hash
echo "# Test restart"
./$type/restart.sh dbdb-test-$hash
echo "# Test stop"
./$type/stop.sh dbdb-test-$hash
echo "# Test delete"
./$type/delete.sh dbdb-test-$hash

echo "# Test create"
./$type/create.sh -f json dbdb-test-$hash $version random | jq
echo "# Test port"
./$type/port.sh -f json dbdb-test-$hash | jq
echo "# Test start"
./$type/start.sh -f json dbdb-test-$hash | jq
echo "# Test status"
./$type/status.sh -f json dbdb-test-$hash | jq
echo "# Test restart"
./$type/restart.sh -f json dbdb-test-$hash | jq
echo "# Test stop"
./$type/stop.sh -f json dbdb-test-$hash | jq
echo "# Test delete"
./$type/delete.sh -f json dbdb-test-$hash | jq

./dbdb.sh
./$type/create-start.sh -f json dbdb-test-$hash $version random | jq
./dbdb.sh -f json | jq
./$type/delete.sh dbdb-test-$hash
./dbdb.sh
50 changes: 50 additions & 0 deletions tests/redis-7.0.15.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -eu

. ../lib/functions.sh

type=redis
version=7.0.15

cd ../$type/..

date=$(date +%Y%m%d%H%M%S)
md5="md5"
[ "$(getOS)" = "linux" ] && md5="md5sum"
hash=$(echo "dbdb-$date" | $md5 | cut -d ' ' -f 1)

echo "# Test create"
./$type/create.sh dbdb-test-$hash $version random
echo "# Test port"
./$type/port.sh dbdb-test-$hash
echo "# Test start"
./$type/start.sh dbdb-test-$hash
echo "# Test status"
./$type/status.sh dbdb-test-$hash
echo "# Test restart"
./$type/restart.sh dbdb-test-$hash
echo "# Test stop"
./$type/stop.sh dbdb-test-$hash
echo "# Test delete"
./$type/delete.sh dbdb-test-$hash

echo "# Test create"
./$type/create.sh -f json dbdb-test-$hash $version random | jq
echo "# Test port"
./$type/port.sh -f json dbdb-test-$hash | jq
echo "# Test start"
./$type/start.sh -f json dbdb-test-$hash | jq
echo "# Test status"
./$type/status.sh -f json dbdb-test-$hash | jq
echo "# Test restart"
./$type/restart.sh -f json dbdb-test-$hash | jq
echo "# Test stop"
./$type/stop.sh -f json dbdb-test-$hash | jq
echo "# Test delete"
./$type/delete.sh -f json dbdb-test-$hash | jq

./dbdb.sh
./$type/create-start.sh -f json dbdb-test-$hash $version random | jq
./dbdb.sh -f json | jq
./$type/delete.sh dbdb-test-$hash
./dbdb.sh
50 changes: 50 additions & 0 deletions tests/redis-7.2.5.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -eu

. ../lib/functions.sh

type=redis
version=7.2.5

cd ../$type/..

date=$(date +%Y%m%d%H%M%S)
md5="md5"
[ "$(getOS)" = "linux" ] && md5="md5sum"
hash=$(echo "dbdb-$date" | $md5 | cut -d ' ' -f 1)

echo "# Test create"
./$type/create.sh dbdb-test-$hash $version random
echo "# Test port"
./$type/port.sh dbdb-test-$hash
echo "# Test start"
./$type/start.sh dbdb-test-$hash
echo "# Test status"
./$type/status.sh dbdb-test-$hash
echo "# Test restart"
./$type/restart.sh dbdb-test-$hash
echo "# Test stop"
./$type/stop.sh dbdb-test-$hash
echo "# Test delete"
./$type/delete.sh dbdb-test-$hash

echo "# Test create"
./$type/create.sh -f json dbdb-test-$hash $version random | jq
echo "# Test port"
./$type/port.sh -f json dbdb-test-$hash | jq
echo "# Test start"
./$type/start.sh -f json dbdb-test-$hash | jq
echo "# Test status"
./$type/status.sh -f json dbdb-test-$hash | jq
echo "# Test restart"
./$type/restart.sh -f json dbdb-test-$hash | jq
echo "# Test stop"
./$type/stop.sh -f json dbdb-test-$hash | jq
echo "# Test delete"
./$type/delete.sh -f json dbdb-test-$hash | jq

./dbdb.sh
./$type/create-start.sh -f json dbdb-test-$hash $version random | jq
./dbdb.sh -f json | jq
./$type/delete.sh dbdb-test-$hash
./dbdb.sh

0 comments on commit dc7d3aa

Please sign in to comment.