diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2017-09-15 05:15:08 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2017-09-15 05:15:08 +0300 |
commit | f6ce8d2618caedd8bd5e5637ff63dfa83f46180a (patch) | |
tree | b3ef8450382e01df742d5c758c8f29cbdbc51c97 /test/tests/path_discovery.cpp | |
parent | 259ae5845aee53e35aff45ee22c31b4c0ad9d0f8 (diff) |
Path discovery is implemented and working well for Windows. POSIX not yet.
section_handle without a backing file now uses a memory backed anonymous inode on POSIX, thus matching Windows.
Diffstat (limited to 'test/tests/path_discovery.cpp')
-rw-r--r-- | test/tests/path_discovery.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/tests/path_discovery.cpp b/test/tests/path_discovery.cpp new file mode 100644 index 00000000..bbd76f08 --- /dev/null +++ b/test/tests/path_discovery.cpp @@ -0,0 +1,66 @@ +/* Integration test kernel for whether path discovery works +(C) 2017 Niall Douglas <http://www.nedproductions.biz/> (2 commits) +File Created: Aug 2017 + + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License in the accompanying file +Licence.txt or at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + +Distributed under the Boost Software License, Version 1.0. + (See accompanying file Licence.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +*/ + +#include "../../include/afio/afio.hpp" +#include "kerneltest/include/kerneltest.hpp" + +static inline void TestPathDiscovery() +{ + namespace afio = AFIO_V2_NAMESPACE; + auto raw_list = afio::path_discovery::all_temporary_directories(); + std::cout << "The raw list of temporary directory paths on this system are:" << std::endl; + for(auto &i : raw_list) + { + std::cout << " " << i.path << " (" << i.source << ")" << std::endl; + } + + auto verified_list = afio::path_discovery::verified_temporary_directories(); + std::cout << "\nThe verified list of temporary directory paths on this system are:" << std::endl; + for(auto &i : verified_list) + { + std::cout << " " << i.path << " (" << i.source << ")" << std::endl; + } + + auto &storage_backed = afio::path_discovery::storage_backed_temporary_files_directory(); + if(storage_backed.is_valid()) + { + std::cout << "\nThe storage backed temporary files directory chosen is:\n " << storage_backed.current_path().value() << std::endl; + } + else + { + std::cout << "\nNo storage backed temporary files directory found!" << std::endl; + } + + auto &memory_backed = afio::path_discovery::memory_backed_temporary_files_directory(); + if(memory_backed.is_valid()) + { + std::cout << "\nThe memory backed temporary files directory chosen is:\n " << memory_backed.current_path().value() << std::endl; + } + else + { + std::cout << "\nNo memory backed temporary files directory found!" << std::endl; + } +} + +KERNELTEST_TEST_KERNEL(integration, afio, path_discovery, temp_directories, "Tests that afio::path_discovery works as expected", TestPathDiscovery()) |