Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:oracle-dart/oracle.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
loveridge committed Aug 17, 2015
2 parents f879a66 + cbc4c85 commit 03dc358
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
.PHONY: all check-env clean


CC := clang
CFLAGS = -std=c++11 -Wall -fPIC

ifdef COVERAGE
CC = gcc
CFLAGS += --coverage
endif

SRC_DIR=$(CURDIR)/lib/src
TARGETS=$(wildcard $(SRC_DIR)/*.cc)
OBJECTS=$(TARGETS:%.cc=%.o)
Expand Down Expand Up @@ -35,4 +39,5 @@ all: $(OBJECTS)
$< -o $@

clean:
rm $(SRC_DIR)/*.o
rm -f $(SRC_DIR)/*.o
rm -f $(SRC_DIR)/*.so
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# oracle

[![Build Status](http://oracledart.cjlucas.net:8080/buildStatus/icon?job=oracle.dart)](http://oracledart.cjlucas.net:8080/job/oracle.dart/)
[![Coverage Status](https://coveralls.io/repos/oracle-dart/oracle.dart/badge.svg?branch=master&service=github)](https://coveralls.io/github/oracle-dart/oracle.dart?branch=master)

Provides Oracle database access support for Dart via an API that is similar to
OCCI.
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dependencies:
grinder: any
logging: any
test: any
dart_coveralls: any
5 changes: 5 additions & 0 deletions test/statement_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ main() {
expect(results.getInt(1), equals(1));
});

test('.executeUpdate', () {
var stmt = conn.createStatement('INSERT INTO stmt_test (test_int) VALUES (NULL)');
expect(stmt.executeUpdate(), 1);
});

group('setTimestamp', () {
test('with UTC', () {
var stmt = conn.createStatement('INSERT INTO stmt_test (test_ts) VALUES (:1)');
Expand Down
73 changes: 73 additions & 0 deletions tool/coveralls_merge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env python

#
# merges multiple coverall json reports into one
#

import json
import os
import sys

def find_by_name(source_files_json, name):
for j in source_files_json:
if j['name'] == name:
return j

return None

def merge_source_files(master, source):
for sf in source:
dest_sf = find_by_name(master, sf['name'])
if dest_sf is None:
master.append(sf)
continue

assert len(dest_sf['coverage']) == len(sf['coverage'])

for i, line in enumerate(sf['coverage']):
if line is None:
continue

if dest_sf['coverage'][i] is None:
dest_sf['coverage'][i] = 0


dest_sf['coverage'][i] += line

def get_json_from_file(fpath):
with open(fpath, 'rb') as fp:
return json.load(fp)

def main():
if len(sys.argv) == 1:
print("Usage: {0} <file1> <file2> <outfile>")
return

out = {}
out['source_files'] = []
out['repo_token'] = os.environ['COVERALLS_TOKEN']

if out['repo_token'] is None:
print("COVERALLS_TOKEN is not set")
sys.exit(1)

sources = []

for f in sys.argv[1:-1]:
assert os.path.isfile(f)
sources.append(get_json_from_file(f))

# pull git information
for s in sources:
for key in ['git', 'branch', 'remotes']:
if key in s:
out[key] = s[key]

merge_source_files(out['source_files'], s['source_files'])


with open(sys.argv[-1], 'wb') as fp:
json.dump(out, fp)

if __name__ == '__main__':
main()
21 changes: 21 additions & 0 deletions tool/scrape_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python

#
# Scrape json from dart_coveralls because it's terrible and only dumps json to stdout
#

import sys

def main():
lines = sys.stdin.readlines()

for i, l in enumerate(lines):
if l.startswith('{'):
break

for l in lines[i:]:
print(l.strip("\r\n"))


if __name__ == '__main__':
main()
19 changes: 19 additions & 0 deletions tool/send_coveralls.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

rm -rf coverage > /dev/null
mkdir coverage

for f in test/*_test.dart; do
echo "Covering $f"
dart_coveralls report -T --dry-run -p $f | python tool/scrape_json.py > coverage/$(basename $f).json
done

echo "Covering cpp"
cpp-coveralls -b lib/src -t faketoken --dump coverage/cpp_coverage.json

merged_json=coverage/merged.json
echo "Merging coverage files"
python tool/coveralls_merge.py coverage/* $merged_json

echo 'Uploading to coveralls.io...'
curl -v -F json_file=@$merged_json https://coveralls.io/api/v1/jobs

0 comments on commit 03dc358

Please sign in to comment.