Skip to content

Commit

Permalink
Make test & load scripts work in Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ubolonton committed Feb 13, 2018
1 parent 2bdfafd commit cd0a84a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
16 changes: 13 additions & 3 deletions bin/load.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
#!/usr/bin/env bash

# Load the dynamic module into
# (Re)load the dynamic module into a running Emacs instance.

system=`uname`
if [[ $system == "Linux" ]]; then
ext="so"
elif [[ $system == "Darwin" ]]; then
ext="dylib"
else
echo "Unsupported system: $system"
exit 1
fi

here=`cd $(dirname $BASH_SOURCE); pwd`
root=`cd $here/..; pwd`
RS_MODULE=$(find $root -iname '*emacs_rs_module*.dylib' | head -n 1)
MODULE=$root/target/debug/libmagit_libgit2.dylib
RS_MODULE=$(find $root -iname "*emacs_rs_module*.$ext" | head -n 1)
MODULE=$root/target/debug/libmagit_libgit2.$ext
MODULE_X=$root/elisp/magit-libgit2-x.el

read -r -d '' expr <<EOF
Expand Down
26 changes: 19 additions & 7 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
#!/usr/bin/env bash

# TODO: Use Rust instead of bash to drive the tests.
# FIX: Use Rust instead of bash to drive the tests.

system=`uname`
if [[ $system == "Linux" ]]; then
ext="so"
elif [[ $system == "Darwin" ]]; then
ext="dylib"
else
echo "Unsupported system: $system"
exit 1
fi

here=`cd $(dirname $BASH_SOURCE); pwd`
root=`cd $here/..; pwd`

MODULE_DIR=$root/target/debug
MODULE_ORIG_FILE=libmagit_libgit2.dylib
MODULE_FILE=magit-libgit2.so
`cd $MODULE_DIR && ln -f -s $MODULE_ORIG_FILE $MODULE_FILE`
MODULE=$MODULE_DIR/$MODULE_FILE

RUST_BACKTRACE=1 emacs -batch -l ert -l $MODULE -l $root/elisp/magit-libgit2-test.el -f ert-run-tests-batch-and-exit
MODULE_ORIGINAL=libmagit_libgit2.$ext
MODULE_RENAMED=magit-libgit2.so
`cd $MODULE_DIR && ln -f -s $MODULE_ORIGINAL $MODULE_RENAMED`

RUST_BACKTRACE=1 emacs -batch -l ert \
-l $MODULE_DIR/$MODULE_RENAMED \
-l $root/elisp/magit-libgit2-test.el \
-f ert-run-tests-batch-and-exit

0 comments on commit cd0a84a

Please sign in to comment.