Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing samples #7

Open
gedw99 opened this issue Jan 29, 2023 · 0 comments
Open

testing samples #7

gedw99 opened this issue Jan 29, 2023 · 0 comments

Comments

@gedw99
Copy link

gedw99 commented Jan 29, 2023

I needed some files to quickly test against and these are nice and small and worked well for me test.

https://github.com/ffeast/samplelib has the video and audio test files
https://samplelib.com/ has them.

I am thinking that we can integrate doing a git clone of these files into the makefile and github ci.

then we can easily write tests that work with real data.

here is my sloppy makefile to do it:

# https://github.com/peolic/videohashes


REPO_NAME=videohashes

REPO_URL=git@github.com:peolic/$(REPO_NAME).git
REPO_VER=main

# https://github.com/peolic/videohashes/pull/6
# https://github.com/4c0d3r/videohashes
# git@github.com:4c0d3r/videohashes.git
REPO_URL=git@github.com:4c0d3r/$(REPO_NAME).git
REPO_VER=main

BIN_FSPATH_NAME=.bin
BIN_FSPATH=$(PWD)/$(BIN_FSPATH_NAME)

BIN_NAME=videohashes
BIN=$(BIN_FSPATH)/$(BIN_NAME)


print:
	@echo ""
	@echo "REPO_NAME:     $(REPO_NAME)"
	@echo "REPO_URL:      $(REPO_URL)"
	@echo "REPO_VER:      $(REPO_VER)"
	@echo "REPO_PR_ID:    $(REPO_PR_ID)"
	@echo "BIN:           $(BIN)"
	
	
dep-git:
	git clone $(REPO_URL) -b $(REPO_VER)
	@echo $(REPO_NAME) >> .gitignore

dep-git-del:
	rm -rf $(REPO_NAME)

dep-tools:
	go install github.com/oligot/go-mod-upgrade@latest



CMD=cd $(REPO_NAME) &&

mod-upgrade: dep-tools mod-tidy
	$(CMD) go-mod-upgrade
	$(MAKE) mod-tidy
mod-tidy:
	$(CMD) go mod tidy

gen:
	$(CMD) go generate ./... -v

build:
	$(CMD) EXTRA_LDFLAGS='-extldflags=-static -s -w' go build -o $(BIN) ./cmd/videohashes
build-del:
	rm -rf $(BIN_FSPATH)

### TEST

# https://samplelib.com/
# https://github.com/ffeast/samplelib
TEST_REPO_NAME=samplelib
TEST_REPO_URL=git@github.com:ffeast/samplelib.git
TEST_REPO_VER=main

TEST_FSPATH=$(PWD)/samplelib/mp4
TEST_NAME=sample-5s.mp4
TEST=$(TEST_FSPATH)/$(TEST_NAME)

test-print:
	@echo ""
	@echo "TEST_NAME:     $(TEST_NAME)"
	@echo "TEST:          $(TEST)"
	
test-dep-git:
	# this is a repo with test samples
	git clone $(TEST_REPO_URL)
	@echo $(TEST_REPO_NAME) >> .gitignore
test-dep-git-del:
	rm -rf $(TEST_REPO_NAME)
test-run:
	$(BIN) -json -md5 -video $(TEST)
	 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant