Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ DOCKER_TAG:=latest

#docker_%: $(TMPBIN)/%.iid

docker_%: % $(DOCKER_GLOBAL_DEPS) $(DOCKER_TARGET_DEPS)
altroot_prep_%: % $(DOCKER_GLOBAL_DEPS) $(DOCKER_TARGET_DEPS)
@BUILD=$(BUILD) bash $(DOCKER_GET_REVISION_SCRIPT) $(<) > $(TMPBIN)/$(<).rid $(if $(DOCKER_ALLOW_DIRTY), || true,)
echo "revision" `cat $(TMPBIN)/$(<).rid`
@echo "Building $(<) for use within docker"
+make TMPBIN=$(TMPBIN) LIB=$(TMPBIN)/docker-$(<)/lib BIN=$(TMPBIN)/docker-$(<)/bin ETC=$(TMPBIN)/docker-$(<)/etc $(<)
make TMPBIN=$(TMPBIN) LIB=$(TMPBIN)/docker-$(<)/opt/lib BIN=$(TMPBIN)/docker-$(<)/opt/bin ALTROOT=$(TMPBIN)/docker-$(<) $(<)

docker_%: % $(DOCKER_GLOBAL_DEPS) $(DOCKER_TARGET_DEPS)
make altroot_prep_$(<)
@echo "Creating container"
@rm -f $(TMPBIN)/$(<).cid
docker run -cidfile $(TMPBIN)/$(<).cid -v `pwd`:/tmp/build $(DOCKER_BASE_IMAGE) sh /tmp/build/$(JML_BUILD)/docker_install_inside_container.sh /tmp/build/$(TMPBIN)/docker-$(<) $(if $(DOCKER_POST_INSTALL_SCRIPT),/tmp/build/$(DOCKER_POST_INSTALL_SCRIPT))
Expand Down
7 changes: 4 additions & 3 deletions docker_install_inside_container.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash

set -e

echo "installing from " $1

mkdir -p /opt
cp -r $1/* /opt
cp -r $1/etc/* /etc
cd $1
cp -av * /

$2
10 changes: 10 additions & 0 deletions functions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,16 @@ libraries: $(LIB)/$$(tmpLIBNAME)$$(so)
endif
endef

# add a forward dependency to a library, ie it depends upon a library defined further forwards
# in the makefile.
# $(1): name of the library
# $(2): name of all libraries it has a forward dependency on
define library_forward_dependency
ifneq ($(PREMAKE),1)
$$(if $$(LIB_$(1)_SO),,$$(error unknown library $(1) for forward dep))
$$(LIB_$(1)_SO): $$(foreach lib,$(2), $(LIB)/lib$$(lib)$$(so))
endif
endef

# add a program
# $(1): name of the program
Expand Down
70 changes: 53 additions & 17 deletions to_junit.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,70 @@
#make test | python junit.py > testresults.xml
#
# to_junit.py
# Nicolas Kructhen, 2013-03-26
# Mich, 2015-03-05
# Copyright (c) 2013 Datacratic Inc. All rights reserved.
#
# make test | python junit.py > testresults.xml

import os, fileinput
from xml.sax.saxutils import escape
import os
import fileinput
from xml.etree import ElementTree
from StringIO import StringIO

passed = set()
failed = set()

for l in fileinput.input():
pieces = l.strip().replace("\x1b[0m", "").replace("\x1b[32m","").replace("\x1b[31m", "").split()
if not len(pieces) == 2: continue
if pieces[1] == "passed": passed.add(pieces[0])
if pieces[1] == "FAILED": failed.add(pieces[0])
pieces = l.strip().replace("\x1b[0m", "").replace("\x1b[32m", "") \
.replace("\x1b[31m", "").split()
if not len(pieces) == 2:
continue
if pieces[1] == "passed":
passed.add(pieces[0])
if pieces[1] == "FAILED":
failed.add(pieces[0])

failed.difference_update(passed)

print """<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" tests="%d" time="0" failures="%d" name="tests">""" % (len(passed)+len(failed), len(failed))
builder = ElementTree.TreeBuilder()
builder.start('testsuite', {
'errors' : '0',
'tests' : str(len(passed) + len(failed)),
'time' : '0',
'failures' : str(len(failed)),
'name' : 'tests'
})

for f in failed:

failContent = ""

if os.path.isfile("build/x86_64/tests/%s.failed" % f):
with open("build/x86_64/tests/%s.failed" % f, "r") as failFile:
with open("build/x86_64/tests/%s.failed" % f, "r") as failFile:
failContent = failFile.read()
builder.start('testcase', {
'time' : '0',
'name' : f
})
builder.start('failure', {
'type' : 'failure',
'message' : 'Check log'
})
builder.data(failContent)
builder.end('failure')
builder.end('testcase')

for p in passed:
builder.start('testcase', {
'time' : '0',
'name' : p
})
builder.end('testcase')

print """ <testcase time="0" name="%s">
<failure type="failure" message="Check log">%s</failure>
</testcase>""" % (f, escape(failContent))
for p in passed:
print """ <testcase time="0" name="%s"/>""" % p
builder.end('testsuite')

print "</testsuite>"
tree = ElementTree.ElementTree()
element = builder.close()
tree._setroot(element)
io = StringIO()
tree.write(io, encoding='ascii', xml_declaration=True)
print io.getvalue()