create_test_cache_dir Function

public function create_test_cache_dir(test_name) result(cache_dir)

Create a unique test cache directory to avoid race conditions in parallel tests

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: test_name

Return Value character(len=:), allocatable


Source Code

    function create_test_cache_dir(test_name) result(cache_dir)
        character(len=*), intent(in) :: test_name
        character(len=:), allocatable :: cache_dir
        character(len=32) :: random_suffix
        character(len=:), allocatable :: temp_base

        ! Get temp directory base
        temp_base = create_temp_dir('test_cache_'//trim(test_name))

        ! Use this as the cache directory
        cache_dir = temp_base

        ! Don't call mkdir again - create_temp_dir already creates the directory

    end function create_test_cache_dir