File: mtest.cpp

package info (click to toggle)
musescore-snapshot 3.2.s20190704%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 218,116 kB
  • sloc: cpp: 290,563; xml: 200,238; sh: 3,706; ansic: 1,447; python: 393; makefile: 222; perl: 82; pascal: 79
file content (153 lines) | stat: -rw-r--r-- 4,966 bytes parent folder | download | duplicates (5)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//=============================================================================
//  MuseScore
//  Music Composition & Notation
//
//  Copyright (C) 2012 Werner Schweer
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License version 2
//  as published by the Free Software Foundation and appearing in
//  the file LICENCE.GPL
//=============================================================================

#include <stdio.h>
#include "all.h"

static QFile logFile;
static int processed = 0;
static int failed = 0;

const char* tests[] = {
//      "libmscore/compat/tst_compat",          // expected to not work
#if 1
      "libmscore/element/tst_element",
      "libmscore/note/tst_note",
      "libmscore/readwriteundoreset/tst_readwriteundoreset",
      "libmscore/keysig/tst_keysig",
      "libmscore/barline/tst_barline",
      "libmscore/clef/tst_clef",
      "libmscore/timesig/tst_timesig",
      "libmscore/repeat/tst_repeat",
      "libmscore/rhythmicGrouping/tst_rhythmicGrouping",
      "libmscore/dynamic/tst_dynamic",
      "libmscore/durationtype/tst_durationtype",
      "libmscore/breath/tst_breath",
      "libmscore/tuplet/tst_tuplet",
      "libmscore/hairpin/tst_hairpin",
      "libmscore/chordsymbol/tst_chordsymbol",
      "libmscore/text/tst_text",
      "libmscore/measure/tst_measure",
      "libmscore/beam/tst_beam",
      "libmscore/layout/tst_benchmark",
      "libmscore/layout_elements/tst_layout_elements",
      "libmscore/instrumentchange/tst_instrumentchange",
      "libmscore/join/tst_join",
      "libmscore/transpose/tst_transpose",
      "libmscore/copypaste/tst_copypaste",
      "libmscore/concertpitch/tst_concertpitchbenchmark",
      "libmscore/selectionfilter/tst_selectionfilter",
      "libmscore/tools/tst_tools",                    // some tests disabled
      "libmscore/plugins/tst_plugins",
      "libmscore/album/tst_album",
      "scripting/tst_scripting"
      "guitarpro/tst_guitarpro",
      "biab/tst_biab",
      "capella/io/tst_capella_io",
      "importmidi/tst_importmidi",
      "libmscore/selectionrangedelete/tst_selectionrangedelete",
      "libmscore/parts/tst_parts",
      "testscript/tst_runscripts",
#endif
#if 0
      "libmscore/spanners/tst_spanners",              // FAIL

      "libmscore/clef_courtesy/tst_clef_courtesy",    // FAIL
      "libmscore/midimapping/tst_midimapping",        // FAIL
      "libmscore/earlymusic/tst_earlymusic",          // FAIL

      "libmscore/midi/tst_midi",                      // FAIL
      "libmscore/splitstaff/tst_splitstaff",          // FAIL
      "libmscore/split/tst_split",                    // FAIL
      "libmscore/copypastesymbollist/tst_copypastesymbollist",    // FAIL

        // import/export
      "testoves/structure/tst_ove_structure",         // FAIL
      "testoves/ove3/tst_ove_ove3",                   // FAIL
      "testoves/bdat/tst_ove_bdat",
      "musicxml/io/tst_mxml_io",                      // FAIL
#endif
#ifdef OMR
      "omr/notes/tst_notes",
#endif
      };

//---------------------------------------------------------
//   process
//---------------------------------------------------------

static void process(const QString& cmd)
      {
      QStringList args;
      int rv = QProcess::execute(cmd, args);
      if (rv != 0) {
            // seems not to be reliable
            printf("========mtest process <%s> returns %d\n", qPrintable(cmd), rv);
            failed++;
            }
      processed++;
      }

//---------------------------------------------------------
//   scanDir
//---------------------------------------------------------
#if 0
static void scanDir(QDir d)
      {
      QFileInfoList l = d.entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs);
      foreach(const QFileInfo& fi, l) {
            if (fi.isDir()) {
                  scanDir(QDir(fi.filePath()));
                  }
            else if (fi.isExecutable()) {
                  QString s(fi.filePath());
                  if (fi.completeBaseName().startsWith("tst_"))
                        process(s);
                  }
            }
      }
#endif

//---------------------------------------------------------
//   main
//---------------------------------------------------------

int main(int argc, char* argv[])
      {
      Q_UNUSED(argc);
      Q_UNUSED(argv);
#if 0
      logFile.setFileName("mtest.log");
      if (!logFile.open(QIODevice::WriteOnly)) {
            fprintf(stderr, "mtest: cannot open log file <mtest.log>\n");
            exit(-1);
            }
#endif
      QDir wd(QDir::current());
#ifdef Q_OS_MAC
      wd.cdUp();
#endif

#if 0
      scanDir(wd);
#else
      for (const char* s : tests)
            process(s);
#endif

      printf("\n");
      printf("================\n");
      printf("  processed %d  -- failed %d\n", processed, failed);
      printf("================\n");
      return 0;
      }