diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml b/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml index a11370d412..b8d96646fd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml @@ -176,7 +176,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> - + @@ -237,9 +237,9 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - - + + + diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt index fb26bec7e7..e3e615255f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt @@ -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) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/CMakeLists.txt index 009dfd6823..cc2b42d44d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/CMakeLists.txt +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/CMakeLists.txt @@ -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} ) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_http_client.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_http_client.h index 8d1c3db100..ab85464167 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_http_client.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_http_client.h @@ -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 /* for pthread_t */ #include /* for size_t */ diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_json_parser.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_json_parser.c index 178fb9de66..f0973a6113 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_json_parser.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_json_parser.c @@ -17,7 +17,7 @@ */ #include "exception.h" -#include "hdfs.h" /* for hdfsFileInfo */ +#include "hdfs/hdfs.h" /* for hdfsFileInfo */ #include "hdfs_json_parser.h" #include diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_web.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_web.c index 86b4faf272..a3d6575fe9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_web.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/hdfs_web.c @@ -20,8 +20,8 @@ #include #include -#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" diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_ops.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_ops.c index 87550ae8f5..af748d8332 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_ops.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_ops.c @@ -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 #include diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_read.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_read.c index 4bd30780e9..61ff113931 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_read.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_read.c @@ -16,7 +16,7 @@ * limitations under the License. */ -#include "hdfs.h" +#include "hdfs/hdfs.h" #include #include diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_threaded.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_threaded.c index 6c9a12e737..72e333d983 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_threaded.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_threaded.c @@ -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 #include diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_write.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_write.c index 652fb862b5..2a3310aa6c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_write.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/contrib/libwebhdfs/src/test_libwebhdfs_write.c @@ -16,7 +16,7 @@ * limitations under the License. */ -#include "hdfs.h" +#include "hdfs/hdfs.h" #include #include diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/CMakeLists.txt index 0e0db5d390..44b18e6f96 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/CMakeLists.txt +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/CMakeLists.txt @@ -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 ) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c index 8a2a00b887..79106bc23c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c @@ -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 diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_context_handle.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_context_handle.h index 6929062908..1561711c20 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_context_handle.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_context_handle.h @@ -19,7 +19,7 @@ #ifndef __FUSE_CONTEXT_HANDLE_H__ #define __FUSE_CONTEXT_HANDLE_H__ -#include +#include #include #include diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_file_handle.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_file_handle.h index 7f9346c1e9..b04f9ec480 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_file_handle.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_file_handle.h @@ -19,7 +19,7 @@ #ifndef __FUSE_FILE_HANDLE_H__ #define __FUSE_FILE_HANDLE_H__ -#include +#include #include struct hdfsConn; diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_stat_struct.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_stat_struct.h index d42a371efe..7828d54bd1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_stat_struct.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_stat_struct.h @@ -23,7 +23,7 @@ #include #include -#include "hdfs.h" +#include "hdfs/hdfs.h" /** * Converts from a hdfs hdfsFileInfo to a POSIX stat struct diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_trash.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_trash.c index 5e58087e22..02f1b5f282 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_trash.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_trash.c @@ -16,7 +16,6 @@ * limitations under the License. */ -#include #include #include #include diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_trash.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_trash.h index 220ce3dbc2..e0cfbad8f5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_trash.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_trash.h @@ -19,7 +19,7 @@ #ifndef __FUSE_TRASH_H__ #define __FUSE_TRASH_H__ -#include +#include int hdfsDeleteWithTrash(hdfsFS userFS, const char *path, int useTrash); diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/fuse_workload.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/fuse_workload.c index 78fdbc66f6..26c482ba28 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/fuse_workload.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/fuse_workload.c @@ -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 diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/test_fuse_dfs.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/test_fuse_dfs.c index f4212a6c51..a4d8ab9ca7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/test_fuse_dfs.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/test_fuse_dfs.c @@ -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 diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/CMakeLists.txt new file mode 100644 index 0000000000..473e762305 --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/CMakeLists.txt @@ -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}) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/expect.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/expect.c similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/expect.c rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/expect.c index 576e9ef363..8ecfed8b70 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/expect.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/expect.c @@ -17,7 +17,7 @@ */ #include "expect.h" -#include "hdfs.h" +#include "hdfs/hdfs.h" #include #include diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/expect.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/expect.h similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/expect.h rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/expect.h diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs_test.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/hdfs_test.h similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs_test.h rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/hdfs_test.h diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/native_mini_dfs.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/native_mini_dfs.c similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/native_mini_dfs.c rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/native_mini_dfs.c diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/native_mini_dfs.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/native_mini_dfs.h similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/native_mini_dfs.h rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/native_mini_dfs.h diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_htable.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_htable.c similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_htable.c rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_htable.c diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_ops.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_ops.c similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_ops.c rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_ops.c index f564de4568..d69aa37794 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_ops.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_ops.c @@ -16,7 +16,7 @@ * limitations under the License. */ -#include "hdfs.h" +#include "hdfs/hdfs.h" #include "hdfs_test.h" #include "platform.h" diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_read.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_read.c similarity index 98% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_read.c rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_read.c index 6e44741c3b..4b90f2a4ab 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_read.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_read.c @@ -16,7 +16,7 @@ * limitations under the License. */ -#include "hdfs.h" +#include "hdfs/hdfs.h" #include #include diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test_libhdfs_threaded.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_threaded.c similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test_libhdfs_threaded.c rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_threaded.c index 702430ce75..032acbf221 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test_libhdfs_threaded.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_threaded.c @@ -17,7 +17,7 @@ */ #include "expect.h" -#include "hdfs.h" +#include "hdfs/hdfs.h" #include "native_mini_dfs.h" #include "os/thread.h" diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_write.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_write.c similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_write.c rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_write.c index 42b3df75f6..c55c8e330c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_write.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_write.c @@ -16,7 +16,7 @@ * limitations under the License. */ -#include "hdfs.h" +#include "hdfs/hdfs.h" #include #include diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_zerocopy.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_zerocopy.c similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_zerocopy.c rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_zerocopy.c index 92941cfb35..bf529b49f6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/test_libhdfs_zerocopy.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_zerocopy.c @@ -17,7 +17,7 @@ */ #include "expect.h" -#include "hdfs.h" +#include "hdfs/hdfs.h" #include "native_mini_dfs.h" #include "platform.h" diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test_native_mini_dfs.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_native_mini_dfs.c similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test_native_mini_dfs.c rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_native_mini_dfs.c diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/vecsum.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c similarity index 99% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/vecsum.c rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c index 80a64b4f73..74d8f1f007 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/test/vecsum.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c @@ -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) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/CMakeLists.txt index 772a864b94..2535cdded7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/CMakeLists.txt +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/CMakeLists.txt @@ -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() diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/exception.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/exception.c index eb7115c568..35e9d2d5a6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/exception.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/exception.c @@ -17,7 +17,7 @@ */ #include "exception.h" -#include "hdfs.h" +#include "hdfs/hdfs.h" #include "jni_helper.h" #include "platform.h" diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c index a3769fcbbc..c5aad1dc9e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c @@ -17,7 +17,7 @@ */ #include "exception.h" -#include "hdfs.h" +#include "hdfs/hdfs.h" #include "jni_helper.h" #include "platform.h" diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/include/hdfs/hdfs.h similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.h rename to hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/include/hdfs/hdfs.h diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 858325fa24..f6cee76294 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -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.