13
0
Commit Graph

83 Commits

Author SHA1 Message Date
295dbd8e1e
Make RCU reader return a const pointer (omnibus commit) 2023-04-08 00:15:37 +02:00
b35518e212 switch from boost::{shared,weak}_ptr to std::{shared,weak}_ptr
This is mostly a simple lexical search+replace but the absence of operator< for
std::weak_ptr<T> leads to some complications, particularly with Evoral::Sequence
and ExportPortChannel.
2023-03-24 14:19:15 -06:00
01f9332458
Fix RCU Unit-test on macOS/X
Apple's pthread does not implement barriers
2020-11-07 10:37:52 +01:00
88fc0ed392
Add RCU unit test 2020-11-05 02:24:54 +01:00
e4e94e77c9
Transmitter::Debug implementation 1/2
This also sorts switch() and listen_to() statements in order
of severity: debug, info, warning, error, fatal, throw.
2020-10-13 21:58:26 +02:00
60ccbcf9cc use a local version (copy) of the G_SOURCE_FUNC macro, since it is not available in the GTK+ version we use for the official build stack 2019-12-30 09:49:23 -07:00
0301c47f6b
Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
e4b1ece143 Use XMLNode::set_property API in xml tests 2017-04-19 09:36:57 +10:00
13bfd1527a Make boolean string values 0 and 1 to maintain backwards compatibility
I would prefer "yes" and "no" as it distinguishes boolean values from numeric
but using "yes and "no" results in PBD::Property<T>::from_string failing to
parse the correct values when opening in an older Ardour version as there is no
specialization for bool.

Using 0 and 1 also results in less change to the Session file.
2017-04-19 07:49:57 +10:00
272e02b6c8 Fix string-convert tests for Windows and hopefully macOS/OS X
Tests requires a locale installed on the host that uses a comma as the decimal
mark/point.
2017-04-17 13:21:02 +10:00
c634daef6a Add locale independent and thread safe string conversion API with tests
All conversions are performed as if in the "C" locale but without actually
changing locale.

This is a wrapper around printf/sscanf for int types which aren't affected by
locale and uses glib functions g_ascii_strtod and g_ascii_dtostr for
float/double types.

My first attempt at this used std::stringstream and
ios::imbue(std::locale::classic()) as it should be thread safe, but testing
shows it is not for gcc/mingw-w64 on Windows, and possibly also some versions
of macOS/OS X.

Use "yes" and "no" when converting a boolean in PBD::string_to<bool> as this
seems to be the convention used throughout libardour which will allow using
string_to<bool> in those cases.

Add accepted bool string values from PBD::string_is_affirmative to
PBD::string_to<bool>

Mark strings in pbd/string_convert.cc as not for translation

Add u/int16_t string conversions to pbd/string_convert.h and tests

Add DEBUG_TRACE output on conversion errors

Add int8_t/uint8_t conversions(using int16/uint16 types) to string_convert.h

Add support for converting an infinity expression to/from string

Follows the C99/C11 standard for strtof/strtod where subject sequence is an
optional plus or minus sign then INF or INFINITY, ignoring case.
2017-04-16 14:02:41 +10:00
a4b65212c9 Add test of pbd/xml++.h API performance with three file sizes
Generate, write and then read three Session like XML files to test the
performance of changes made to pbd/xml++.h API
2016-10-10 08:45:34 +10:00
02b7db03bd PBD::canonical_path will no longer throw so change test 2016-09-19 15:55:39 +10:00
9192a2e969 Add test for PBD::canonical_path on Windows using utf8 strings
This currently fails because the windows only realpath implementation in
pbd/pathexpand.cc, which is called from PBD::canonical_path to resolve the path
uses Glib::locale_from/to_utf8. As I demonstrated in the
testOpenFileUTF8Filename test case Glib::locale_from/to_utf8 are not the
correct functions to use for this use case as it converts to/from utf-8 to the
locale's current character encoding.  On Windows this is most often a single
byte encoding such as Windows-1252 and conversion will fail if the path
contains any characters that are not in system codepage.
2016-09-19 14:47:52 +10:00
aa77c2eb58 Give the Windows MMTimer test a better chance of passing
The default scheduling on windows seems fairly erratic or is at least in the
VM that I'm running these tests on, so increase the timing slack a bit so the
test has a better chance of passing. It is still quite easy for it to fail
though, especially if you for instance manipulate the terminal window somehow
while running the tests but it does not really matter in any case as this test
serves its purpose in testing the PBD::MMTimers API.
2016-09-19 14:47:52 +10:00
311a5f1462 add a natural sort algorithm 2016-07-14 16:52:43 +02:00
0e36f8e2d7 missing include for rand() in self-tests 2016-02-23 22:55:17 +01:00
3c87629c7e realloc-pool unit-test 2016-02-22 22:06:47 +01:00
2397429e99 use quotes for in-tree pbd/glib wrapper include 2015-10-05 22:15:18 +02:00
22b07e0233 NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
4dc63966f0 globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
e344d379d2 update semantics of PBD::remove_directory()
Remove the directory recursively including itself. The function
is used in two places only:

* LV2Plugin::add_state() -- no change, remove tmp. state
* Session::save_as()  -- on error, remove target

