Skip to content

Commit

Permalink
Merge pull request #24 from simelo/stdevAlDen_t7_refactor_in_tests
Browse files Browse the repository at this point in the history
Fixes #7 Refactoring the criterion tests to libcheck
  • Loading branch information
olemis authored May 5, 2019
2 parents 7f617e3 + 06e7596 commit 47f8d0f
Show file tree
Hide file tree
Showing 56 changed files with 4,494 additions and 4,635 deletions.
9 changes: 0 additions & 9 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
---
name: Pull request
about: Contribute with code to this project
title: ''
labels: ''
assignees: ''

---


Fixes #

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,6 @@ addresses.txt
seeds.csv

histogram
# Ignore compilator by qemu
qemu_*
core
19 changes: 8 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
sudo: required
dist: xenial
language: go
go:
- "1.11.x"

matrix:
include:
- os: linux
dist: xenial
env: VERSION_UPGRADE_TEST_WAIT_TIMEOUT=45s
- os: osx
# Do not start osx build for PR
osx_image: xcode8
osx_image: xcode8.3
env: VERSION_UPGRADE_TEST_WAIT_TIMEOUT=60s

before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get update -qq; fi
- VERSION=1.10.2 ./ci-scripts/install-golangci-lint.sh
- ./ci-scripts/install-travis-gcc.sh
- eval "CC=gcc-6 && CXX=g++-6"

env:
global:
- BUILD_DIR: build
- BUILDLIB_DIR: $BUILD_DIR/libskycoin
- LIB_DIR: lib
- CGO_ENABLED: 1

install:
# Install gox
- go get github.com/gz-c/gox
- go get -t ./...
- make install-linters
# Install pinned golangci-lint, overriding the latest version install by make install-linters
- VERSION=1.10.2 ./ci-scripts/install-golangci-lint.sh
- ./ci-scripts/install-travis-gcc.sh
# Install pinned golangci-lint, overriding the latest version install by make install-linters
- make install-deps-libc

script:
- make lint
# libskycoin tests
- CC=gcc-6 make test-libc
- make check

notifications:
email:
- false
# https://github.com/kvld/travisci-telegram TravisCI Telegram Bot integration
email: false
webhooks: https://fathomless-fjord-24024.herokuapp.com/notify
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,4 +457,4 @@ Make sure to upgrade to v0.25.0 so that your node will continue to connect once
[0.20.1]: https://github.com/skycoin/skycoin/compare/v0.20.0...v0.20.1
[0.20.0]: https://github.com/skycoin/skycoin/compare/v0.19.1...v0.20.0
[0.19.1]: https://github.com/skycoin/skycoin/compare/v0.19.0...v0.19.1
[0.19.0]: https://github.com/skycoin/skycoin/commit/dd924e1f2de8fab945e05b3245dbeabf267f2910
[0.19.0]: https://github.com/skycoin/skycoin/commit/dd924e1f2de8fab945e05b3245dbeabf267f2910
27 changes: 18 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DEFAULT_GOAL := help
.PHONY: test-libc test-lint build-libc check
.PHONY: install-linters format
.PHONY: install-linters format clean-libc

COIN ?= skycoin

Expand Down Expand Up @@ -37,10 +37,11 @@ LIBDOC_DIR = $(DOC_DIR)/libc
# Compilation flags for libskycoin
CC_VERSION = $(shell $(CC) -dumpversion)
STDC_FLAG = $(python -c "if tuple(map(int, '$(CC_VERSION)'.split('.'))) < (6,): print('-std=C99'")
LIBC_LIBS = -lcriterion
LIBC_LIBS = `pkg-config --cflags --libs check`
LIBC_FLAGS = -I$(LIBSRC_DIR) -I$(INCLUDE_DIR) -I$(BUILD_DIR)/usr/include -L $(BUILDLIB_DIR) -L$(BUILD_DIR)/usr/lib
# Platform specific checks
OSNAME = $(TRAVIS_OS_NAME)
CGO_ENABLED=1

