Browse Source

Fix header include test; Add a "make test" target

tags/v2.3.0-RC1
falkTX 4 years ago
parent
commit
58854f37d5
4 changed files with 31 additions and 16 deletions
  1. +5
    -0
      Makefile
  2. +1
    -1
      source/backend/CarlaBackend.h
  3. +11
    -4
      source/tests/Makefile
  4. +14
    -11
      source/tests/ansi-pedantic-test.c

+ 5
- 0
Makefile View File

@@ -1038,6 +1038,11 @@ features: features_print_main features_print_external_plugins

# ---------------------------------------------------------------------------------------------------------------------

test:
$(MAKE) -C source/tests

# ---------------------------------------------------------------------------------------------------------------------

.FORCE:
.PHONY: .FORCE



+ 1
- 1
source/backend/CarlaBackend.h View File

@@ -1197,7 +1197,7 @@ typedef enum {
* @a value1 New width
* @a value2 New height
*/
ENGINE_CALLBACK_EMBED_UI_RESIZED = 48,
ENGINE_CALLBACK_EMBED_UI_RESIZED = 48

} EngineCallbackOpcode;



+ 11
- 4
source/tests/Makefile View File

@@ -35,12 +35,13 @@ PEDANTIC_FLAGS += -Wcast-align -Wcast-qual -Wclobbered -Wconversion -Wdisabled-o
PEDANTIC_FLAGS += -Wdouble-promotion -Wfloat-equal -Wlogical-op -Wpointer-arith -Wsign-conversion
PEDANTIC_FLAGS += -Wformat=2 -Woverlength-strings
PEDANTIC_FLAGS += -Wformat-truncation=2 -Wformat-overflow=2
PEDANTIC_FLAGS += -Wstringop-overflow=4 -Wstringop-truncation
PEDANTIC_FLAGS += -Wstringop-overflow=4
PEDANTIC_FLAGS += -Wmissing-declarations -Wredundant-decls
PEDANTIC_FLAGS += -Wshadow -Wundef -Wuninitialized -Wunused
PEDANTIC_FLAGS += -Wstrict-aliasing -fstrict-aliasing
PEDANTIC_FLAGS += -Wstrict-overflow -fstrict-overflow
PEDANTIC_FLAGS += -Wduplicated-branches -Wduplicated-cond -Wnull-dereference
# -Wstringop-truncation

PEDANTIC_CFLAGS = $(PEDANTIC_FLAGS)
PEDANTIC_CFLAGS += -Wc++-compat
@@ -54,6 +55,12 @@ PEDANTIC_CXXFLAGS += -Wold-style-cast -Wuseless-cast
PEDANTIC_CXXFLAGS += -Wzero-as-null-pointer-constant
PEDANTIC_CXXFLAGS += -Weffc++

PEDANTIC_CXX03_SKIPS = -Wno-pedantic
PEDANTIC_CXX03_SKIPS += -Wno-zero-as-null-pointer-constant

PEDANTIC_CXX98_SKIPS = $(PEDANTIC_CXX03_SKIPS)
PEDANTIC_CXX98_SKIPS += -Wno-variadic-macros

PEDANTIC_LDFLAGS = -Wl,-rpath,$(BINDIR) -L$(BINDIR)

# ---------------------------------------------------------------------------------------------------------------------
@@ -95,13 +102,13 @@ $(BINDIR)/ansi-pedantic-test_c11: ansi-pedantic-test.c ../backend/Carla*.h ../in
# ---------------------------------------------------------------------------------------------------------------------

$(BINDIR)/ansi-pedantic-test_cxx_ansi: ansi-pedantic-test.cpp ../backend/Carla*.h ../backend/Carla*.hpp ../includes/*.h
$(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -ansi -Wno-effc++ -o $@
$(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_CXX98_SKIPS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -ansi -Wno-effc++ -o $@

$(BINDIR)/ansi-pedantic-test_cxx98: ansi-pedantic-test.cpp ../backend/Carla*.h ../backend/Carla*.hpp ../includes/*.h
$(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c++98 -Wno-effc++ -o $@
$(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_CXX98_SKIPS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c++98 -Wno-effc++ -o $@

$(BINDIR)/ansi-pedantic-test_cxx03: ansi-pedantic-test.cpp ../backend/Carla*.h ../backend/Carla*.hpp ../includes/*.h
$(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c++03 -Wno-effc++ -o $@
$(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_CXX03_SKIPS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c++03 -Wno-effc++ -o $@

$(BINDIR)/ansi-pedantic-test_cxx11: ansi-pedantic-test.cpp ../backend/Carla*.h ../backend/Carla*.hpp ../includes/*.h
$(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c++11 -o $@


+ 14
- 11
source/tests/ansi-pedantic-test.c View File

@@ -28,7 +28,7 @@
# include "CarlaPlugin.hpp"
# include <cassert>
# include <cstdio>
# ifdef CARLA_PROPER_CPP11_SUPPORT
# ifndef nullptr
# undef NULL
# define NULL nullptr
# endif
@@ -57,6 +57,7 @@ int main(int argc, char* argv[])
CarlaParameterInfo i;
CarlaScalePointInfo j;
CarlaTransportInfo k;
CarlaHostHandle handle;

const char* licenseText;
const char* const* fileExtensions;
@@ -131,34 +132,36 @@ int main(int argc, char* argv[])
}
}

carla_set_engine_option(ENGINE_OPTION_PROCESS_MODE, ENGINE_PROCESS_MODE_PATCHBAY, NULL);
carla_set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, ENGINE_TRANSPORT_MODE_INTERNAL, NULL);
handle = carla_standalone_host_init();

if (carla_engine_init("Dummy", "ansi-test"))
carla_set_engine_option(handle, ENGINE_OPTION_PROCESS_MODE, ENGINE_PROCESS_MODE_PATCHBAY, NULL);
carla_set_engine_option(handle, ENGINE_OPTION_TRANSPORT_MODE, ENGINE_TRANSPORT_MODE_INTERNAL, NULL);

if (carla_engine_init(handle, "Dummy", "ansi-test"))
{
#ifdef __cplusplus
CarlaEngine* const engine(carla_get_engine());
CarlaEngine* const engine(carla_get_engine_from_handle(handle));
assert(engine != nullptr);
engine->getLastError();
#endif
if (carla_add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, NULL, NULL, "audiofile", 0, NULL, 0x0))
if (carla_add_plugin(handle, BINARY_NATIVE, PLUGIN_INTERNAL, NULL, NULL, "audiofile", 0, NULL, 0x0))
{
#ifdef __cplusplus
CarlaPlugin* const plugin(engine->getPlugin(0));
assert(plugin != nullptr);
const std::shared_ptr<CarlaPlugin> plugin(engine->getPlugin(0));
assert(plugin.get() != nullptr);
plugin->getId();
#endif
/* carla_set_custom_data(0, CUSTOM_DATA_TYPE_STRING, "file", "/home/falktx/Music/test.wav"); */
carla_transport_play();
carla_transport_play(handle);
}
else
{
printf("%s\n", carla_get_last_error());
printf("%s\n", carla_get_last_error(handle));
}
#ifdef __cplusplus
engine->setAboutToClose();
#endif
carla_engine_close();
carla_engine_close(handle);
}

#ifdef __cplusplus


Loading…
Cancel
Save