summaryrefslogtreecommitdiffstats
path: root/src/test/main.cpp
blob: 03d79df00aac149c6cbe31d8273e3e342f86bede (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
31
32
33
34
35
#include <benchmark/benchmark.h>

#include "mixxxtest.h"
#include "util/console.h"
#include "errordialoghandler.h"

int main(int argc, char **argv) {
    Console console;
    // We never want to popup error dialogs when running tests.
    ErrorDialogHandler::setEnabled(false);

    bool run_benchmarks = false;
    for (int i = 0; i < argc; ++i) {
        if (strcmp(argv[i], "--benchmark") == 0) {
            run_benchmarks = true;
            break;
        }
    }

    if (run_benchmarks) {
        benchmark::Initialize(&argc, argv);
    } else {
        testing::InitGoogleTest(&argc, argv);
    }

    // Otherwise, run the test suite:
    MixxxTest::ApplicationScope applicationScope(argc, argv);

    if (run_benchmarks) {
        benchmark::RunSpecifiedBenchmarks();
        return 0;
    } else {
        return RUN_ALL_TESTS();
    }
}