Skip to content

Commit

Permalink
added --typical/--megarow/--float128 test loop
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpreynolds committed Jun 26, 2018
1 parent 7636c2d commit cbf5650
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 18 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export BINARY_TYPE = ${DEFAULT_BINARY_TYPE}
DEBUG_TYPE = ${TYPICAL}
WRAPPERS = $(wildcard ${APPDIR}/conversion/src/wrappers/*)
CWD := $(shell pwd)
BINDIR = bin
export BINDIR = $(CWD)/bin
BINDIR_MODULE = modules

export DESTBINDIR = .

default:
ifeq ($(KERNEL), Darwin)
Expand All @@ -45,7 +45,7 @@ all:
$(MAKE) megarow -f ${SELF}
$(MAKE) float128 -f ${SELF}
$(MAKE) install_all -f ${SELF}
$(MAKE) symlink_typical -f ${SELF}
$(MAKE) symlink_post_install_all -f ${SELF}

module_all:
$(MAKE) support -f ${SELF}
Expand All @@ -64,6 +64,10 @@ megarow:
typical:
$(MAKE) BINARY_TYPE=$(TYPICAL) -f ${SELF}

symlink_post_install_all:
cd ${BINDIR} && ./switch-BEDOPS-binary-type --typical .
cd ${CWD}

symlink_typical:
$(eval SRCNAMES=`find $(BINDIR)/ -maxdepth 1 -mindepth 1 -type f -name '*$(TYPICAL)' -print0 | xargs -L1 -0 -I{} sh -c 'basename {}'`)
for SRCNAME in ${SRCNAMES}; do \
Expand Down
1 change: 1 addition & 0 deletions applications/other/switch-BEDOPS-binary-type
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ then
TYPE=float128
fi

echo $BINDIR
for SRCNAME in `find ${BINDIR} -maxdepth 1 -mindepth 1 -type f -name "*${TYPE}" -print0 | xargs -L1 -0 -I{} sh -c 'basename {}'`
do
DESTNAME=`echo ${SRCNAME} | perl -Tpe 's/-'${TYPE}'//'`
Expand Down
21 changes: 18 additions & 3 deletions tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
CWD := $(shell pwd)
SWITCH = $(CWD)/../bin/switch-BEDOPS-binary-type
ALL_BINARY_TYPES = typical megarow float128

all: bedops
all: tests

bedops:
$(MAKE) all -C $(CWD)/tests/bedops
.PHONY: tests bedops

tests:
$(MAKE) bedops -C $(CWD)/tests
$(MAKE) clean -C $(CWD)/tests

bedops:
for btype in ${ALL_BINARY_TYPES}; do \
$(SWITCH) --$$btype $(BINDIR) || exit $$?; \
$(MAKE) all -C $(CWD)/bedops BUILDTYPE=$$btype; \
done

clean:
$(SWITCH) --typical $(BINDIR)
@rm -rf /tmp/tmp.*
24 changes: 12 additions & 12 deletions tests/bedops/Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
APP = bedops
CWD := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))))
BIN = $(CWD)/../../bin/bedops
TMPDIR := $(shell mktemp -d)
TMP := $(shell mktemp -d)

all:
@echo "Testing [$(APP)]"
@echo "Testing binary [$(APP)] and build type [$(BUILDTYPE)]"
@$(MAKE) operations
@$(MAKE) clean

operations: prep merge

prep:
@[ -f $(BIN) ] || echo "Missing [$(APP)]"
@[ -f $(BIN) ] || echo "Missing binary [$(APP)] for build type [$(BUILDTYPE)]"
@echo "Writing to [$(TMP)]"
$(BIN) --version

merge:
@echo "[$(APP) --$@]"
@echo "[$(APP) --$@] - [001]"
@$(BIN) -m $(CWD)/data/001.merge.001.test > $(TMPDIR)/001.merge.001.observed
@diff -s $(TMPDIR)/001.merge.001.observed $(CWD)/data/001.merge.001.expected

clean:
@echo "Cleaning [$(APP)] test results..."
@rm -rf $(TMPDIR)
# Test 001
@echo "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]"
@$(BIN) -m $(CWD)/data/001.merge.001.test > $(TMP)/001.merge.001.observed
@diff -s $(TMP)/001.merge.001.observed $(CWD)/data/001.merge.001.expected
# Test 002
@echo "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]"
@$(BIN) -m $(CWD)/data/001.merge.001.test $(CWD)/data/002.complement.001.expected > $(TMP)/006.merge.002.observed
@diff -s $(TMP)/006.merge.002.observed $(CWD)/data/006.merge.002.expected
2 changes: 2 additions & 0 deletions tests/bedops/data/002.complement.001.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chr7 102 105
chr7 116 117
1 change: 1 addition & 0 deletions tests/bedops/data/006.merge.002.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chr7 2 151

0 comments on commit cbf5650

Please sign in to comment.