...
 
Commits (51)
......@@ -2,9 +2,8 @@ services:
- docker
stages:
- static_analysis
- source_check
- test
- build
- thorough_tests
- docs
......@@ -18,10 +17,7 @@ stages:
- $(pwd)/.cache/jhbuild/build/gjs/Makefile
- $(pwd)/.cache/jhbuild/build/gjs/configure
- $(pwd)/coverage/
- $(pwd)/cppcheck/
- $(pwd)/cpplint/
- $(pwd)/eslint/
- $(pwd)/tokei/
- $(pwd)/analysis/
- $(pwd)/gjs-1.*/_build/sub/test-suite.log
- $(pwd)/*.log
- $(pwd)/Makefile
......@@ -37,28 +33,35 @@ stages:
echo;
'
# Run static code analysis OR
# Build dependencies and 'make' gjs
# GitLab is keeping some files between jobs. Remove them.
- rm -rf configure Makefile *.log analysis
# Run static code analysis OR
# Build GJS
- 'if [[ -n "${CODECHECK}" ]]; then
$(pwd)/test/test-ci.sh "$CODECHECK";
else
$(pwd)/test/test-ci.sh GJS;
fi'
fi
'
# Run extra tests
# Run installed extra tests
- 'if [[ $BUILD_OPTS == *"--enable-installed-tests"* ]]; then
$(pwd)/test/test-ci.sh GJS_EXTRA;
fi'
fi
'
# Run code coverage tests
- 'if [[ $BUILD_OPTS == *"--enable-code-coverage"* ]]; then
$(pwd)/test/test-ci.sh GJS_COVERAGE;
fi'
fi
'
# Run valgrind
- 'if [[ $BUILD_OPTS == *"--enable-valgrind"* ]]; then
$(pwd)/test/test-ci.sh VALGRIND;
fi'
fi
'
- 'echo;
echo "*********************************************";
......@@ -66,19 +69,25 @@ stages:
echo "*********************************************";
'
#############################################
# Run a test despite of any Docker image change
#############################################
fedora:
<<: *build
when: always
stage: test
image: claudioandre/spidermonkey:job-400.5 # temporarily pinned to old tag
stage: source_check
image: claudioandre/spidermonkey:job-419.5 # pinned on purpose
variables:
CC: gcc
DEV: devel
TEST: "check"
WARNINGS: "count"
#############################################
# Regular tests
#############################################
ubuntu_gcc:
<<: *build
stage: build
stage: test
image: claudioandre/spidermonkey:ubuntu.dev.gcc
variables:
CC: gcc
......@@ -89,7 +98,7 @@ ubuntu_gcc:
ubuntu_clang:
<<: *build
stage: build
stage: test
image: claudioandre/spidermonkey:ubuntu.dev.gcc
variables:
CC: clang
......@@ -100,7 +109,7 @@ ubuntu_clang:
fedora_clang:
<<: *build
stage: build
stage: test
image: claudioandre/spidermonkey:new-342.4 # temporarily pinned to old tag
variables:
CC: clang
......@@ -110,7 +119,7 @@ fedora_clang:
no_profiler:
<<: *build
stage: thorough_tests
image: claudioandre/spidermonkey:job-400.5 # temporarily pinned to old tag
image: claudioandre/spidermonkey:fedora.dev.gcc
variables:
CC: gcc
DEV: devel
......@@ -140,7 +149,7 @@ coverage:
sanitizer_gcc:
<<: *build
stage: thorough_tests
image: claudioandre/spidermonkey:job-400.5 # temporarily pinned to old tag
image: claudioandre/spidermonkey:fedora.dev.gcc
variables:
CC: gcc
DEV: devel
......@@ -174,37 +183,42 @@ codequality:
only:
- master@GNOME/gjs
#############################################
# Static Analyzers
#############################################
cppcheck:
<<: *build
stage: static_analysis
stage: source_check
image: claudioandre/spidermonkey:fedora.static.analysis
variables:
CODECHECK: "CPPCHECK"
cpplint:
<<: *build
stage: static_analysis
stage: source_check
image: claudioandre/spidermonkey:fedora.static.analysis
variables:
CODECHECK: "CPPLINT"
eslint:
<<: *build
stage: static_analysis
stage: source_check
image: claudioandre/spidermonkey:fedora.static.analysis
variables:
CODECHECK: "ESLINT"
code_statistics:
<<: *build
stage: static_analysis
stage: source_check
image: claudioandre/spidermonkey:fedora.static.analysis
variables:
CODECHECK: "TOKEI"
only:
- master@GNOME/gjs
# Publish Code Coverage Report
#############################################
# Publish the Code Coverage Report
#############################################
pages:
stage: docs
dependencies:
......@@ -223,7 +237,7 @@ pages:
valgrind:
<<: *build
stage: thorough_tests
image: claudioandre/spidermonkey:job-400.5 # temporarily pinned to old tag
image: claudioandre/spidermonkey:fedora.dev.gcc
variables:
CC: gcc
DEV: devel
......@@ -234,10 +248,19 @@ valgrind:
no_graphics:
<<: *build
stage: thorough_tests
image: claudioandre/spidermonkey:job-400.5 # temporarily pinned to old tag
image: claudioandre/spidermonkey:fedora.dev.gcc
variables:
CC: gcc
DEV: devel
TEST: "check"
BUILD_OPTS: "--without-cairo --without-gtk"
when: manual
lts:
<<: *build
stage: thorough_tests
image: claudioandre/spidermonkey:ubuntu.lts.gcc
variables:
CC: gcc
TEST: "check"
when: manual
Version 1.52.5
--------------
- This release includes the "Big Hammer" patch from GNOME 3.30 to reduce memory
usage. For more information, read the blog post at
https://feaneron.com/2018/04/20/the-infamous-gnome-shell-memory-leak/
It was not originally intended to be backported to GNOME 3.28, but in practice
several Linux distributions already backported it, and it has been working
well to reduce memory usage, and the bugs have been ironed out of it.
It does decrease performance somewhat, so if you don't want that then don't
install this update.
- Closed bugs and merge requests:
* Ensure not to miss the force_gc flag [#150, !132, Carlos Garnacho]
* Make GC much more aggressive [#62, !50, Giovanni Campagna, Georges Basile
Stavracas Neto, Philip Chimento]
* Queue GC when a GObject reference is toggled down [#140, !114, !127, Georges
Basile Stavracas Neto]
* Reduce memory overhead of g_object_weak_ref() [#144, !122, Carlos Garnacho,
Philip Chimento]
* context: Defer and therefore batch forced GC runs [performance] [!236,
Daniel van Vugt]
* context: use timeout with seconds to schedule a gc trigger [!239, Marco
Trevisan]
* Use compacting GC on RSS size growth [!133, #151, Carlos Garnacho]
* GType memleak fixes [!244, Marco Trevisan]
Version 1.52.4
--------------
- Closed bugs and merge requests:
* `ARGV` encoding issues [#22, !108, Evan Welsh]
* Segfault on enumeration of GjSFileImporter properties when a searchpath
entry contains a symlink [#154, !144, Ole Jørgen Brønner]
* Possible refcounting bug around GtkListbox signal handlers [#24, !154,
Philip Chimento]
* Fix up GJS_DISABLE_JIT flag now the JIT is enabled by default in
SpiderMonkey [!159, Christopher Wheeldon]
* Expose GObject static property symbols. [!197, Evan Welsh]
* Do not run linters on tagged commits [!181, Claudio André]
* gjs-1.52.0 fails to compile against x86_64 musl systems [#132, !214, Philip
Chimento]
* gjs no longer builds after recent autoconf-archive updates [#149, !217,
Philip Chimento]
Version 1.52.3
--------------
- Closed bugs and merge requests:
* Include calc.js example from Seed [!130, William Barath, Philip Chimento]
* CI: Un-pin the Fedora Docker image [#141, !131, Claudio André]
* Reduce overhead of wrapped objects [#142, !121, Carlos Garnacho, Philip
Chimento]
* Various CI changes [!134, !136, Claudio André]
Version 1.52.2
--------------
- This is an unscheuled release in order to revert a commit that causes a crash
on exit, with some Cairo versions.
- Closed bugs and merge requests:
* CI: pinned Fedora to old tag [!119, Claudio André]
* heapgraph.py: adjust terminal output style [!120, Andy Holmes]
* CI: small tweaks [!123, Claudio André]
* Warn about compilation warnings [!125, Claudio André]
* Miscellaneous commits [Philip Chimento, Jason Hicks]
Version 1.52.1
--------------
......
......@@ -3,7 +3,7 @@
m4_define(pkg_major_version, 1)
m4_define(pkg_minor_version, 52)
m4_define(pkg_micro_version, 2)
m4_define(pkg_micro_version, 5)
m4_define(pkg_version, pkg_major_version.pkg_minor_version.pkg_micro_version)
m4_define(pkg_int_version, (pkg_major_version * 100 + pkg_minor_version) * 100 + pkg_micro_version)
......@@ -152,9 +152,20 @@ AS_IF([test x$have_gtk = xyes], [
AC_ARG_ENABLE([profiler],
[AS_HELP_STRING([--disable-profiler], [Don't build profiler])])
AS_IF([test x$enable_profiler != xno], [
# Requires timer_settime() - only on Linux
gl_TIMER_TIME
AS_IF([test x$ac_cv_func_timer_settime = xno],
# Requires SIGEV_THREAD_ID - not in some stdlibs
have_sigev_thread_id=no
AC_MSG_CHECKING([for Linux SIGEV_THREAD_ID])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[#include <signal.h>]], [return SIGEV_THREAD_ID;])
], [
have_sigev_thread_id=yes
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AS_IF([test x$ac_cv_func_timer_settime = xno -o x$have_sigev_thread_id = xno],
[AC_MSG_ERROR([The profiler is currently only supported on Linux.
The standard library must support timer_settime() and SIGEV_THREAD_ID.
Configure with --disable-profiler to skip it on other platforms.])])
AC_DEFINE([ENABLE_PROFILER], [1], [Define if the profiler should be built.])
])
......
#!/usr/bin/env gjs
imports.gi.versions.Gtk = '3.0';
const {Gtk} = imports.gi;
Gtk.init(null);
var calc_val = '';
function update_display() {
label.set_markup(`<span size='30000'>${calc_val}</span>`);
if(calc_val === '') {
label.set_markup("<span size='30000'>0</span>");
}
}
function clear() {
calc_val = '';
update_display();
}
function backspace() {
calc_val = calc_val.substring(0, calc_val.length - 1);
update_display();
}
function pressed_equals() {
calc_val = calc_val.replace('sin', 'Math.sin');
calc_val = calc_val.replace('cos', 'Math.cos');
calc_val = calc_val.replace('tan', 'Math.tan');
calc_val = eval(calc_val);
// Avoid ridiculous amounts of precision from toString.
if (calc_val == Math.floor(calc_val))
calc_val = Math.floor(calc_val);
else // bizarrely gjs loses str.toFixed() somehow?!
calc_val = Math.floor(calc_val * 10000) / 10000;
label.set_markup(`<span size='30000'>${calc_val}</span>`);
}
function pressed_operator(button) {
calc_val += button.label;
update_display();
}
function pressed_number(button) {
calc_val = (((calc_val === 0) ? '' : calc_val) + button.label);
update_display();
}
function swap_sign() {
calc_val = ((calc_val[0] == '-') ?
calc_val.substring(1) : '-' + calc_val);
update_display();
}
function random_num() {
calc_val = Math.floor(Math.random() * 1000) + '';
update_display();
}
function pack_buttons(buttons, vbox) {
var hbox = new Gtk.HBox();
hbox.homogeneous = true;
vbox.pack_start(hbox, true, true, 2);
for(let i = 0; i <= 4; i++) {
hbox.pack_start(buttons[i], true, true, 1);
}
}
function create_button(str, func) {
var btn = new Gtk.Button({label: str});
btn.connect('clicked', func);
return btn;
}
function create_buttons() {
var vbox = new Gtk.VBox({homogeneous: true});
pack_buttons([
create_button('(', pressed_number),
create_button('←', backspace),
create_button('↻', random_num),
create_button('Clr', clear),
create_button('±', swap_sign)], vbox);
pack_buttons([
create_button(')', pressed_number),
create_button('7', pressed_number),
create_button('8', pressed_number),
create_button('9', pressed_number),
create_button('/', pressed_operator)], vbox);
pack_buttons([
create_button('sin(', pressed_number),
create_button('4', pressed_number),
create_button('5', pressed_number),
create_button('6', pressed_number),
create_button('*', pressed_operator)], vbox);
pack_buttons([
create_button('cos(', pressed_number),
create_button('1', pressed_number),
create_button('2', pressed_number),
create_button('3', pressed_number),
create_button('-', pressed_operator)], vbox);
pack_buttons([
create_button('tan(', pressed_number),
create_button('0', pressed_number),
create_button('.', pressed_number),
create_button('=', pressed_equals),
create_button('+', pressed_operator)], vbox);
return vbox;
}
var win = new Gtk.Window({
title: 'Calculator',
resizable: false,
opacity: 0.6,
});
win.resize(250, 250);
win.connect('destroy', () => Gtk.main_quit());
var label = new Gtk.Label({label: ''});
label.set_alignment(1, 0);
update_display();
var mainvbox = new Gtk.VBox();
mainvbox.pack_start(label, false, true, 1);
mainvbox.pack_start(new Gtk.HSeparator(), false, true, 5);
mainvbox.pack_start(create_buttons(), true, true, 2);
win.add(mainvbox);
win.show_all();
Gtk.main();
\ No newline at end of file
......@@ -63,13 +63,18 @@ update_gtype_weak_pointers(JSContext *cx,
void *data)
{
for (auto iter = weak_pointer_list.begin(); iter != weak_pointer_list.end(); ) {
auto heap_wrapper = static_cast<JS::Heap<JSObject *> *>(g_type_get_qdata(*iter, gjs_get_gtype_wrapper_quark()));
GType gtype = *iter;
auto heap_wrapper = static_cast<JS::Heap<JSObject *> *>(
g_type_get_qdata(gtype, gjs_get_gtype_wrapper_quark()));
JS_UpdateWeakPointerAfterGC(heap_wrapper);
/* No read barriers are needed if the only thing we are doing with the
* pointer is comparing it to nullptr. */
if (heap_wrapper->unbarrieredGet() == nullptr)
if (heap_wrapper->unbarrieredGet() == nullptr) {
g_type_set_qdata(gtype, gjs_get_gtype_wrapper_quark(), nullptr);
iter = weak_pointer_list.erase(iter);
delete heap_wrapper;
}
else
iter++;
}
......@@ -95,8 +100,12 @@ gjs_gtype_finalize(JSFreeOp *fop,
if (G_UNLIKELY(gtype == 0))
return;
weak_pointer_list.erase(gtype);
auto heap_wrapper = static_cast<JS::Heap<JSObject*>*>(
g_type_get_qdata(gtype, gjs_get_gtype_wrapper_quark()));
g_type_set_qdata(gtype, gjs_get_gtype_wrapper_quark(), NULL);
weak_pointer_list.erase(gtype);
delete heap_wrapper;
}
static bool
......
This diff is collapsed.
......@@ -61,6 +61,8 @@ bool gjs_typecheck_is_object(JSContext *context,
void gjs_object_prepare_shutdown(void);
void gjs_object_clear_toggles(void);
void gjs_object_shutdown_toggle_queue(void);
void gjs_object_context_dispose_notify(void *data,
GObject *where_the_object_was);
void gjs_object_define_static_methods(JSContext *context,
JS::HandleObject constructor,
......
......@@ -36,6 +36,8 @@ bool _gjs_context_destroying (GjsContext *js_context);
void _gjs_context_schedule_gc_if_needed (GjsContext *js_context);
void _gjs_context_schedule_gc(GjsContext *js_context);
void _gjs_context_exit(GjsContext *js_context,
uint8_t exit_code);
......
......@@ -90,6 +90,7 @@ struct _GjsContext {
uint8_t exit_code;
guint auto_gc_id;
bool force_gc;
std::array<JS::PersistentRootedId*, GJS_STRING_LAST> const_strings;
......@@ -515,6 +516,8 @@ gjs_context_constructed(GObject *object)
g_mutex_unlock (&contexts_lock);
setup_dump_heap();
g_object_weak_ref(object, gjs_object_context_dispose_notify, nullptr);
}
static void
......@@ -592,19 +595,43 @@ trigger_gc_if_needed (gpointer user_data)
{
GjsContext *js_context = GJS_CONTEXT(user_data);
js_context->auto_gc_id = 0;
gjs_gc_if_needed(js_context->context);
if (js_context->force_gc)
JS_GC(js_context->context);
else
gjs_gc_if_needed(js_context->context);
js_context->force_gc = false;
return G_SOURCE_REMOVE;
}
void
_gjs_context_schedule_gc_if_needed (GjsContext *js_context)
static void
_gjs_context_schedule_gc_internal(GjsContext *js_context,
bool force_gc)
{
js_context->force_gc |= force_gc;
if (js_context->auto_gc_id > 0)
return;
js_context->auto_gc_id = g_idle_add_full(G_PRIORITY_LOW,
trigger_gc_if_needed,
js_context, NULL);
js_context->force_gc |= force_gc;
js_context->auto_gc_id = g_timeout_add_seconds_full(G_PRIORITY_LOW, 10,
trigger_gc_if_needed,
js_context, NULL);
}
void
_gjs_context_schedule_gc(GjsContext *js_context)
{
_gjs_context_schedule_gc_internal(js_context, true);
}
void
_gjs_context_schedule_gc_if_needed(GjsContext *js_context)
{
_gjs_context_schedule_gc_internal(js_context, false);
}
void
......
......@@ -37,10 +37,6 @@
#include <windows.h>
#endif
#ifdef ENABLE_CAIRO
# include <cairo.h>
#endif
/* Implementations of locale-specific operations; these are used
* in the implementation of String.localeCompare(), Date.toLocaleDateString(),
* and so forth. We take the straight-forward approach of converting
......@@ -218,16 +214,6 @@ on_promise_unhandled_rejection(JSContext *cx,
std::move(stack));
}
static void
shutdown(void)
{
JS_ShutDown();
#ifdef ENABLE_CAIRO
cairo_debug_reset_static_data(); /* for valgrind reports */
#endif
}
#ifdef G_OS_WIN32
HMODULE gjs_dll;
static bool gjs_is_inited = false;
......@@ -245,7 +231,7 @@ LPVOID lpvReserved)
break;
case DLL_THREAD_DETACH:
shutdown();
JS_ShutDown ();
break;
default:
......@@ -265,7 +251,7 @@ public:
}
~GjsInit() {
shutdown();
JS_ShutDown();
}
operator bool() {
......@@ -322,13 +308,14 @@ gjs_create_js_context(GjsContext *js_context)
JS::ContextOptionsRef(cx).setExtraWarnings(true);
}
if (!g_getenv("GJS_DISABLE_JIT")) {
bool enable_jit = !(g_getenv("GJS_DISABLE_JIT"));
if (enable_jit) {
gjs_debug(GJS_DEBUG_CONTEXT, "Enabling JIT");
JS::ContextOptionsRef(cx)
.setIon(true)
.setBaseline(true)
.setAsmJS(true);
}
JS::ContextOptionsRef(cx)
.setIon(enable_jit)
.setBaseline(enable_jit)
.setAsmJS(enable_jit);
return cx;
}
......@@ -706,7 +706,7 @@ importer_enumerate(JSContext *context,
/* new_for_commandline_arg handles resource:/// paths */
GjsAutoUnref<GFile> dir = g_file_new_for_commandline_arg(dirname);
GjsAutoUnref<GFileEnumerator> direnum =
g_file_enumerate_children(dir, G_FILE_ATTRIBUTE_STANDARD_TYPE,
g_file_enumerate_children(dir, "standard::name,standard::type",
G_FILE_QUERY_INFO_NONE, NULL, NULL);
while (true) {
......
......@@ -219,6 +219,7 @@ public:
return m_root->get() == nullptr;
return m_heap.unbarrieredGet() == nullptr;
}
inline bool operator!=(std::nullptr_t) const { return !(*this == nullptr); }
/* You can get a Handle<T> if the thing is rooted, so that you can use this
* wrapper with stack rooting. However, you must not do this if the
......@@ -247,10 +248,12 @@ public:
m_data = data;
m_root = new JS::PersistentRooted<T>(m_cx, thing);
auto gjs_cx = static_cast<GjsContext *>(JS_GetContextPrivate(m_cx));
g_assert(GJS_IS_CONTEXT(gjs_cx));
g_object_weak_ref(G_OBJECT(gjs_cx), on_context_destroy, this);
m_has_weakref = true;
if (notify) {
auto gjs_cx = static_cast<GjsContext *>(JS_GetContextPrivate(m_cx));
g_assert(GJS_IS_CONTEXT(gjs_cx));
g_object_weak_ref(G_OBJECT(gjs_cx), on_context_destroy, this);
m_has_weakref = true;
}
}
/* You can only assign directly to the GjsMaybeOwned wrapper in the
......
......@@ -26,6 +26,8 @@
#include <codecvt>
#include <locale>
#include "jsapi-wrapper.h"
#include <js/GCAPI.h>
#include <util/log.h>
#include <util/glib.h>
......@@ -34,7 +36,6 @@
#include "jsapi-class.h"
#include "jsapi-util.h"
#include "jsapi-wrapper.h"
#include "context-private.h"
#include <gi/boxed.h>
......@@ -313,8 +314,9 @@ gjs_build_string_array(JSContext *context,
g_error("Unable to reserve memory for vector");
for (i = 0; i < array_length; ++i) {
JS::ConstUTF8CharsZ chars(array_values[i], strlen(array_values[i]));
JS::RootedValue element(context,
JS::StringValue(JS_NewStringCopyZ(context, array_values[i])));
JS::StringValue(JS_NewStringCopyUTF8Z(context, chars)));
if (!elems.append(element))
g_error("Unable to append to vector");
}
......@@ -731,7 +733,7 @@ gjs_gc_if_needed (JSContext *context)
*/
if (rss_size > linux_rss_trigger) {
linux_rss_trigger = (gulong) MIN(G_MAXULONG, rss_size * 1.25);
JS_GC(context);
JS::GCForReason(context, GC_SHRINK, JS::gcreason::Reason::API);
} else if (rss_size < (0.75 * linux_rss_trigger)) {
/* If we've shrunk by 75%, lower the trigger */
linux_rss_trigger = (rss_size * 1.25);
......
# Valgrind suppressions file for GJS
# This is intended to be used in addition to GLib's glib.supp file.
# We leak a small wrapper in GJS for each registered GType.
{
gtype-wrapper-new
Memcheck:Leak
match-leak-kinds: definite
fun:_Znwm
fun:gjs_gtype_create_gtype_wrapper
}
{
gtype-wrapper-qdata
Memcheck:Leak
match-leak-kinds: possible
...
fun:type_set_qdata_W
fun:g_type_set_qdata
fun:gjs_gtype_create_gtype_wrapper
}
{
g_type_register_fundamental never freed
Memcheck:Leak
fun:calloc
...
fun:g_type_register_fundamental
...
}
# SpiderMonkey leaks
{
......@@ -143,6 +114,29 @@
fun:cairo_show_text
}
# Data that Cairo keeps around for the process lifetime
# This could be freed by calling cairo_debug_reset_static_data(), but it's
# not a good idea to call that function in production, because certain versions
# of Cairo have bugs that cause it to fail assertions and crash.
{
cairo-static-data
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
fun:FcPatternDuplicate
fun:_cairo_ft_font_face_create_for_pattern
fun:_cairo_ft_font_face_create_for_toy
fun:_cairo_toy_font_face_create_impl_face
fun:_cairo_toy_font_face_init
fun:cairo_toy_font_face_create
fun:_cairo_gstate_ensure_font_face
fun:_cairo_gstate_ensure_scaled_font
fun:_cairo_gstate_get_scaled_font
fun:_cairo_default_context_get_scaled_font
fun:cairo_show_text
}
# SpiderMonkey data races
# These are in SpiderMonkey's atomics / thread barrier stuff so presumably
......
# SpiderMonkey leaks a mutex for each GC helper thread.
leak:js::HelperThread::threadLoop
# We leak a small wrapper in GJS for each registered GType.
leak:gjs_gtype_create_gtype_wrapper
# https://bugs.freedesktop.org/show_bug.cgi?id=105466
leak:libfontconfig.so.1
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CODE_COVERAGE()
#
# DESCRIPTION
#
# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included
# in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every
# build target (program or library) which should be built with code
# coverage support. Also defines CODE_COVERAGE_RULES which should be
# substituted in your Makefile; and $enable_code_coverage which can be
# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
# and substituted, and corresponds to the value of the
# --enable-code-coverage option, which defaults to being disabled.
#
# Test also for gcov program and create GCOV variable that could be
# substituted.
#
# Note that all optimization flags in CFLAGS must be disabled when code
# coverage is enabled.
#
# Usage example:
#
# configure.ac:
#
# AX_CODE_COVERAGE
#
# Makefile.am:
#
# @CODE_COVERAGE_RULES@
# my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ...
# my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
# my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
#
# This results in a "check-code-coverage" rule being added to any
# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
# has been configured with --enable-code-coverage). Running `make
# check-code-coverage` in that directory will run the module's test suite
# (`make check`) and build a code coverage report detailing the code which
# was touched, then print the URI for the report.
#
# In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined
# instead of CODE_COVERAGE_LIBS. They are both still defined, but use of
# CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is
# deprecated. They have the same value.
#
# This code was derived from Makefile.decl in GLib, originally licenced
# under LGPLv2.1+.
#
# LICENSE
#
# Copyright (c) 2012, 2016 Philip Withnall
# Copyright (c) 2012 Xan Lopez
# Copyright (c) 2012 Christian Persch
# Copyright (c) 2012 Paolo Borelli
# Copyright (c) 2012 Dan Winship
# Copyright (c) 2015 Bastien ROUCARIES
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or (at
# your option) any later version.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#serial 25
AC_DEFUN([AX_CODE_COVERAGE],[
dnl Check for --enable-code-coverage
AC_REQUIRE([AC_PROG_SED])
# allow to override gcov location
AC_ARG_WITH([gcov],
[AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
[_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
[_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
AC_MSG_CHECKING([whether to build with code coverage support])
AC_ARG_ENABLE([code-coverage],
AS_HELP_STRING([--enable-code-coverage],
[Whether to enable code coverage support]),,
enable_code_coverage=no)
AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
AC_MSG_RESULT($enable_code_coverage)
AS_IF([ test "$enable_code_coverage" = "yes" ], [
# check for gcov
AC_CHECK_TOOL([GCOV],
[$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
[:])
AS_IF([test "X$GCOV" = "X:"],
[AC_MSG_ERROR([gcov is needed to do coverage])])
AC_SUBST([GCOV])
dnl Check if gcc is being used
AS_IF([ test "$GCC" = "no" ], [
AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
])
AC_CHECK_PROG([LCOV], [lcov], [lcov])
AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
AS_IF([ test -z "$LCOV" ], [
AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed])
])
AS_IF([ test -z "$GENHTML" ], [
AC_MSG_ERROR([Could not find genhtml from the lcov package])
])
dnl Build the code coverage flags
dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
CODE_COVERAGE_LIBS="-lgcov"
CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
AC_SUBST([CODE_COVERAGE_CPPFLAGS])
AC_SUBST([CODE_COVERAGE_CFLAGS])
AC_SUBST([CODE_COVERAGE_CXXFLAGS])
AC_SUBST([CODE_COVERAGE_LIBS])
AC_SUBST([CODE_COVERAGE_LDFLAGS])
[CODE_COVERAGE_RULES_CHECK='
-$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
']
[CODE_COVERAGE_RULES_CAPTURE='
$(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
$(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
-@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
$(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
@echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
']
[CODE_COVERAGE_RULES_CLEAN='
clean: code-coverage-clean
distclean: code-coverage-clean
code-coverage-clean:
-$(LCOV) --directory $(top_builddir) -z
-rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
']
], [
[CODE_COVERAGE_RULES_CHECK='
@echo "Need to reconfigure with --enable-code-coverage"
']
CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK"
CODE_COVERAGE_RULES_CLEAN=''
])
[CODE_COVERAGE_RULES='
# Code coverage
#
# Optional:
# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
# Multiple directories may be specified, separated by whitespace.
# (Default: $(top_builddir))
# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
# by lcov for code coverage. (Default:
# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
# reports to be created. (Default:
# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
# set to 0 to disable it and leave empty to stay with the default.
# (Default: empty)
# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
# instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
# instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
# collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
# instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
# lcov instance. (Default: empty)
# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
# instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
# genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
# instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
#
# The generated report will be titled using the $(PACKAGE_NAME) and
# $(PACKAGE_VERSION). In order to add the current git hash to the title,
# use the git-version-gen script, available online.
# Optional variables
CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
CODE_COVERAGE_BRANCH_COVERAGE ?=
CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
CODE_COVERAGE_IGNORE_PATTERN ?=
GITIGNOREFILES ?=
GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\
$(CODE_COVERAGE_OUTPUT_FILE);
code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\
$(CODE_COVERAGE_IGNORE_PATTERN);
code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY);
code_coverage_quiet = $(code_coverage_quiet_$(V))
code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
code_coverage_quiet_0 = --quiet
# sanitizes the test-name: replaces with underscores: dashes and dots
code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
# Use recursive makes in order to ignore errors during check
check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"'
# Capture code coverage data
code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"'
# Hook rule executed before code-coverage-capture, overridable by the user
code-coverage-capture-hook:
'"$CODE_COVERAGE_RULES_CLEAN"'
A''M_DISTCHECK_CONFIGURE_FLAGS ?=
A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
']
AC_SUBST([CODE_COVERAGE_RULES])
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
])
......@@ -441,6 +441,14 @@ function _init() {
GObject._children = _children;
GObject._internalChildren = _internalChildren;
// Expose GObject static properties for ES6 classes
GObject.GTypeName = GTypeName;
GObject.requires = requires;
GObject.interfaces = interfaces;
GObject.properties = properties;
GObject.signals = signals;
// fake enum for signal accumulators, keep in sync with gi/object.c
this.AccumulatorType = {
NONE: 0,
......
......@@ -368,7 +368,7 @@ function _onEnterFrame() {
return true;
}
const restrictedWords = {
var restrictedWords = {
time: true,
delay: true,
userFrames: true,
......
......@@ -45,7 +45,7 @@ function do_Configure_MainBuild(){
cat <<EOFILE > ~/.config/jhbuildrc
module_autogenargs['gjs'] = "$autogenargs"
module_makeargs['gjs'] = '-s'
module_makeargs['gjs'] = '-s -j 1'
skip = ['gettext', 'yelp-xsl', 'yelp-tools', 'gtk-doc']
use_local_modulesets = True
disable_Werror = False
......
#!/bin/bash -e
function do_Print_Labels(){
if [[ -n "${1}" ]]; then
label_len=${#1}
span=$(((54 - $label_len) / 2))
echo
echo "= ======================================================== ="
printf "%s %${span}s %s %${span}s %s\n" "=" "" "$1" "" "="
echo "= ======================================================== ="
else
echo "= ========================= Done ========================= ="
echo
fi
}
function do_Set_Env(){
echo
echo '-- Set Environment --'
do_Print_Labels 'Set Environment '
#Save cache on $pwd (required by artifacts)
mkdir -p "$(pwd)"/.cache
......@@ -24,18 +40,18 @@ function do_Set_Env(){
export DISPLAY=":0"
fi
echo '-- Done --'
do_Print_Labels
}
function do_Done(){
# Done. De-initializes whatever is needed
echo
echo '-- FINISHED --'
do_Print_Labels 'FINISHED'
}
function do_Build_Package_Dependencies(){
echo
echo "-- Building Dependencies for $1 --"
do_Print_Labels "Building Dependencies for $1"
jhbuild list "$1"
# Build package dependencies
......@@ -44,28 +60,30 @@ function do_Build_Package_Dependencies(){
function do_Show_Info(){
echo '--------------------------------'
echo '-----------------------------------------'
echo 'Useful build system information'
echo -n "Processors: "; grep -c ^processor /proc/cpuinfo
grep ^MemTotal /proc/meminfo
id; uname -a
printenv
echo '--------------------------------'
echo '-----------------------------------------'
cat /etc/*-release
echo '--------------------------------'
echo '-----------------------------------------'
if [[ ! -z $CC ]]; then
echo 'Compiler version'
$CC --version
echo '--------------------------------'
echo '-----------------------------------------'
$CC -dM -E -x c /dev/null
echo '--------------------------------'
echo '-----------------------------------------'
fi
}
function do_Get_Upstream_Master(){
if [[ "$CI_BUILD_REF_SLUG" == "master" && "$CI_PROJECT_PATH_SLUG" == "gnome-gjs" ]]; then
echo '--------------------------------'
if [[ "$CI_PROJECT_PATH_SLUG" == "gnome-gjs" && \
("$CI_BUILD_REF_SLUG" == "master" || "$CI_BUILD_REF_SLUG" == "gnome-"* || -n "${CI_COMMIT_TAG}") ]]; then
echo '-----------------------------------------'
echo 'Running against upstream master'
echo "=> $1 Nothing to do"
......@@ -73,17 +91,17 @@ function do_Get_Upstream_Master(){
exit 0
fi
echo '--------------------------------'
echo '-----------------------------------------'
echo 'Cloning upstream master'
mkdir -p ~/tmp-upstream; cd ~/tmp-upstream || exit 1
git clone --depth 1 https://gitlab.gnome.org/GNOME/gjs.git; cd gjs || exit 1
echo '--------------------------------'
echo '-----------------------------------------'
}
function do_Compare_With_Upstream_Master(){
echo '--------------------------------'
echo '-----------------------------------------'
echo 'Compare the working code with upstream master'
NEW_WARNINGS=$(comm -13 <(sort < /cwd/master-report.txt) <(sort < /cwd/current-report.txt) | wc -l)
......@@ -101,6 +119,32 @@ function do_Compare_With_Upstream_Master(){
fi
}
function do_Create_Artifacts_Folder(){
# Create the artifacts folders
save_dir="$(pwd)"
if [[ $1 == "GJS_COVERAGE" ]]; then
mkdir -p "$save_dir"/coverage; touch "$save_dir"/coverage/doing-"$1"
fi
mkdir -p "$save_dir"/analysis; touch "$save_dir"/analysis/doing-"$1"
}
function do_Get_Commit_Message(){
# Allow CI to skip jobs. Its goal is to simplify housekeeping.
# Disable tasks using the commit message. Possibilities are (and/or):
# [skip eslint] [skip cpplint] [skip cppcheck]
#
# Just add the "code" anywhere inside the commit message.
log_message=$(git log -n 1)
}
function do_Check_Warnings(){
cat compilation.log | grep "warning:" | awk '{total+=1}END{print "Total number of warnings: "total}'
}
# ----------- Run the Tests -----------
if [[ -n "${BUILD_OPTS}" ]]; then
extra_opts="($BUILD_OPTS)"
......@@ -114,18 +158,8 @@ echo "Doing: $1"
source test/extra/do_jhbuild.sh
# Create the artifacts folders
save_dir="$(pwd)"
mkdir -p "$save_dir"/coverage; touch "$save_dir"/coverage/doing-"$1"
mkdir -p "$save_dir"/cppcheck; touch "$save_dir"/cppcheck/doing-"$1"
mkdir -p "$save_dir"/cpplint; touch "$save_dir"/cpplint/doing-"$1"
mkdir -p "$save_dir"/eslint; touch "$save_dir"/eslint/doing-"$1"
mkdir -p "$save_dir"/tokei; touch "$save_dir"/tokei/doing-"$1"
# Allow CI to skip jobs. Its goal is to simplify housekeeping.
# Disable tasks using the commit message. Possibilities are (and/or):
# [skip eslint] [skip cpplint] [skip cppcheck]
log_message=$(git log -n 1)
do_Create_Artifacts_Folder "$1"
do_Get_Commit_Message
if [[ $1 == "GJS" ]]; then
do_Set_Env
......@@ -144,13 +178,10 @@ if [[ $1 == "GJS" ]]; then
# Build and test the latest commit (merged or from a merge/pull request) of
# Javascript Bindings for GNOME (gjs)
echo
echo '-- gjs status --'
do_Print_Labels 'Show GJS git information'
git log --pretty=format:"%h %cd %s" -1
echo
echo '-- gjs build --'
echo
do_Print_Labels 'Do the GJS build'
if [[ "$DEV" != "devel" ]]; then
cp -r ./ ~/jhbuild/checkout/gjs
......@@ -164,7 +195,7 @@ if [[ $1 == "GJS" ]]; then
echo "Autogen options: $ci_autogenargs"
eval ./autogen.sh "$ci_autogenargs"
make -sj
make -sj 2>&1 | tee compilation.log
if [[ $TEST == "distcheck" ]]; then
make -s distcheck
......@@ -174,12 +205,16 @@ if [[ $1 == "GJS" ]]; then
make -sj install
fi
if [[ $WARNINGS == "count" ]]; then
do_Print_Labels 'Warnings Report '
do_Check_Warnings
do_Print_Labels
fi
elif [[ $1 == "GJS_EXTRA" ]]; then
# Extra testing. It doesn't (re)build, just run the 'Installed Tests'
echo
echo '-- Installed GJS tests --'
# It doesn't (re)build, just run the 'Installed Tests'
do_Print_Labels 'Run GJS installed tests'
do_Set_Env
PATH=$PATH:~/.local/bin
if [[ "$DEV" != "devel" ]]; then
xvfb-run -a --server-args="-screen 0 1024x768x24" jhbuild run dbus-run-session -- gnome-desktop-testing-runner gjs
......@@ -188,80 +223,76 @@ elif [[ $1 == "GJS_EXTRA" ]]; then
fi
elif [[ $1 == "VALGRIND" ]]; then
# Run Valgrind. It doesn't (re)build, just run the 'Valgrind Tests'
echo
echo '-- Valgrind Report --'
# It doesn't (re)build, just run the 'Valgrind Tests'
do_Print_Labels 'Valgrind Report'
do_Set_Env
PATH=$PATH:~/.local/bin
make check-valgrind
elif [[ $1 == "GJS_COVERAGE" ]]; then
# Code coverage test. It doesn't (re)build, just run the 'Coverage Tests'
echo
echo '-- Code Coverage Report --'
# It doesn't (re)build, just run the 'Coverage Tests'
do_Print_Labels 'Code Coverage Report'
do_Set_Env
PATH=$PATH:~/.local/bin
jhbuild run --in-builddir=gjs make check-code-coverage
cp "$(pwd)"/.cache/jhbuild/build/gjs/gjs-?.*.*-coverage.info "$save_dir"/coverage/
cp -r "$(pwd)"/.cache/jhbuild/build/gjs/gjs-?.*.*-coverage/* "$save_dir"/coverage/
echo '-----------------------------------------------------------------'
echo '-----------------------------------------'
sed -e 's/<[^>]*>//g' "$(pwd)"/coverage/index.html | tr -d ' \t' | grep -A3 -P '^Lines:$' | tr '\n' ' '; echo
echo '-----------------------------------------------------------------'
echo '-----------------------------------------'
elif [[ $1 == "CPPCHECK" && "$log_message" != *'[skip cppcheck]'* ]]; then
echo
echo '-- Static code analyzer report --'
do_Print_Labels 'Static code analyzer report '
cppcheck --inline-suppr --enable=warning,performance,portability,information,missingInclude --force -q . 2>&1 | \
tee "$save_dir"/cppcheck/current-report.txt | sed -E 's/:[0-9]+]/:LINE]/' > /cwd/current-report.txt
cat "$save_dir"/cppcheck/current-report.txt
tee "$save_dir"/analysis/current-report.txt | sed -E 's/:[0-9]+]/:LINE]/' > /cwd/current-report.txt
cat "$save_dir"/analysis/current-report.txt
echo
# Get the code committed at upstream master
do_Get_Upstream_Master "cppCheck"
cppcheck --inline-suppr --enable=warning,performance,portability,information,missingInclude --force -q . 2>&1 | \
tee "$save_dir"/cppcheck/master-report.txt | sed -E 's/:[0-9]+]/:LINE]/' > /cwd/master-report.txt
tee "$save_dir"/analysis/master-report.txt | sed -E 's/:[0-9]+]/:LINE]/' > /cwd/master-report.txt
echo
# Compare the report with master and fail if new warnings are found
do_Compare_With_Upstream_Master "cppCheck"
elif [[ $1 == "CPPLINT" && "$log_message" != *'[skip cpplint]'* ]]; then
echo
echo '-- Lint report --'
do_Print_Labels 'C/C++ Linter report '
cpplint --quiet $(find . -name \*.cpp -or -name \*.c -or -name \*.h | sort) 2>&1 | \
tee "$save_dir"/cpplint/current-report.txt | sed -E 's/:[0-9]+:/:LINE:/' > /cwd/current-report.txt
cat "$save_dir"/cpplint/current-report.txt
tee "$save_dir"/analysis/current-report.txt | sed -E 's/:[0-9]+:/:LINE:/' > /cwd/current-report.txt
cat "$save_dir"/analysis/current-report.txt
echo
# Get the code committed at upstream master
do_Get_Upstream_Master "cppLint"
cpplint --quiet $(find . -name \*.cpp -or -name \*.c -or -name \*.h | sort) 2>&1 | \
tee "$save_dir"/cpplint/master-report.txt | sed -E 's/:[0-9]+:/:LINE:/' > /cwd/master-report.txt
tee "$save_dir"/analysis/master-report.txt | sed -E 's/:[0-9]+:/:LINE:/' > /cwd/master-report.txt
echo
# Compare the report with master and fail if new warnings are found
do_Compare_With_Upstream_Master "cppLint"
elif [[ $1 == "ESLINT" && "$log_message" != *'[skip eslint]'* ]]; then
do_Print_Labels 'Javascript Linter report'
tmp_path=$(dirname "$CI_PROJECT_DIR")
echo
echo '-- Javascript linter report --'
eslint examples installed-tests modules --format unix 2>&1 | \
tee "$save_dir"/eslint/current-report.txt | \
tee "$save_dir"/analysis/current-report.txt | \
sed -E -e 's/:[0-9]+:[0-9]+:/:LINE:COL:/' -e 's/[0-9]+ problems//' -e 's/\/root\/tmp-upstream//' -e "s,$tmp_path,," \
> /cwd/current-report.txt
cat "$save_dir"/eslint/current-report.txt
cat "$save_dir"/analysis/current-report.txt
echo
# Get the code committed at upstream master
do_Get_Upstream_Master "esLint"
cp "$save_dir"/.eslint* .
eslint examples installed-tests modules --format unix 2>&1 | \
tee "$save_dir"/eslint/master-report.txt | \
tee "$save_dir"/analysis/master-report.txt | \
sed -E -e 's/:[0-9]+:[0-9]+:/:LINE:COL:/' -e 's/[0-9]+ problems//' -e 's/\/root\/tmp-upstream//' -e "s,$tmp_path,," \
> /cwd/master-report.txt
echo
......@@ -270,11 +301,9 @@ elif [[ $1 == "ESLINT" && "$log_message" != *'[skip eslint]'* ]]; then
do_Compare_With_Upstream_Master "esLint"
elif [[ $1 == "TOKEI" ]]; then
echo
echo '-- Project statistics --'
echo
do_Print_Labels 'Project statistics'
tokei . | tee "$save_dir"/tokei/report.txt
tokei . | tee "$save_dir"/analysis/report.txt
fi
# Releases stuff and finishes
......
......@@ -301,7 +301,6 @@ tree_graph_paths = {}
class style:
DIM = '\033[30m'
BOLD = '\033[1m'
ITALIC = '\033[3m'
UNDERLINE = '\033[4m'
......@@ -352,13 +351,6 @@ def get_node_label(graph, addr):
return label[:50]
def get_root_label(graph, root):
# This won't work on Windows.
#label = re.sub(r'0x[0-9a-f]{8}', '*', graph.root_labels[root])
label = graph.root_labels[root]
return '(ROOT) {}'.format(label)