HDFS-9253. Refactor tests of libhdfs into a directory. Contributed by Haohui Mai.
This commit is contained in:
parent
52ac73f344
commit
79b8d60d08
@ -176,7 +176,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<echo message="Finished @{test}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<run-test test="test_libhdfs_threaded"/>
|
||||
<run-test test="test_libhdfs_threaded_hdfs_static"/>
|
||||
<echo message="Skipping test_libhdfs_zerocopy"/>
|
||||
<run-test test="test_native_mini_dfs"/>
|
||||
</target>
|
||||
@ -237,9 +237,9 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<echo message="Finished @{test}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<run-test test="test_libhdfs_threaded"/>
|
||||
<run-test test="test_libhdfs_zerocopy"/>
|
||||
<run-test test="test_native_mini_dfs"/>
|
||||
<run-test test="test_libhdfs_threaded_hdfs_static"/>
|
||||
<run-test test="test_libhdfs_zerocopy_hdfs_static"/>
|
||||
<run-test test="../libhdfs-tests/test_native_mini_dfs"/>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -66,7 +66,25 @@ endif()
|
||||
# Configure JNI.
|
||||
include(HadoopJNI)
|
||||
|
||||
function(add_libhdfs_test NAME LIBRARY)
|
||||
set(FILES)
|
||||
foreach(FIL ${ARGN})
|
||||
if (IS_ABSOLUTE ${FIL})
|
||||
list(APPEND FILES ${FIL})
|
||||
else()
|
||||
list(APPEND FILES ${CMAKE_SOURCE_DIR}/main/native/libhdfs-tests/${FIL})
|
||||
endif()
|
||||
endforeach()
|
||||
add_executable("${NAME}_${LIBRARY}" ${FILES})
|
||||
endfunction()
|
||||
|
||||
function(link_libhdfs_test NAME LIBRARY)
|
||||
target_link_libraries("${NAME}_${LIBRARY}" ${LIBRARY} ${ARGN})
|
||||
endfunction()
|
||||
|
||||
add_subdirectory(main/native/libhdfs)
|
||||
add_subdirectory(main/native/libhdfs-tests)
|
||||
|
||||
|
||||
if(REQUIRE_LIBWEBHDFS)
|
||||
add_subdirectory(contrib/libwebhdfs)
|
||||
|
@ -27,6 +27,7 @@ include_directories(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/main/native
|
||||
${CMAKE_SOURCE_DIR}/main/native/libhdfs
|
||||
${CMAKE_SOURCE_DIR}/main/native/libhdfs/include
|
||||
${OS_DIR}
|
||||
${JANSSON_INCLUDE_DIR}
|
||||
)
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef _HDFS_HTTP_CLIENT_H_
|
||||
#define _HDFS_HTTP_CLIENT_H_
|
||||
|
||||
#include "hdfs.h" /* for tSize */
|
||||
#include "hdfs/hdfs.h" /* for tSize */
|
||||
|
||||
#include <pthread.h> /* for pthread_t */
|
||||
#include <unistd.h> /* for size_t */
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "exception.h"
|
||||
#include "hdfs.h" /* for hdfsFileInfo */
|
||||
#include "hdfs/hdfs.h" /* for hdfsFileInfo */
|
||||
#include "hdfs_json_parser.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "exception.h"
|
||||
#include "hdfs.h"
|
||||
#include "libhdfs/exception.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
#include "hdfs_http_client.h"
|
||||
#include "hdfs_http_query.h"
|
||||
#include "hdfs_json_parser.h"
|
||||
|
@ -16,8 +16,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hdfs.h"
|
||||
#include "native_mini_dfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
#include "libhdfs-tests/native_mini_dfs.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <jni.h>
|
||||
|
@ -16,7 +16,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -16,9 +16,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "expect.h"
|
||||
#include "hdfs.h"
|
||||
#include "native_mini_dfs.h"
|
||||
#include "libhdfs-tests/expect.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
#include "libhdfs-tests/native_mini_dfs.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <semaphore.h>
|
||||
|
@ -16,7 +16,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
@ -36,6 +36,7 @@ include_directories(
|
||||
${JNI_INCLUDE_DIRS}
|
||||
${CMAKE_SOURCE_DIR}/main/native
|
||||
${CMAKE_SOURCE_DIR}/main/native/libhdfs
|
||||
${CMAKE_SOURCE_DIR}/main/native/libhdfs/include
|
||||
${OS_DIR}
|
||||
${FUSE_INCLUDE_DIRS})
|
||||
|
||||
@ -84,5 +85,6 @@ add_executable(test_fuse_dfs
|
||||
target_link_libraries(test_fuse_dfs
|
||||
${FUSE_LIBRARIES}
|
||||
native_mini_dfs
|
||||
${JAVA_JVM_LIBRARY}
|
||||
pthread
|
||||
)
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "fuse_connect.h"
|
||||
#include "fuse_dfs.h"
|
||||
#include "fuse_users.h"
|
||||
#include "libhdfs/hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
#include "util/tree.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef __FUSE_CONTEXT_HANDLE_H__
|
||||
#define __FUSE_CONTEXT_HANDLE_H__
|
||||
|
||||
#include <hdfs.h>
|
||||
#include <hdfs/hdfs.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef __FUSE_FILE_HANDLE_H__
|
||||
#define __FUSE_FILE_HANDLE_H__
|
||||
|
||||
#include <hdfs.h>
|
||||
#include <hdfs/hdfs.h>
|
||||
#include <pthread.h>
|
||||
|
||||
struct hdfsConn;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
|
||||
/**
|
||||
* Converts from a hdfs hdfsFileInfo to a POSIX stat struct
|
||||
|
@ -16,7 +16,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <hdfs.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef __FUSE_TRASH_H__
|
||||
#define __FUSE_TRASH_H__
|
||||
|
||||
#include <hdfs.h>
|
||||
#include <hdfs/hdfs.h>
|
||||
|
||||
int hdfsDeleteWithTrash(hdfsFS userFS, const char *path, int useTrash);
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define FUSE_USE_VERSION 26
|
||||
|
||||
#include "fuse-dfs/test/fuse_workload.h"
|
||||
#include "libhdfs/expect.h"
|
||||
#include "libhdfs-tests/expect.h"
|
||||
#include "util/posix_util.h"
|
||||
|
||||
#include <dirent.h>
|
||||
|
@ -17,9 +17,9 @@
|
||||
*/
|
||||
|
||||
#include "fuse-dfs/test/fuse_workload.h"
|
||||
#include "libhdfs/expect.h"
|
||||
#include "libhdfs/hdfs.h"
|
||||
#include "libhdfs/native_mini_dfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
#include "libhdfs-tests/expect.h"
|
||||
#include "libhdfs-tests/native_mini_dfs.h"
|
||||
#include "util/posix_util.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -0,0 +1,41 @@
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../libhdfs/include
|
||||
${GENERATED_JAVAH}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../libhdfs
|
||||
${JNI_INCLUDE_DIRS}
|
||||
${OS_DIR}
|
||||
)
|
||||
|
||||
add_library(native_mini_dfs
|
||||
native_mini_dfs.c
|
||||
../libhdfs/common/htable.c
|
||||
../libhdfs/exception.c
|
||||
../libhdfs/jni_helper.c
|
||||
${OS_DIR}/mutexes.c
|
||||
${OS_DIR}/thread_local_storage.c
|
||||
)
|
||||
|
||||
add_executable(test_native_mini_dfs test_native_mini_dfs.c)
|
||||
target_link_libraries(test_native_mini_dfs native_mini_dfs ${JAVA_JVM_LIBRARY})
|
||||
|
||||
add_executable(test_htable ../libhdfs/common/htable.c test_htable.c)
|
||||
target_link_libraries(test_htable ${OS_LINK_LIBRARIES})
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "expect.h"
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
@ -16,7 +16,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
#include "hdfs_test.h"
|
||||
#include "platform.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "expect.h"
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
#include "native_mini_dfs.h"
|
||||
#include "os/thread.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "expect.h"
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
#include "native_mini_dfs.h"
|
||||
#include "platform.h"
|
||||
|
@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
|
||||
#define VECSUM_CHUNK_SIZE (8 * 1024 * 1024)
|
||||
#define ZCR_READ_CHUNK_SIZE (1024 * 1024 * 8)
|
@ -18,6 +18,7 @@
|
||||
add_definitions(-DLIBHDFS_DLL_EXPORT)
|
||||
|
||||
include_directories(
|
||||
include
|
||||
${GENERATED_JAVAH}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
@ -50,92 +51,24 @@ set(LIBHDFS_VERSION "0.0.0")
|
||||
set_target_properties(hdfs PROPERTIES
|
||||
SOVERSION ${LIBHDFS_VERSION})
|
||||
|
||||
add_executable(test_libhdfs_ops
|
||||
test/test_libhdfs_ops.c
|
||||
)
|
||||
target_link_libraries(test_libhdfs_ops
|
||||
hdfs_static
|
||||
${JAVA_JVM_LIBRARY}
|
||||
)
|
||||
|
||||
add_executable(test_libhdfs_read
|
||||
test/test_libhdfs_read.c
|
||||
)
|
||||
target_link_libraries(test_libhdfs_read
|
||||
hdfs_static
|
||||
${JAVA_JVM_LIBRARY}
|
||||
)
|
||||
|
||||
add_executable(test_libhdfs_write
|
||||
test/test_libhdfs_write.c
|
||||
)
|
||||
target_link_libraries(test_libhdfs_write
|
||||
hdfs_static
|
||||
${JAVA_JVM_LIBRARY}
|
||||
)
|
||||
|
||||
add_library(native_mini_dfs
|
||||
native_mini_dfs.c
|
||||
common/htable.c
|
||||
exception.c
|
||||
jni_helper.c
|
||||
${OS_DIR}/mutexes.c
|
||||
${OS_DIR}/thread_local_storage.c
|
||||
)
|
||||
target_link_libraries(native_mini_dfs
|
||||
${JAVA_JVM_LIBRARY}
|
||||
${LIB_DL}
|
||||
${OS_LINK_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(test_native_mini_dfs
|
||||
test_native_mini_dfs.c
|
||||
)
|
||||
target_link_libraries(test_native_mini_dfs
|
||||
native_mini_dfs
|
||||
)
|
||||
|
||||
add_executable(test_libhdfs_threaded
|
||||
expect.c
|
||||
test_libhdfs_threaded.c
|
||||
${OS_DIR}/thread.c
|
||||
)
|
||||
target_link_libraries(test_libhdfs_threaded
|
||||
hdfs_static
|
||||
native_mini_dfs
|
||||
${OS_LINK_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(test_libhdfs_zerocopy
|
||||
expect.c
|
||||
test/test_libhdfs_zerocopy.c
|
||||
)
|
||||
target_link_libraries(test_libhdfs_zerocopy
|
||||
hdfs_static
|
||||
native_mini_dfs
|
||||
${OS_LINK_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(test_htable
|
||||
common/htable.c
|
||||
test/test_htable.c
|
||||
)
|
||||
target_link_libraries(test_htable
|
||||
${OS_LINK_LIBRARIES}
|
||||
)
|
||||
add_libhdfs_test(test_libhdfs_ops hdfs_static test_libhdfs_ops.c)
|
||||
link_libhdfs_test(test_libhdfs_ops hdfs_static ${JAVA_JVM_LIBRARY})
|
||||
add_libhdfs_test(test_libhdfs_reads hdfs_static test_libhdfs_read.c)
|
||||
link_libhdfs_test(test_libhdfs_reads hdfs_static ${JAVA_JVM_LIBRARY})
|
||||
add_libhdfs_test(test_libhdfs_write hdfs_static test_libhdfs_write.c)
|
||||
link_libhdfs_test(test_libhdfs_write hdfs_static ${JAVA_JVM_LIBRARY})
|
||||
add_libhdfs_test(test_libhdfs_threaded hdfs_static expect.c test_libhdfs_threaded.c ${OS_DIR}/thread.c)
|
||||
link_libhdfs_test(test_libhdfs_threaded hdfs_static native_mini_dfs)
|
||||
add_libhdfs_test(test_libhdfs_zerocopy hdfs_static expect.c test_libhdfs_zerocopy.c)
|
||||
link_libhdfs_test(test_libhdfs_zerocopy hdfs_static native_mini_dfs ${OS_LINK_LIBRARIES})
|
||||
|
||||
# Skip vecsum on Windows. This could be made to work in the future by
|
||||
# introducing an abstraction layer over the sys/mman.h functions.
|
||||
if(NOT WIN32)
|
||||
add_executable(test_libhdfs_vecsum test/vecsum.c)
|
||||
add_libhdfs_test(test_libhdfs_vecsum hdfs vecsum.c)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
target_link_libraries(test_libhdfs_vecsum
|
||||
hdfs
|
||||
pthread)
|
||||
link_libhdfs_test(test_libhdfs_vecsum hdfs pthread)
|
||||
else()
|
||||
target_link_libraries(test_libhdfs_vecsum
|
||||
hdfs
|
||||
pthread
|
||||
rt)
|
||||
link_libhdfs_test(test_libhdfs_vecsum hdfs pthread rt)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "exception.h"
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
#include "jni_helper.h"
|
||||
#include "platform.h"
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "exception.h"
|
||||
#include "hdfs.h"
|
||||
#include "hdfs/hdfs.h"
|
||||
#include "jni_helper.h"
|
||||
#include "platform.h"
|
||||
|
||||
|
@ -1568,6 +1568,8 @@ Release 2.8.0 - UNRELEASED
|
||||
HDFS-9167. Update pom.xml in other modules to depend on hdfs-client instead
|
||||
of hdfs. (Mingliang Liu via wheat9)
|
||||
|
||||
HDFS-9253. Refactor tests of libhdfs into a directory. (wheat9)
|
||||
|
||||
BUG FIXES
|
||||
|
||||
HDFS-7501. TransactionsSinceLastCheckpoint can be negative on SBNs.
|
||||
|
Loading…
Reference in New Issue
Block a user