Running ‘testthat.R’ [32s/35s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > 
  > # the unit tests take pretty long, that can be a problem on WB and cran (and maybe annoying locally)
  > # so we run all tests only on travis and if a certain user env var is set
  > if (identical(Sys.getenv("TRAVIS"), "true") || identical(Sys.getenv("R_EXPENSIVE_TEST_OK"), "true")) {
  +   test_check("mlrMBO")
  + } else {
  +   test_check("mlrMBO", filter = "((mbo_rf)|(mbo_km))")
  + }
  Loading required package: mlrMBO
  Loading required package: mlr
  Loading required package: ParamHelpers
  Loading required package: smoof
  Loading required package: BBmisc
  
  Attaching package: 'BBmisc'
  
  The following object is masked from 'package:base':
  
      isFALSE
  
  Loading required package: checkmate
  
  Attaching package: 'checkmate'
  
  The following object is masked from 'package:testthat':
  
      expect_vector
  
  
   *** caught segfault ***
  address 0x55a3b40ff870, cause 'memory not mapped'
  
  Traceback:
   1: cli::rule(header, col = testthat_style("error"))
   2: paste0(cli::rule(header, col = testthat_style("error")), "\n",     format(x))
   3: failure_summary(result, self$n_fail)
   4: paste0(..., collapse = "\n")
   5: cli::cat_line(..., file = self$out)
   6: self$cat_line(failure_summary(result, self$n_fail))
   7: x[[method]](...)
   8: FUN(X[[i]], ...)
   9: lapply(objects, function(x) x[[method]](...))
  10: o_apply(self$reporters, "add_result", context = context, test = test,     result = result)
  11: get_reporter()$add_result(context = get_reporter()$.context,     test = test, result = e)
  12: register_expectation(e)
  13: h(simpleError(msg, call))
  14: .handleSimpleError(function (e) {    handled <<- TRUE    test_error <<- e    options(expressions = expressions_opt_new)    on.exit(options(expressions = expressions_opt), add = TRUE)    e$expectation_calls <- frame_calls(11, 2)    test_error <<- e    register_expectation(e)    e$handled <- TRUE    test_error <<- e}, "REAL() can only be applied to a 'numeric', not a 'character'",     base::quote(generateDesign(n = n, par.set = par.set, ...)))
  15: generateDesign(n = n, par.set = par.set, ...)
  16: generateTestDesign(10L, getParamSet(f))
  17: eval(code, test_env)
  18: eval(code, test_env)
  19: withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error)
  20: doTryCatch(return(expr), name, parentenv, handler)
  21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  23: doTryCatch(return(expr), name, parentenv, handler)
  24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
  25: tryCatchList(expr, classes, parentenv, handlers)
  26: tryCatch(withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error), error = handle_fatal,     skip = function(e) {    })
  27: test_code(desc, code, env = parent.frame())
  28: test_that("mbo works with rf", {    learner = makeLearner("regr.randomForest")    ctrl = makeMBOControl(store.model.at = c(1, 5))    ctrl = setMBOControlTermination(ctrl, iters = 5L)    ctrl = setMBOControlInfill(ctrl, crit = crit.mr, opt.focussearch.points = 100L)    or = mbo(testf.fsphere.2d, testd.fsphere.2d, learner, ctrl,         show.info = TRUE)    expect_number(or$y)    expect_equal(or$y, testf.fsphere.2d(or$x))    expect_equal(getOptPathLength(or$opt.path), 15)    expect_list(or$x)    expect_set_equal(names(or$x), names(testp.fsphere.2d$pars))    expect_length(or$models[[1]]$subset, 10)    expect_length(or$models[[2]]$subset, 14)    ctrl = makeMBOControl()    ctrl = setMBOControlTermination(ctrl, iters = 5L)    ctrl = setMBOControlInfill(ctrl, crit = crit.ei, opt.focussearch.points = 100L)    expect_error(mbo(testf.fsphere.2d, testd.fsphere.2d, learner,         ctrl), "must be set to 'se'")    ctrl = makeMBOControl()    ctrl = setMBOControlTermination(ctrl, iters = 5L)    ctrl = setMBOControlInfill(ctrl, opt.focussearch.points = 100L)    ctrl = makeMBOControl()    ctrl = setMBOControlTermination(ctrl, iters = 5L)    ctrl = setMBOControlInfill(ctrl, opt.focussearch.points = 100L)    learner = makeLearner("classif.randomForest")    expect_error(mbo(testf.fsphere.2d, testd.fsphere.2d, learner,         ctrl), "mbo requires regression learner")    learner = makeLearner("regr.randomForest", predict.type = "se",         se.method = "sd")    par.set = makeParamSet(makeNumericParam("x1", lower = -10,         upper = 10, trafo = function(x) abs(x)))    f = makeSingleObjectiveFunction(fn = function(x) sum(x^2),         par.set = par.set)    des = generateTestDesign(10L, par.set = par.set)    des$y = vnapply(seq_row(des), function(i) f(as.list(des[i,         ])))    or = mbo(f, des, learner, ctrl)    expect_number(or$y)    expect_equal(getOptPathLength(or$opt.path), 15)    df = as.data.frame(or$opt.path)    expect_numeric(df$x1)    par.set = makeParamSet(makeNumericParam("x1", lower = -2,         upper = 1), makeIntegerParam("x2", lower = -1, upper = 2),         makeDiscreteParam("x3", values = c("a", "b")))    f = makeSingleObjectiveFunction(fn = function(x) {        if (x[[3]] == "a")             x[[1]]^2 + x[[2]]^2        else x[[1]]^2 + x[[2]]^2 + 20    }, par.set = par.set, has.simple.signature = FALSE)    des = generateTestDesign(10, par.set = par.set)    des$y = vnapply(seq_row(des), function(i) f(as.list(des[i,         ])))    ctrl = makeMBOControl()    ctrl = setMBOControlTermination(ctrl, iters = 5L)    ctrl = setMBOControlInfill(ctrl, opt.focussearch.points = 100)    or = mbo(f, des, learner, ctrl)    expect_number(or$y)    expect_equal(getOptPathLength(or$opt.path), 15)    df = as.data.frame(or$opt.path)    expect_numeric(df$x1, any.missing = FALSE)    expect_integer(df$x2, any.missing = FALSE)    expect_factor(df$x3, any.missing = FALSE)    expect_numeric(df$y, any.missing = FALSE)    expect_list(or$x)    expect_set_equal(names(or$x), names(par.set$pars))    ctrl = makeMBOControl(final.method = "best.predicted")    ctrl = setMBOControlTermination(ctrl, iters = 5L)    ctrl = setMBOControlInfill(ctrl, opt.focussearch.points = 100)    or = mbo(f, des, learner, ctrl)    expect_number(or$y)    expect_equal(getOptPathLength(or$opt.path), 15)    des = generateTestDesign(10L, getParamSet(f))    ctrl = makeMBOControl()    ctrl = setMBOControlTermination(ctrl, iters = 5L)    ctrl = setMBOControlInfill(ctrl, opt.focussearch.points = 100)    or = mbo(f, des, learner, ctrl)    expect_number(or$y)    expect_equal(getOptPathLength(or$opt.path), 15)    expect_set_equal(names(or$x), names(par.set$pars))    par.set = makeParamSet(makeNumericVectorParam("v", lower = -5,         upper = 5, len = 2), makeNumericParam("w", lower = -5,         upper = 5))    f = makeSingleObjectiveFunction(fn = function(x) sum(x[[1]]^2) +         (2 - x[[2]])^2, par.set = par.set)    des = generateTestDesign(10L, getParamSet(f))    ctrl = makeMBOControl()    ctrl = setMBOControlTermination(ctrl, iters = 3L)    ctrl = setMBOControlInfill(ctrl, opt = "cmaes", opt.cmaes.control = list(maxit = 2L))    or = mbo(f, des, learner, ctrl)    expect_number(or$y)    expect_equal(getOptPathLength(or$opt.path), 10 + 3)    des = generateTestDesign(10L, getParamSet(f))    ctrl = makeMBOControl(final.method = "best.predicted")    ctrl = setMBOControlTermination(ctrl, iters = 3L)    ctrl = setMBOControlInfill(ctrl, opt = "cmaes", opt.cmaes.control = list(maxit = 2L))    or = mbo(f, des, learner, ctrl)    expect_number(or$y)    expect_equal(getOptPathLength(or$opt.path), 10 + 3)    par.set = makeParamSet(makeNumericParam("x1", lower = -2,         upper = 1), makeNumericParam("x2", lower = -1, upper = 2))    f = makeSingleObjectiveFunction(fn = function(x, shift = 0) {        sum(x^2) + shift    }, par.set = par.set)    des = generateTestDesign(10L, getParamSet(f))    ctrl = makeMBOControl()    ctrl = setMBOControlTermination(ctrl, iters = 5L)    ctrl = setMBOControlInfill(ctrl, opt.focussearch.points = 100L)    or = mbo(f, des, learner, ctrl, more.args = list(shift = 0))    expect_number(or$y)    par.set = makeParamSet(makeNumericParam("x1", lower = -1,         upper = 1))    f = makeSingleObjectiveFunction(fn = function(x, shift = 0) {        sum(x^2) + shift    }, par.set = par.set)    des = generateTestDesign(10L, getParamSet(f))    ctrl = makeMBOControl(trafo.y.fun = trafoSqrt(handle.violations = "error"))    ctrl = setMBOControlTermination(ctrl, iters = 2L)    ctrl = setMBOControlInfill(ctrl, filter.proposed.points = TRUE)    expect_error(mbo(f, control = ctrl, more.args = list(shift = -1)),         "Negative function values occurred during transformation.")    or = mbo(f, des, control = ctrl, more.args = list(shift = 0))    expect_number(or$y)})
  29: eval(code, test_env)
  30: eval(code, test_env)
  31: withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error)
  32: doTryCatch(return(expr), name, parentenv, handler)
  33: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  34: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  35: doTryCatch(return(expr), name, parentenv, handler)
  36: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
  37: tryCatchList(expr, classes, parentenv, handlers)
  38: tryCatch(withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error), error = handle_fatal,     skip = function(e) {    })
  39: test_code(NULL, exprs, env)
  40: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  41: force(code)
  42: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,     {        reporter$start_file(basename(path))        lister$start_file(basename(path))        source_file(path, new.env(parent = env), chdir = TRUE,             wrap = wrap)        reporter$end_context()        reporter$end_file()    })
  43: FUN(X[[i]], ...)
  44: lapply(paths, test_file, env = env, reporter = current_reporter,     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  45: force(code)
  46: with_reporter(reporter = current_reporter, results <- lapply(paths,     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,     load_helpers = FALSE, wrap = wrap))
  47: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,     stop_on_warning = stop_on_warning, wrap = wrap)
  48: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     wrap = wrap)
  49: test_package_dir(package = package, test_path = test_path, filter = filter,     reporter = reporter, ..., stop_on_failure = stop_on_failure,     stop_on_warning = stop_on_warning, wrap = wrap)
  50: test_check("mlrMBO", filter = "((mbo_rf)|(mbo_km))")
  An irrecoverable exception occurred. R is aborting now ...
  Segmentation fault