ifeq ($(shell uname -s),Linux)
LDLIBS=$(LIBC_LIBS) -lpthread
Expand Down Expand Up @@ -108,7 +109,7 @@ test-libc: build-libc ## Run tests for libskycoin C client library
$(CC) -o $(BIN_DIR)/test_libskycoin_shared $(LIB_DIR)/cgo/tests/*.c $(LIB_DIR)/cgo/tests/testutils/*.c -lskycoin $(LDLIBS) $(LDFLAGS)
$(CC) -o $(BIN_DIR)/test_libskycoin_static $(LIB_DIR)/cgo/tests/*.c $(LIB_DIR)/cgo/tests/testutils/*.c $(BUILDLIB_DIR)/libskycoin.a $(LDLIBS) $(LDFLAGS)
$(LDPATHVAR)="$(LDPATH):$(BUILD_DIR)/usr/lib:$(BUILDLIB_DIR)" $(BIN_DIR)/test_libskycoin_shared
$(LDPATHVAR)="$(LDPATH):$(BUILD_DIR)/usr/lib" $(BIN_DIR)/test_libskycoin_static
$(LDPATHVAR)="$(LDPATH):$(BUILD_DIR)/usr/lib" $(BIN_DIR)/test_libskycoin_static

docs-libc:
doxygen ./.Doxyfile
Expand All @@ -131,15 +132,23 @@ install-linters: ## Install linters
# However, they suggest `curl ... | bash` which we should not do
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

install-deps-libc: configure-build ## Install locally dependencies for testing libskycoin
git clone --recursive https://github.com/skycoin/Criterion $(BUILD_DIR)/usr/tmp/Criterion
mkdir $(BUILD_DIR)/usr/tmp/Criterion/build
cd $(BUILD_DIR)/usr/tmp/Criterion/build && cmake .. && cmake --build .
mv $(BUILD_DIR)/usr/tmp/Criterion/build/libcriterion.* $(BUILD_DIR)/usr/lib/
cp -R $(BUILD_DIR)/usr/tmp/Criterion/include/* $(BUILD_DIR)/usr/include/
install-deps-libc: install-deps-libc-$(OSNAME)

install-deps-libc-linux: configure-build ## Install locally dependencies for testing libskycoin
wget -c https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz
tar -xzf check-0.12.0.tar.gz
cd check-0.12.0 && ./configure --prefix=/usr --disable-static && make && sudo make install

install-deps-libc-osx: configure-build ## Install locally dependencies for testing libskycoin
brew install check

format: ## Formats the code. Must have goimports installed (use make install-linters).
goimports -w -local github.com/skycoin/skycoin ./lib

clean-libc: ## Clean files generate by library
rm -rfv $(BUILDLIB_DIR)/libskycoin.so
rm -rfv $(BUILDLIB_DIR)/libskycoin.a
rm -rfv qemu_test_libskycoin*

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

[](https://user-images.githubusercontent.com/26845312/32426705-d95cb988-c281-11e7-9463-a3fce8076a72.png)

# Skycoin C library

[![Build Status](https://travis-ci.org/skycoin/libskycoin.svg)](https://travis-ci.org/skycoin/libskycoin)

Skycoin C library (a.k.a `libskycoin`) exports the Skycoin API to DApps using the C programming language.
It is also the foundation to build client libraries for other programming languages.

## Links

* [skycoin.net](https://www.skycoin.net)
* [Skycoin Blog](https://www.skycoin.net/blog)
* [Skycoin Docs](https://www.skycoin.net/docs)
* [Skycoin Blockchain Explorer](https://explorer.skycoin.net)
* [Skycoin Development Telegram Channel](https://t.me/skycoindev)
* [Skycoin Github Wiki](https://github.com/skycoin/skycoin/wiki)

## Subprojects

The Skycoin C library is made of the following components

- `lib/cgo` : C wrappers for the Skycoin core API
- `lib/swig` : SWIG interfaces to generate wrappers around the Skycoin core API for other programming languages

Consult respective `README` files for further details.

5 changes: 3 additions & 2 deletions ci-scripts/install-travis-gcc.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env bash

# Install gcc6 (6.4.0-2 on Mac OS) for Travis builds

if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get install -qq g++-6 && sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 90;
sudo apt-get install -qq gcc-6 g++-6
fi

if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
Expand All @@ -12,7 +13,7 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew list --versions gcc
echo 'Creating gcc@64 formula'
cd "$(brew --repository)/Library/Taps/homebrew/homebrew-core"
git show 42d31bba7772fb01f9ba442d9ee98b33a6e7a055:Formula/gcc\@6.rb > Formula/gcc\@6.rb
git show 42d31bba7772fb01f9ba442d9ee98b33a6e7a055:Formula/gcc\@6.rb | grep -v 'fails_with' > Formula/gcc\@6.rb
echo 'Installing gcc@6 (6.4.0-2)'
brew install gcc\@6 || brew link --overwrite gcc\@6
fi
Expand Down
157 changes: 0 additions & 157 deletions ci-scripts/integration-test-auth.sh

This file was deleted.

Loading

0 comments on commit 47f8d0f

Please sign in to comment.