summaryrefslogtreecommitdiff
path: root/lib/catch2/catch_runner.cpp
blob: 2b8f9678094c314b2d6612959e3a3e66b07d14d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "catch_runner.hpp"

#define CATCH_CONFIG_RUNNER
#include "catch2/catch.hpp"

#include <stdio.h>
#include <string.h>
#include "esp_console.h"
#include "esp_log.h"
#include "esp_system.h"

// There must be exactly on Session instance at all times; attempting to destroy
// this will result in memory corruption.
static Catch::Session sCatchSession;

int exec_catch2(int argc, char** argv) {
  // Reset the existing configuration before applying a new one. Otherwise we
  // will get the combination of all configs.
  sCatchSession.configData() = Catch::ConfigData();

  int result = sCatchSession.applyCommandLine(argc, argv);
  if (result != 0) {
    return result;
  }

  // Returns number of failures.
  int failures = sCatchSession.run();

  return failures > 0;
}