diff options
author | Max Kellermann <max@musicpd.org> | 2017-12-29 17:12:55 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-10-14 23:41:38 +0200 |
commit | 94592c14062d5afc9482d11baa401648082022c0 (patch) | |
tree | 8723d462737f883181fb1aaa3f91ee3d0add9721 /test | |
parent | 13ce142df137f346526de2a31a7ccbd59a903cdd (diff) |
build with Meson instead of autotools
So long, autotools! This is my last MPD related project to migrate
away from it. It has its strengths, but also very obvious weaknesses
and weirdnesses. Today, many of its quirks are not needed anymore,
and are cumbersome and slow. Now welcome our new Meson overlords!
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 572 | ||||
-rw-r--r-- | test/run_resolver.cxx | 4 | ||||
-rw-r--r-- | test/test_archive.cxx | 6 | ||||
-rwxr-xr-x | test/test_archive_bzip2.sh | 2 | ||||
-rwxr-xr-x | test/test_archive_iso9660.sh | 2 | ||||
-rwxr-xr-x | test/test_archive_zzip.sh | 2 |
6 files changed, 581 insertions, 7 deletions
diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 000000000..2cc30b5d1 --- /dev/null +++ b/test/meson.build @@ -0,0 +1,572 @@ +cppunit_dep = dependency('cppunit', required: true) + +executable( + 'ParseSongFilter', + 'ParseSongFilter.cxx', + include_directories: inc, + dependencies: [ + song_dep, + pcm_dep, + ], +) + +executable( + 'read_conf', + 'read_conf.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + config_dep, + ], +) + +test('test_util', executable( + 'test_util', + 'test_util.cxx', + include_directories: inc, + dependencies: [ + util_dep, + cppunit_dep, + ], +)) + +test('test_byte_reverse', executable( + 'test_byte_reverse', + 'test_byte_reverse.cxx', + include_directories: inc, + dependencies: [ + util_dep, + cppunit_dep, + ], +)) + +test('test_rewind', executable( + 'test_rewind', + 'test_rewind.cxx', + include_directories: inc, + dependencies: [ + input_glue_dep, + cppunit_dep, + ], +)) + +test('test_mixramp', executable( + 'test_mixramp', + 'test_mixramp.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + util_dep, + cppunit_dep, + ], +)) + +test('test_protocol', executable( + 'test_protocol', + 'test_protocol.cxx', + '../src/protocol/ArgParser.cxx', + include_directories: inc, + dependencies: [ + cppunit_dep, + ], +)) + +test('test_queue_priority', executable( + 'test_queue_priority', + 'test_queue_priority.cxx', + '../src/queue/Queue.cxx', + include_directories: inc, + dependencies: [ + util_dep, + cppunit_dep, + ], +)) + +test('TestFs', executable( + 'TestFs', + 'TestFs.cxx', + include_directories: inc, + dependencies: [ + fs_dep, + cppunit_dep, + ], +)) + +test('TestIcu', executable( + 'TestIcu', + 'TestIcu.cxx', + include_directories: inc, + dependencies: [ + util_dep, + icu_dep, + cppunit_dep, + ], +)) + +if libavahi_client_dep.found() + executable( + 'run_avahi', + 'run_avahi.cxx', + 'ShutdownHandler.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + zeroconf_dep, + util_dep, + ], + ) +endif + +if enable_inotify + executable( + 'run_inotify', + 'run_inotify.cxx', + 'ShutdownHandler.cxx', + '../src/db/update/InotifyDomain.cxx', + '../src/db/update/InotifySource.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + event_dep, + util_dep, + ], + ) +endif + +executable( + 'run_resolver', + 'run_resolver.cxx', + include_directories: inc, + dependencies: [ + net_dep, + util_dep, + ], +) + +# +# I/O +# + +executable( + 'WriteFile', + 'WriteFile.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + fs_dep, + ], +) + +executable( + 'dump_text_file', + 'dump_text_file.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + input_glue_dep, + archive_glue_dep, + ], +) + +if zlib_dep.found() + executable( + 'run_gzip', + 'run_gzip.cxx', + include_directories: inc, + dependencies: [ + fs_dep, + ], + ) + + executable( + 'run_gunzip', + 'run_gunzip.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + fs_dep, + ], + ) +endif + +# +# Neighbor +# + +if neighbor_glue_dep.found() + executable( + 'run_neighbor_explorer', + 'run_neighbor_explorer.cxx', + 'ShutdownHandler.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + neighbor_glue_dep, + ], + ) +endif + +# +# Database +# + +if enable_database + executable( + 'run_storage', + 'run_storage.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + storage_glue_dep, + ], + ) + + executable( + 'DumpDatabase', + 'DumpDatabase.cxx', + '../src/protocol/Ack.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + '../src/db/Registry.cxx', + '../src/db/Selection.cxx', + '../src/db/PlaylistVector.cxx', + '../src/db/DatabaseLock.cxx', + '../src/AudioFormat.cxx', + '../src/AudioParser.cxx', + '../src/pcm/SampleFormat.cxx', + '../src/SongSave.cxx', + '../src/TagSave.cxx', + include_directories: inc, + dependencies: [ + song_dep, + fs_dep, + event_dep, + db_plugins_dep, + ], + ) + + test('test_translate_song', executable( + 'test_translate_song', + 'test_translate_song.cxx', + '../src/playlist/PlaylistSong.cxx', + '../src/SongLoader.cxx', + '../src/LocateUri.cxx', + '../src/Log.cxx', + include_directories: inc, + dependencies: [ + tag_dep, + storage_glue_dep, + cppunit_dep, + ], + )) +endif + +# +# Input +# + +executable( + 'run_input', + 'run_input.cxx', + '../src/TagSave.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + input_glue_dep, + archive_glue_dep, + ], +) + +if curl_dep.found() + test('test_icy_parser', executable( + 'test_icy_parser', + 'test_icy_parser.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + tag_dep, + cppunit_dep, + ], + )) +endif + +# +# Archive +# + +if archive_glue_dep.found() + test('test_archive', executable( + 'test_archive', + 'test_archive.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + archive_glue_dep, + cppunit_dep, + ], + )) + + executable( + 'visit_archive', + 'visit_archive.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + archive_glue_dep, + ], + ) + + if libiso9660_dep.found() + if find_program('mkisofs', required: false).found() + test('test_archive_iso9660', find_program('test_archive_iso9660.sh')) + endif + endif + + if libbz2_dep.found() + if find_program('bzip2', required: false).found() + test('test_archive_bzip2', find_program('test_archive_bzip2.sh')) + endif + endif + + if libzzip_dep.found() + if find_program('zip', required: false).found() + test('test_archive_zzip', find_program('test_archive_zzip.sh')) + endif + endif +endif + +# +# Playlist +# + +executable( + 'dump_playlist', + 'dump_playlist.cxx', + '../src/TagSave.cxx', + '../src/TagFile.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + playlist_glue_dep, + input_glue_dep, + archive_glue_dep, + decoder_glue_dep, + ], +) + +# +# Decoder +# + +executable( + 'run_decoder', + 'run_decoder.cxx', + 'DumpDecoderClient.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + decoder_glue_dep, + input_glue_dep, + archive_glue_dep, + ], +) + +executable( + 'read_tags', + 'read_tags.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + decoder_glue_dep, + input_glue_dep, + archive_glue_dep, + ], +) + +executable( + 'ContainerScan', + 'ContainerScan.cxx', + '../src/SongSave.cxx', + '../src/TagSave.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + decoder_glue_dep, + input_glue_dep, + archive_glue_dep, + ], +) + +executable( + 'ReadApeTags', + 'ReadApeTags.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + tag_dep, + input_glue_dep, + archive_glue_dep, + ], +) + +if libid3tag_dep.found() + executable( + 'dump_rva2', + 'dump_rva2.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + tag_dep, + input_glue_dep, + archive_glue_dep, + ], + ) +endif + +# +# Filter +# + +test('test_pcm', executable( + 'test_pcm', + 'TestAudioFormat.cxx', + 'test_pcm_dither.cxx', + 'test_pcm_pack.cxx', + 'test_pcm_channels.cxx', + 'test_pcm_format.cxx', + 'test_pcm_volume.cxx', + 'test_pcm_mix.cxx', + 'test_pcm_interleave.cxx', + 'test_pcm_export.cxx', + 'test_pcm_main.cxx', + include_directories: inc, + dependencies: [ + pcm_dep, + cppunit_dep, + ], +)) + +executable( + 'run_filter', + 'run_filter.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + filter_glue_dep, + ], +) + +executable( + 'software_volume', + 'software_volume.cxx', + include_directories: inc, + dependencies: [ + pcm_dep, + ], +) + +executable( + 'run_normalize', + 'run_normalize.cxx', + '../src/AudioCompress/compress.c', + include_directories: inc, + dependencies: [ + pcm_dep, + ], +) + +executable( + 'run_convert', + 'run_convert.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + pcm_dep, + config_dep, + ], +) + +# +# Encoder +# + +if encoder_glue_dep.found() + executable( + 'run_encoder', + 'run_encoder.cxx', + '../src/AudioParser.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + encoder_glue_dep, + ], + ) + + executable( + 'test_vorbis_encoder', + 'test_vorbis_encoder.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + encoder_glue_dep, + ], + ) +endif + +# +# Output +# + +executable( + 'run_output', + 'run_output.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + output_glue_dep, + encoder_glue_dep, + ], +) + +# +# Mixer +# + +if alsa_dep.found() + # this debug program is still ALSA specific + + executable( + 'read_mixer', + 'read_mixer.cxx', + '../src/Log.cxx', + '../src/LogBackend.cxx', + include_directories: inc, + dependencies: [ + mixer_glue_dep, + ], + ) +endif diff --git a/test/run_resolver.cxx b/test/run_resolver.cxx index 8e712301a..4a1a110cd 100644 --- a/test/run_resolver.cxx +++ b/test/run_resolver.cxx @@ -22,7 +22,7 @@ #include "net/AddressInfo.hxx" #include "net/ToString.hxx" #include "net/SocketAddress.hxx" -#include "Log.hxx" +#include "util/PrintException.hxx" #include <exception> @@ -42,6 +42,6 @@ try { return EXIT_SUCCESS; } catch (...) { - LogError(std::current_exception()); + PrintException(std::current_exception()); return EXIT_FAILURE; } diff --git a/test/test_archive.cxx b/test/test_archive.cxx index 655e65f6d..f023da886 100644 --- a/test/test_archive.cxx +++ b/test/test_archive.cxx @@ -44,11 +44,13 @@ ArchiveLookupTest::TestArchiveLookup() archive_lookup(path, &archive, &inpath, &suffix)); free(path); - path = strdup("Makefile/foo/bar"); + fclose(fopen("dummy", "w")); + + path = strdup("dummy/foo/bar"); CPPUNIT_ASSERT_EQUAL(true, archive_lookup(path, &archive, &inpath, &suffix)); CPPUNIT_ASSERT_EQUAL((const char *)path, archive); - CPPUNIT_ASSERT_EQUAL(0, strcmp(archive, "Makefile")); + CPPUNIT_ASSERT_EQUAL(0, strcmp(archive, "dummy")); CPPUNIT_ASSERT_EQUAL(0, strcmp(inpath, "foo/bar")); CPPUNIT_ASSERT_EQUAL((const char *)nullptr, suffix); free(path); diff --git a/test/test_archive_bzip2.sh b/test/test_archive_bzip2.sh index 2c45076aa..cdc6b52f7 100755 --- a/test/test_archive_bzip2.sh +++ b/test/test_archive_bzip2.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -SRC_BASE=configure +SRC_BASE=meson.build SRC="$(dirname $0)/../${SRC_BASE}" DST="$(pwd)/test/tmp/${SRC_BASE}.bz2" diff --git a/test/test_archive_iso9660.sh b/test/test_archive_iso9660.sh index 070d2da0a..5658f7a98 100755 --- a/test/test_archive_iso9660.sh +++ b/test/test_archive_iso9660.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -SRC_BASE=configure +SRC_BASE=meson.build SRC="$(dirname $0)/../${SRC_BASE}" DST="$(pwd)/test/tmp/${SRC_BASE}.iso" diff --git a/test/test_archive_zzip.sh b/test/test_archive_zzip.sh index a8d23f6d7..de4a8ca91 100755 --- a/test/test_archive_zzip.sh +++ b/test/test_archive_zzip.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -SRC_BASE=configure +SRC_BASE=meson.build SRC="$(dirname $0)/../${SRC_BASE}" DST="$(pwd)/test/tmp/${SRC_BASE}.zip" |