In both cases removing the folder itself is correct.
2015-09-27 12:44:54 +02:00
2e9e8d3b33 Fix windows test to also pass under wine
It looks as if the default timer resolution for applications running under wine
is different than Windows so just test that the minimum timer resolution is
below a certain amount rather than checking before and after calling
timeBeginPeriod
2015-09-19 10:59:39 +10:00
e44212321e Add test to libpbd to check PBD::touch_file and pbd/gstdio_compat.h
GStatBuf is not usable on 32 bit Windows without the redefinition in
pbd/gstdio_compat.h so add a test to check for the correct behavior of
g_stat and g_utime on all platforms now that the issue is fixed.
2015-09-17 23:26:38 +10:00
7ac691ec82 use pbd's gstdio compatibility wrapper 2015-09-17 14:37:57 +02:00
f4cb4e479d Rename PBD::QPC::get_timer_valid to check_timer_valid and perform timer test
I'm not sure if this test is going to be effective as I don't have hardware to
test on at the moment. As noted in the documentation, Windows XP should be the
only OS where QPC uses a timer source that is non-monotonic(multi-core with
non-syncronized TSC).
2015-09-16 11:22:16 +10:00
cd05d46c00 Add windows specific test for pbd/windows_timer_utils.h API 2015-09-16 11:22:16 +10:00
8e8f8d92c2 allow to run unit-test under wine from srcdir. 2015-09-13 15:30:00 +02:00
b2ff1e1734 Add unit test to check that libxml2 expects utf-8 encoded file paths on Windows 2015-07-25 23:14:50 +10:00
226087d06a Only create one test output directory in file copy test
Rather than one directory for each file
2015-07-25 23:14:50 +10:00
dfe2ac1d38 Add unit test to assert that using locale_from_utf8/::open will fail for some file paths on Windows 2015-07-25 23:14:45 +10:00
3b57d246d7 Reduce run time/output of PBD::Timer unit test 2015-03-08 22:46:38 +10:00
deb4687d5d fix testPathIsWithin unit-test:
* use absolute path
* fix copy/paste typo: bar->jim for symlink test
2015-02-14 05:50:40 +01:00
0550ec31bc Add local PwdReset class to reset pwd in event of test failure
This fixes subsequent tests that rely on pwd but not PBD::path_is_within
breakage caused by commit 2689848e
2015-02-12 20:06:47 +10:00
9a7ae1ad99 Add some more test assertions so that tests fail when they should 2015-02-12 20:06:47 +10:00
1da30faf7f Add tests that show the timing differences between the Glib/mm based timeouts
This shows that PBD::Timer is pretty much identical in terms of timing and CPU
usage as Glib TimeoutSources.

They also show the differences on Windows when setting the minimum Multimedia Timer
resolution using timeBeginPeriod
2015-01-01 19:04:09 +07:00
0ec85a4164 Fix running libpbd unit tests when $TOP(in test scripts) is set as relative path
Add test for PBD::canonical_path that was used to track down silly mistake
in test code
2014-12-03 17:44:48 +07:00
aed58d6f39 Use test_output_directory() in pbd filesystem test
This prevents directory being created in pwd and means deletion of
directory is unnecessary
2014-12-03 17:31:04 +07:00
1c1eff8845 Use PBD::tmp_writable_directory in test_output_directory 2014-12-03 17:31:04 +07:00
3d0e36f579 Add unit tests for PBD::clear_directory and PBD::remove_directory 2014-06-25 12:40:11 -04:00
2ef5cefa6b Rename internal class to stop the wrong destructor from being called 2014-06-25 12:40:11 -04:00
7262e16216 Add a PBD::TextReceiver in pbd testrunner 2014-06-25 12:40:11 -04:00
24c40c0e88 Add simple test for PBD::find_files_matching_pattern
This helped fix a silly cut and paste error in pbd/file_utils.cc so
might as well included it.
2014-06-25 12:40:11 -04:00
4ced10bfe5 Add test utility function to PBD tests to return some utf-8 strings
This is currently unused
2014-06-25 12:40:11 -04:00
53c959ad8f Add a test for PBD::copy_file using test files with utf-8 encoded filenames 2014-06-25 12:40:11 -04:00
7bf392060e Call PBD::init and PBD::cleanup in pbd test executable 2014-06-25 12:40:11 -04:00
7338c4e242 Add test for PBD::copy_file
From this I can see that PBD::copy_file is not working correctly on windows
as it is adding windows style line endings. Adding O_BINARY to ::open flags
would fix it, but perhaps there is a better way...
2014-06-25 12:40:11 -04:00
94d8dfa256 Add utility function to test lib to create a test directory
There is an identical function in libardour test support lib so we
should probably find a better place to put this at some point
2014-06-25 12:40:11 -04:00
cd12698b9c Rename PBD::find_file_in_search_path to just PBD::find_file
saves a bit of typing and not necessary if you look at how it is used.
2014-06-25 12:40:10 -04:00
8ddd12a60d Rename SearchPath class Searchpath
Windows headers define SearchPath which means we have to undefine it
where necessary. This is a pain and can be tricksy, so I feel renaming
the class slightly is the easiest solution.
2013-09-06 14:31:11 +10:00