Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ matrix:
- cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local .
- make install -j$(nproc)
- popd
script: kcov --exclude-pattern=travis.sh $PWD/coverage ./travis.sh
script: kcov --exclude-pattern=travis.sh $PWD/coverage ./test/all.sh
after_success: bash <(curl -s https://codecov.io/bash) -s $PWD/coverage
- os: osx
script: ./travis.sh
script: ./test/all.sh
9 changes: 9 additions & 0 deletions script/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,12 @@ install_compiler() {
download_without_verify "$ROOT/$1/bin/gdmd" "$url"
chmod +x "$ROOT/$1/bin/gdmd"

url=https://raw.githubusercontent.com/dlang/tools/e88c44d1818996b852bd0dfa0406f60e391f0687/rdmd.d
log "Downloading rdmd $url"
download_without_verify "$ROOT/$1/bin/rdmd.d" "$url"
log "Building rdmd"
"$ROOT/$1/bin/gdc" -O3 -o "$ROOT/$1/bin/rdmd" "$ROOT/$1/bin/rdmd.d"

else
fatal "Unknown compiler '$compiler'"
fi
Expand Down Expand Up @@ -648,6 +654,7 @@ binpath_for_compiler() {

write_env_vars() {
local -r binpath=$(binpath_for_compiler "$1")
local rdmd=rdmd
case $1 in
dmd*)
local suffix
Expand Down Expand Up @@ -689,6 +696,7 @@ deactivate() {
unset _OLD_D_PS1
unset DMD
unset DC
unset RDMD
unset -f deactivate
}

Expand All @@ -702,6 +710,7 @@ export LIBRARY_PATH="$ROOT/$1/$libpath\${LIBRARY_PATH:+:}\${LIBRARY_PATH:-}"
export LD_LIBRARY_PATH="$ROOT/$1/$libpath\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH:-}"
export DMD=$dmd
export DC=$dc
export RDMD=$rdmd
export PS1="($1)\${PS1:-}"
EOF

Expand Down
12 changes: 12 additions & 0 deletions test/all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -eu -o pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. $DIR/common.sh

for file in $(find "$DIR" -name "*.sh") ; do
if ! ( [[ "$file" == */all.sh ]] || [[ "$file" == */common.sh ]] ) ; then
$file
fi
done
File renamed without changes.
6 changes: 6 additions & 0 deletions test/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -eu -o pipefail

ROOT="$DIR/../"
INSTALLER="$ROOT/script/install.sh"
40 changes: 40 additions & 0 deletions test/rdmd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

set -uexo pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. $DIR/common.sh

compilers=(
dmd-2.079.0
ldc-1.8.0
gdc-4.8.5
)

frontends=(
'2079L'
'2078L'
'2068L'
)

for idx in "${!compilers[@]}"
do
compiler="${compilers[$idx]}"
echo "Testing: $compiler"
"$INSTALLER" $compiler

. ~/dlang/$compiler/activate
echo "pragma(msg, __VERSION__);" > test.d
# test vanilla rdmd
compilerFrontend=$(tail -n1 <(rdmd --force -c test.d 2>&1))
test "$compilerFrontend" = "${frontends[$idx]}"

# test $RDMD
compilerFrontend=$(tail -n1 <("$RDMD" --force -c test.d 2>&1))
test "$compilerFrontend" = "${frontends[$idx]}"
deactivate

# cleanup
rm -rf test.d test.o
"$INSTALLER" uninstall $compiler
done