/**
 * Copyright (c) 2023 Huawei Device Co., Ltd.
 * 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 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.
 */

#include <dlfcn.h>
#include <dlfcn_ext.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>

#include "functionalext.h"
#include "dlns_test.h"

/**
 * @tc.name      : dlopen_ext_0100
 * @tc.desc      : extinfo flag is 0, call dlopen_ext, return handle is not NULL.
 * @tc.level     : Level 0
 */
void dlopen_0100(void)
{
    dl_extinfo extinfo = {
        .flag = 0,
        .relro_fd = -1,
    };

    Dl_namespace dlns;
    dlns_init(&dlns, "dlns_create_0100");

    void *handle = dlopen_ns_ext(&dlns, dllNamePath, RTLD_LAZY, &extinfo);
    EXPECT_PTRNE(__FUNCTION__, handle, NULL);
    if(handle){
        dlclose(handle);
    };
}

int main(){
    dlopen_0100();
    return t_status;
}