diff options
author | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-15 22:54:42 +0000 |
---|---|---|
committer | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-15 22:54:42 +0000 |
commit | f842270489e338b0eda88b6d27177c4a0f84d8e8 (patch) | |
tree | 1f009e51f0fdccd8360f792bea53b6e625e6b055 /native_client_sdk | |
parent | 4eb905bce8f1468722fd7add6bb7e0093dafb80c (diff) | |
download | chromium_src-f842270489e338b0eda88b6d27177c4a0f84d8e8.zip chromium_src-f842270489e338b0eda88b6d27177c4a0f84d8e8.tar.gz chromium_src-f842270489e338b0eda88b6d27177c4a0f84d8e8.tar.bz2 |
[NaCl SDK] Verify the SDK before tar'ing.
The verification step ensures that we aren't missing any files, and aren't
including any extra files.
BUG=none
R=sbc@chromium.org
Review URL: https://codereview.chromium.org/15051009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-x | native_client_sdk/src/build_tools/build_sdk.py | 7 | ||||
-rw-r--r-- | native_client_sdk/src/build_tools/sdk_files.list | 831 | ||||
-rwxr-xr-x | native_client_sdk/src/build_tools/tests/verify_filelist_test.py | 127 | ||||
-rwxr-xr-x | native_client_sdk/src/build_tools/verify_filelist.py | 176 | ||||
-rwxr-xr-x | native_client_sdk/src/test_all.py | 9 |
5 files changed, 1145 insertions, 5 deletions
diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py index 2216c5b..67274a1 100755 --- a/native_client_sdk/src/build_tools/build_sdk.py +++ b/native_client_sdk/src/build_tools/build_sdk.py @@ -40,8 +40,9 @@ import generate_notice import manifest_util import parse_dsc import test_sdk +import verify_filelist -from build_paths import SDK_SRC_DIR, SRC_DIR, NACL_DIR, OUT_DIR +from build_paths import SCRIPT_DIR, SDK_SRC_DIR, SRC_DIR, NACL_DIR, OUT_DIR from build_paths import PPAPI_DIR, NACLPORTS_DIR, GSTORE # Add SDK make tools scripts to the python path. @@ -930,6 +931,10 @@ def main(args): BuildStepBuildLibraries(pepperdir, platform, 'src') GenerateNotice(pepperdir) + # Verify the SDK contains what we expect. + verify_filelist.Verify(platform, os.path.join(SCRIPT_DIR, 'sdk_files.list'), + pepperdir) + if not options.skip_tar: BuildStepTarBundle(pepper_ver, tarfile) diff --git a/native_client_sdk/src/build_tools/sdk_files.list b/native_client_sdk/src/build_tools/sdk_files.list new file mode 100644 index 0000000..7cc0fea --- /dev/null +++ b/native_client_sdk/src/build_tools/sdk_files.list @@ -0,0 +1,831 @@ +AUTHORS +COPYING +examples/api/audio/audio.cc +examples/api/audio/background.js +examples/api/audio/common.js +examples/api/audio/example.js +examples/api/audio/icon128.png +examples/api/audio/index.html +examples/api/audio/make.bat +examples/api/audio/Makefile +examples/api/audio/manifest.json +examples/api/core/background.js +examples/api/core/common.js +examples/api/core/core.cc +examples/api/core/example.js +examples/api/core/icon128.png +examples/api/core/index.html +examples/api/core/make.bat +examples/api/core/Makefile +examples/api/core/manifest.json +examples/api/file_io/background.js +examples/api/file_io/common.js +examples/api/file_io/example.js +examples/api/file_io/file_io.cc +examples/api/file_io/icon128.png +examples/api/file_io/index.html +examples/api/file_io/make.bat +examples/api/file_io/Makefile +examples/api/file_io/manifest.json +examples/api/gamepad/background.js +examples/api/gamepad/common.js +examples/api/gamepad/gamepad.cc +examples/api/gamepad/icon128.png +examples/api/gamepad/index.html +examples/api/gamepad/make.bat +examples/api/gamepad/Makefile +examples/api/gamepad/manifest.json +examples/api/graphics_3d/background.js +examples/api/graphics_3d/common.js +examples/api/graphics_3d/fragment_shader_es2.frag +examples/api/graphics_3d/graphics_3d.cc +examples/api/graphics_3d/hello.raw +examples/api/graphics_3d/icon128.png +examples/api/graphics_3d/index.html +examples/api/graphics_3d/make.bat +examples/api/graphics_3d/Makefile +examples/api/graphics_3d/manifest.json +examples/api/graphics_3d/matrix.cc +examples/api/graphics_3d/matrix.h +examples/api/graphics_3d/vertex_shader_es2.vert +examples/api/input_event/background.js +examples/api/input_event/common.js +examples/api/input_event/custom_events.cc +examples/api/input_event/custom_events.h +examples/api/input_event/example.js +examples/api/input_event/icon128.png +examples/api/input_event/index.html +examples/api/input_event/input_event.cc +examples/api/input_event/make.bat +examples/api/input_event/Makefile +examples/api/input_event/manifest.json +examples/api/input_event/shared_queue.h +examples/api/make.bat +examples/api/Makefile +examples/api/mouse_lock/background.js +examples/api/mouse_lock/common.js +examples/api/mouse_lock/icon128.png +examples/api/mouse_lock/index.html +examples/api/mouse_lock/make.bat +examples/api/mouse_lock/Makefile +examples/api/mouse_lock/manifest.json +examples/api/mouse_lock/mouse_lock.cc +examples/api/mouse_lock/mouse_lock.h +examples/api/url_loader/background.js +examples/api/url_loader/common.js +examples/api/url_loader/example.js +examples/api/url_loader/icon128.png +examples/api/url_loader/index.html +examples/api/url_loader/make.bat +examples/api/url_loader/Makefile +examples/api/url_loader/manifest.json +examples/api/url_loader/url_loader.cc +examples/api/url_loader/url_loader_handler.cc +examples/api/url_loader/url_loader_handler.h +examples/api/url_loader/url_loader_success.html +examples/api/var_array_buffer/background.js +examples/api/var_array_buffer/common.js +examples/api/var_array_buffer/example.js +examples/api/var_array_buffer/icon128.png +examples/api/var_array_buffer/index.html +examples/api/var_array_buffer/make.bat +examples/api/var_array_buffer/Makefile +examples/api/var_array_buffer/manifest.json +examples/api/var_array_buffer/var_array_buffer.cc +examples/api/websocket/background.js +examples/api/websocket/common.js +examples/api/websocket/example.js +examples/api/websocket/icon128.png +examples/api/websocket/index.html +examples/api/websocket/make.bat +examples/api/websocket/Makefile +examples/api/websocket/manifest.json +examples/api/websocket/websocket.cc +examples/button_close_hover.png +examples/button_close.png +examples/demo/make.bat +examples/demo/Makefile +examples/demo/nacl_io/background.js +examples/demo/nacl_io/common.js +examples/demo/nacl_io/example.js +examples/demo/nacl_io/handlers.c +examples/demo/nacl_io/handlers.h +examples/demo/nacl_io/icon128.png +examples/demo/nacl_io/index.html +examples/demo/nacl_io/make.bat +examples/demo/nacl_io/Makefile +examples/demo/nacl_io/manifest.json +examples/demo/nacl_io/nacl_io_demo.c +examples/demo/nacl_io/nacl_io_demo.h +examples/demo/nacl_io/queue.c +examples/demo/nacl_io/queue.h +examples/demo/pi_generator/background.js +examples/demo/pi_generator/common.js +examples/demo/pi_generator/example.js +examples/demo/pi_generator/icon128.png +examples/demo/pi_generator/index.html +examples/demo/pi_generator/make.bat +examples/demo/pi_generator/Makefile +examples/demo/pi_generator/manifest.json +examples/demo/pi_generator/pi_generator.cc +examples/favicon.ico +examples/getting_started/hello_world/background.js +examples/getting_started/hello_world/common.js +examples/getting_started/hello_world/example.js +examples/getting_started/hello_world/hello_world.c +examples/getting_started/hello_world/icon128.png +examples/getting_started/hello_world/index.html +examples/getting_started/hello_world/make.bat +examples/getting_started/hello_world/Makefile +examples/getting_started/hello_world/manifest.json +examples/getting_started/hello_world_ppapi_main/background.js +examples/getting_started/hello_world_ppapi_main/common.js +examples/getting_started/hello_world_ppapi_main/example.js +examples/getting_started/hello_world_ppapi_main/hello_world.c +examples/getting_started/hello_world_ppapi_main/icon128.png +examples/getting_started/hello_world_ppapi_main/index.html +examples/getting_started/hello_world_ppapi_main/make.bat +examples/getting_started/hello_world_ppapi_main/Makefile +examples/getting_started/hello_world_ppapi_main/manifest.json +examples/getting_started/make.bat +examples/getting_started/Makefile +examples/httpd.cmd +examples/index.css +examples/index.html +examples/index.js +examples/make.bat +examples/Makefile +examples/tutorial/debugging/background.js +examples/tutorial/debugging/common.js +examples/tutorial/debugging/debugging.c +examples/tutorial/debugging/example.js +examples/tutorial/debugging/icon128.png +examples/tutorial/debugging/index.html +examples/tutorial/debugging/make.bat +examples/tutorial/debugging/Makefile +examples/tutorial/debugging/manifest.json +examples/tutorial/dlopen/background.js +examples/tutorial/dlopen/common.js +examples/tutorial/dlopen/dlopen.cc +examples/tutorial/dlopen/eightball.cc +examples/tutorial/dlopen/eightball.h +examples/tutorial/dlopen/example.js +examples/tutorial/dlopen/icon128.png +examples/tutorial/dlopen/index.html +examples/tutorial/dlopen/make.bat +examples/tutorial/dlopen/Makefile +examples/tutorial/dlopen/manifest.json +examples/tutorial/dlopen/reverse.cc +examples/tutorial/dlopen/reverse.h +examples/tutorial/load_progress/background.js +examples/tutorial/load_progress/common.js +examples/tutorial/load_progress/example.js +examples/tutorial/load_progress/icon128.png +examples/tutorial/load_progress/index.html +examples/tutorial/load_progress/load_progress.cc +examples/tutorial/load_progress/make.bat +examples/tutorial/load_progress/Makefile +examples/tutorial/load_progress/manifest.json +examples/tutorial/make.bat +examples/tutorial/Makefile +include/EGL/eglext.h +include/EGL/egl.h +include/EGL/eglplatform.h +include/error_handling/error_handling.h +include/error_handling/string_stream.h +include/GLES2/gl2ext.h +include/GLES2/gl2.h +include/GLES2/gl2platform.h +include/json/assertions.h +include/json/autolink.h +include/json/config.h +include/json/features.h +include/json/forwards.h +include/json/json.h +include/json/reader.h +include/json/value.h +include/json/writer.h +include/KHR/khrplatform.h +include/nacl_io/inode_pool.h +include/nacl_io/kernel_handle.h +include/nacl_io/kernel_intercept.h +include/nacl_io/kernel_object.h +include/nacl_io/kernel_proxy.h +include/nacl_io/kernel_wrap.h +include/nacl_io/kernel_wrap_real.h +include/nacl_io/mount_dev.h +include/nacl_io/mount.h +include/nacl_io/mount_html5fs.h +include/nacl_io/mount_http.h +include/nacl_io/mount_mem.h +include/nacl_io/mount_node_dir.h +include/nacl_io/mount_node.h +include/nacl_io/mount_node_html5fs.h +include/nacl_io/mount_node_mem.h +include/nacl_io/mount_passthrough.h +include/nacl_io/nacl_io.h +include/nacl_io/osdirent.h +include/nacl_io/osinttypes.h +include/nacl_io/osmman.h +include/nacl_io/osstat.h +include/nacl_io/ostypes.h +include/nacl_io/path.h +include/nacl_io/pepper/all_interfaces.h +include/nacl_io/pepper/define_empty_macros.h +include/nacl_io/pepper_interface.h +include/nacl_io/pepper/undef_macros.h +include/nacl_io/real_pepper_interface.h +include/ppapi/c/dev/deprecated_bool.h +include/ppapi/c/dev/ppb_audio_input_dev.h +include/ppapi/c/dev/ppb_buffer_dev.h +include/ppapi/c/dev/ppb_char_set_dev.h +include/ppapi/c/dev/ppb_crypto_dev.h +include/ppapi/c/dev/ppb_cursor_control_dev.h +include/ppapi/c/dev/ppb_device_ref_dev.h +include/ppapi/c/dev/ppb_file_chooser_dev.h +include/ppapi/c/dev/ppb_find_dev.h +include/ppapi/c/dev/ppb_font_dev.h +include/ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h +include/ppapi/c/dev/ppb_graphics_2d_dev.h +include/ppapi/c/dev/ppb_ime_input_event_dev.h +include/ppapi/c/dev/ppb_keyboard_input_event_dev.h +include/ppapi/c/dev/ppb_memory_dev.h +include/ppapi/c/dev/ppb_opengles2ext_dev.h +include/ppapi/c/dev/ppb_printing_dev.h +include/ppapi/c/dev/ppb_resource_array_dev.h +include/ppapi/c/dev/ppb_scrollbar_dev.h +include/ppapi/c/dev/ppb_testing_dev.h +include/ppapi/c/dev/ppb_text_input_dev.h +include/ppapi/c/dev/ppb_trace_event_dev.h +include/ppapi/c/dev/ppb_truetype_font_dev.h +include/ppapi/c/dev/ppb_url_util_dev.h +include/ppapi/c/dev/ppb_var_array_dev.h +include/ppapi/c/dev/ppb_var_deprecated.h +include/ppapi/c/dev/ppb_var_dictionary_dev.h +include/ppapi/c/dev/ppb_video_capture_dev.h +include/ppapi/c/dev/ppb_video_decoder_dev.h +include/ppapi/c/dev/ppb_view_dev.h +include/ppapi/c/dev/ppb_widget_dev.h +include/ppapi/c/dev/ppb_zoom_dev.h +include/ppapi/c/dev/pp_cursor_type_dev.h +include/ppapi/c/dev/ppp_class_deprecated.h +include/ppapi/c/dev/ppp_find_dev.h +include/ppapi/c/dev/ppp_network_state_dev.h +include/ppapi/c/dev/ppp_printing_dev.h +include/ppapi/c/dev/pp_print_settings_dev.h +include/ppapi/c/dev/ppp_scrollbar_dev.h +include/ppapi/c/dev/ppp_selection_dev.h +include/ppapi/c/dev/ppp_text_input_dev.h +include/ppapi/c/dev/ppp_video_capture_dev.h +include/ppapi/c/dev/ppp_video_decoder_dev.h +include/ppapi/c/dev/ppp_widget_dev.h +include/ppapi/c/dev/ppp_zoom_dev.h +include/ppapi/c/dev/pp_video_capture_dev.h +include/ppapi/c/dev/pp_video_dev.h +include/ppapi/c/extensions/dev/ppb_ext_alarms_dev.h +include/ppapi/c/extensions/dev/ppb_ext_events_dev.h +include/ppapi/c/extensions/dev/ppb_ext_socket_dev.h +include/ppapi/c/pp_array_output.h +include/ppapi/cpp/array_output.h +include/ppapi/cpp/audio_config.h +include/ppapi/cpp/audio.h +include/ppapi/c/ppb_audio_config.h +include/ppapi/c/ppb_audio.h +include/ppapi/c/ppb_console.h +include/ppapi/c/ppb_core.h +include/ppapi/c/ppb_file_io.h +include/ppapi/c/ppb_file_ref.h +include/ppapi/c/ppb_file_system.h +include/ppapi/c/ppb_fullscreen.h +include/ppapi/c/ppb_gamepad.h +include/ppapi/c/ppb_graphics_2d.h +include/ppapi/c/ppb_graphics_3d.h +include/ppapi/c/ppb.h +include/ppapi/c/ppb_image_data.h +include/ppapi/c/ppb_input_event.h +include/ppapi/c/ppb_instance.h +include/ppapi/c/ppb_message_loop.h +include/ppapi/c/ppb_messaging.h +include/ppapi/c/ppb_mouse_cursor.h +include/ppapi/c/ppb_mouse_lock.h +include/ppapi/c/pp_bool.h +include/ppapi/c/ppb_opengles2.h +include/ppapi/c/ppb_url_loader.h +include/ppapi/c/ppb_url_request_info.h +include/ppapi/c/ppb_url_response_info.h +include/ppapi/c/ppb_var_array_buffer.h +include/ppapi/c/ppb_var.h +include/ppapi/c/ppb_view.h +include/ppapi/c/ppb_websocket.h +include/ppapi/c/pp_completion_callback.h +include/ppapi/cpp/completion_callback.h +include/ppapi/cpp/core.h +include/ppapi/cpp/dev/audio_input_dev.h +include/ppapi/cpp/dev/buffer_dev.h +include/ppapi/cpp/dev/crypto_dev.h +include/ppapi/cpp/dev/cursor_control_dev.h +include/ppapi/cpp/dev/device_ref_dev.h +include/ppapi/cpp/dev/file_chooser_dev.h +include/ppapi/cpp/dev/find_dev.h +include/ppapi/cpp/dev/font_dev.h +include/ppapi/cpp/dev/graphics_2d_dev.h +include/ppapi/cpp/dev/ime_input_event_dev.h +include/ppapi/cpp/dev/memory_dev.h +include/ppapi/cpp/dev/printing_dev.h +include/ppapi/cpp/dev/resource_array_dev.h +include/ppapi/cpp/dev/scriptable_object_deprecated.h +include/ppapi/cpp/dev/scrollbar_dev.h +include/ppapi/cpp/dev/selection_dev.h +include/ppapi/cpp/dev/text_input_dev.h +include/ppapi/cpp/dev/truetype_font_dev.h +include/ppapi/cpp/dev/url_util_dev.h +include/ppapi/cpp/dev/var_array_dev.h +include/ppapi/cpp/dev/var_dictionary_dev.h +include/ppapi/cpp/dev/video_capture_client_dev.h +include/ppapi/cpp/dev/video_capture_dev.h +include/ppapi/cpp/dev/video_decoder_client_dev.h +include/ppapi/cpp/dev/video_decoder_dev.h +include/ppapi/cpp/dev/view_dev.h +include/ppapi/cpp/dev/widget_client_dev.h +include/ppapi/cpp/dev/widget_dev.h +include/ppapi/cpp/dev/zoom_dev.h +include/ppapi/c/pp_directory_entry.h +include/ppapi/cpp/directory_entry.h +include/ppapi/c/pp_errors.h +include/ppapi/cpp/extensions/dev/alarms_dev.h +include/ppapi/cpp/extensions/dev/events_dev.h +include/ppapi/cpp/extensions/dev/socket_dev.h +include/ppapi/cpp/extensions/dict_field.h +include/ppapi/cpp/extensions/event_base.h +include/ppapi/cpp/extensions/ext_output_traits.h +include/ppapi/cpp/extensions/from_var_converter.h +include/ppapi/cpp/extensions/optional.h +include/ppapi/cpp/extensions/to_var_converter.h +include/ppapi/c/pp_file_info.h +include/ppapi/cpp/file_io.h +include/ppapi/cpp/file_ref.h +include/ppapi/cpp/file_system.h +include/ppapi/cpp/fullscreen.h +include/ppapi/cpp/graphics_2d.h +include/ppapi/cpp/graphics_3d_client.h +include/ppapi/c/pp_graphics_3d.h +include/ppapi/cpp/graphics_3d.h +include/ppapi/cpp/image_data.h +include/ppapi/c/pp_input_event.h +include/ppapi/cpp/input_event.h +include/ppapi/c/pp_instance.h +include/ppapi/cpp/instance.h +include/ppapi/cpp/instance_handle.h +include/ppapi/cpp/logging.h +include/ppapi/c/pp_macros.h +include/ppapi/cpp/message_loop.h +include/ppapi/cpp/module_embedder.h +include/ppapi/c/pp_module.h +include/ppapi/cpp/module.h +include/ppapi/cpp/module_impl.h +include/ppapi/cpp/mouse_cursor.h +include/ppapi/cpp/mouse_lock.h +include/ppapi/cpp/output_traits.h +include/ppapi/cpp/pass_ref.h +include/ppapi/c/ppp_graphics_3d.h +include/ppapi/c/ppp.h +include/ppapi/c/ppp_input_event.h +include/ppapi/c/ppp_instance.h +include/ppapi/c/ppp_messaging.h +include/ppapi/c/ppp_mouse_lock.h +include/ppapi/c/pp_point.h +include/ppapi/cpp/point.h +include/ppapi/c/pp_rect.h +include/ppapi/cpp/rect.h +include/ppapi/c/pp_resource.h +include/ppapi/cpp/resource.h +include/ppapi/c/pp_size.h +include/ppapi/cpp/size.h +include/ppapi/c/pp_stdint.h +include/ppapi/c/pp_time.h +include/ppapi/c/pp_touch_point.h +include/ppapi/cpp/touch_point.h +include/ppapi/cpp/url_loader.h +include/ppapi/cpp/url_request_info.h +include/ppapi/cpp/url_response_info.h +include/ppapi/cpp/var_array_buffer.h +include/ppapi/c/pp_var.h +include/ppapi/cpp/var.h +include/ppapi/cpp/view.h +include/ppapi/cpp/websocket.h +include/ppapi/gles2/gl2ext_ppapi.h +include/ppapi/lib/gl/egl/egldriver.c +include/ppapi/lib/gl/egl/egldriver_ppapi.c +include/ppapi/lib/gl/gles2/gl2ext_ppapi.c +include/ppapi/lib/gl/gles2/gl2ext_ppapi.h +include/ppapi/lib/gl/gles2/gles2.c +include/ppapi/lib/gl/gl.gyp +include/ppapi/lib/gl/include/EGL/eglext.h +include/ppapi/lib/gl/include/EGL/egl.h +include/ppapi/lib/gl/include/EGL/eglplatform.h +include/ppapi/lib/gl/include/GLES2/gl2ext.h +include/ppapi/lib/gl/include/GLES2/gl2.h +include/ppapi/lib/gl/include/GLES2/gl2platform.h +include/ppapi/lib/gl/include/KHR/khrplatform.h +include/ppapi_main/ppapi_event.h +include/ppapi_main/ppapi_instance2d.h +include/ppapi_main/ppapi_instance3d.h +include/ppapi_main/ppapi_instance.h +include/ppapi_main/ppapi_main.h +include/ppapi_main/ppapi_queue.h +include/ppapi/utility/completion_callback_factory.h +include/ppapi/utility/completion_callback_factory_thread_traits.h +include/ppapi/utility/graphics/paint_aggregator.h +include/ppapi/utility/graphics/paint_manager.h +include/ppapi/utility/threading/lock.h +include/ppapi/utility/threading/simple_thread.h +include/ppapi/utility/websocket/websocket_api.h +[win]include/win/config.h +[win]include/win/context.h +[win]include/win/implement.h +[win]include/win/need_errno.h +[win]include/win/pthread.h +[win]include/win/sched.h +[win]include/win/semaphore.h +include/utils/auto_lock.h +include/utils/macros.h +include/utils/ref_object.h +lib/glibc_x86_32/Debug/libjsoncpp.a +lib/glibc_x86_32/Debug/libjsoncpp.so +lib/glibc_x86_32/Debug/libnacl_io.a +lib/glibc_x86_32/Debug/libnacl_io.so +lib/glibc_x86_32/Debug/libppapi_cpp.a +lib/glibc_x86_32/Debug/libppapi_cpp.so +lib/glibc_x86_32/Debug/libppapi_gles2.a +lib/glibc_x86_32/Debug/libppapi_gles2.so +lib/glibc_x86_32/Debug/libppapi_main.a +lib/glibc_x86_32/Release/libjsoncpp.a +lib/glibc_x86_32/Release/libjsoncpp.so +lib/glibc_x86_32/Release/libnacl_io.a +lib/glibc_x86_32/Release/libnacl_io.so +lib/glibc_x86_32/Release/libppapi_cpp.a +lib/glibc_x86_32/Release/libppapi_cpp.so +lib/glibc_x86_32/Release/libppapi_gles2.a +lib/glibc_x86_32/Release/libppapi_gles2.so +lib/glibc_x86_32/Release/libppapi_main.a +lib/glibc_x86_64/Debug/libjsoncpp.a +lib/glibc_x86_64/Debug/libjsoncpp.so +lib/glibc_x86_64/Debug/libnacl_io.a +lib/glibc_x86_64/Debug/libnacl_io.so +lib/glibc_x86_64/Debug/libppapi_cpp.a +lib/glibc_x86_64/Debug/libppapi_cpp.so +lib/glibc_x86_64/Debug/libppapi_gles2.a +lib/glibc_x86_64/Debug/libppapi_gles2.so +lib/glibc_x86_64/Debug/libppapi_main.a +lib/glibc_x86_64/Release/libjsoncpp.a +lib/glibc_x86_64/Release/libjsoncpp.so +lib/glibc_x86_64/Release/libnacl_io.a +lib/glibc_x86_64/Release/libnacl_io.so +lib/glibc_x86_64/Release/libppapi_cpp.a +lib/glibc_x86_64/Release/libppapi_cpp.so +lib/glibc_x86_64/Release/libppapi_gles2.a +lib/glibc_x86_64/Release/libppapi_gles2.so +lib/glibc_x86_64/Release/libppapi_main.a +[linux]lib/${PLATFORM}_host/Debug/libjsoncpp.a +[linux]lib/${PLATFORM}_host/Debug/libppapi.a +[linux]lib/${PLATFORM}_host/Debug/libppapi_cpp.a +[linux]lib/${PLATFORM}_host/Debug/libppapi_gles2.a +[linux]lib/${PLATFORM}_host/Release/libjsoncpp.a +[linux]lib/${PLATFORM}_host/Release/libppapi.a +[linux]lib/${PLATFORM}_host/Release/libppapi_cpp.a +[linux]lib/${PLATFORM}_host/Release/libppapi_gles2.a +[win]lib/${PLATFORM}_x86_32_host/Debug/jsoncpp.lib +[win]lib/${PLATFORM}_x86_32_host/Debug/nacl_io.lib +[win]lib/${PLATFORM}_x86_32_host/Debug/ppapi_cpp.lib +[win]lib/${PLATFORM}_x86_32_host/Debug/ppapi_gles2.lib +[win]lib/${PLATFORM}_x86_32_host/Debug/ppapi.lib +[win]lib/${PLATFORM}_x86_32_host/Debug/pthread.lib +[win]lib/${PLATFORM}_x86_32_host/Release/jsoncpp.lib +[win]lib/${PLATFORM}_x86_32_host/Release/nacl_io.lib +[win]lib/${PLATFORM}_x86_32_host/Release/ppapi_cpp.lib +[win]lib/${PLATFORM}_x86_32_host/Release/ppapi_gles2.lib +[win]lib/${PLATFORM}_x86_32_host/Release/ppapi.lib +[win]lib/${PLATFORM}_x86_32_host/Release/pthread.lib +lib/newlib_arm/Debug/liberror_handling.a +lib/newlib_arm/Debug/libjsoncpp.a +lib/newlib_arm/Debug/libnacl_io.a +lib/newlib_arm/Debug/libppapi_cpp.a +lib/newlib_arm/Debug/libppapi_gles2.a +lib/newlib_arm/Debug/libppapi_main.a +lib/newlib_arm/Release/liberror_handling.a +lib/newlib_arm/Release/libjsoncpp.a +lib/newlib_arm/Release/libnacl_io.a +lib/newlib_arm/Release/libppapi_cpp.a +lib/newlib_arm/Release/libppapi_gles2.a +lib/newlib_arm/Release/libppapi_main.a +lib/newlib_x86_32/Debug/liberror_handling.a +lib/newlib_x86_32/Debug/libjsoncpp.a +lib/newlib_x86_32/Debug/libnacl_io.a +lib/newlib_x86_32/Debug/libppapi_cpp.a +lib/newlib_x86_32/Debug/libppapi_gles2.a +lib/newlib_x86_32/Debug/libppapi_main.a +lib/newlib_x86_32/Release/liberror_handling.a +lib/newlib_x86_32/Release/libjsoncpp.a +lib/newlib_x86_32/Release/libnacl_io.a +lib/newlib_x86_32/Release/libppapi_cpp.a +lib/newlib_x86_32/Release/libppapi_gles2.a +lib/newlib_x86_32/Release/libppapi_main.a +lib/newlib_x86_64/Debug/liberror_handling.a +lib/newlib_x86_64/Debug/libjsoncpp.a +lib/newlib_x86_64/Debug/libnacl_io.a +lib/newlib_x86_64/Debug/libppapi_cpp.a +lib/newlib_x86_64/Debug/libppapi_gles2.a +lib/newlib_x86_64/Debug/libppapi_main.a +lib/newlib_x86_64/Release/liberror_handling.a +lib/newlib_x86_64/Release/libjsoncpp.a +lib/newlib_x86_64/Release/libnacl_io.a +lib/newlib_x86_64/Release/libppapi_cpp.a +lib/newlib_x86_64/Release/libppapi_gles2.a +lib/newlib_x86_64/Release/libppapi_main.a +lib/pnacl/Debug/libjsoncpp.a +lib/pnacl/Debug/libnacl_io.a +lib/pnacl/Debug/libppapi_cpp.a +lib/pnacl/Debug/libppapi_gles2.a +lib/pnacl/Debug/libppapi_main.a +lib/pnacl/Release/libjsoncpp.a +lib/pnacl/Release/libnacl_io.a +lib/pnacl/Release/libppapi_cpp.a +lib/pnacl/Release/libppapi_gles2.a +lib/pnacl/Release/libppapi_main.a +LICENSE +NOTICE +README +src/error_handling/error_handling.c +src/error_handling/make.bat +src/error_handling/Makefile +src/error_handling/string_stream.c +src/jsoncpp/json_batchallocator.h +src/jsoncpp/json_internalarray.inl +src/jsoncpp/json_internalmap.inl +src/jsoncpp/json_reader.cpp +src/jsoncpp/json_tool.h +src/jsoncpp/json_value.cpp +src/jsoncpp/json_valueiterator.inl +src/jsoncpp/json_writer.cpp +src/jsoncpp/LICENSE +src/jsoncpp/make.bat +src/jsoncpp/Makefile +src/jsoncpp/README.chromium +src/make.bat +src/Makefile +src/nacl_io/kernel_handle.cc +src/nacl_io/kernel_intercept.cc +src/nacl_io/kernel_object.cc +src/nacl_io/kernel_proxy.cc +src/nacl_io/kernel_wrap_glibc.cc +src/nacl_io/kernel_wrap_newlib.cc +src/nacl_io/kernel_wrap_win.cc +src/nacl_io/make.bat +src/nacl_io/Makefile +src/nacl_io/mount.cc +src/nacl_io/mount_dev.cc +src/nacl_io/mount_html5fs.cc +src/nacl_io/mount_http.cc +src/nacl_io/mount_mem.cc +src/nacl_io/mount_node.cc +src/nacl_io/mount_node_dir.cc +src/nacl_io/mount_node_html5fs.cc +src/nacl_io/mount_node_mem.cc +src/nacl_io/mount_passthrough.cc +src/nacl_io/nacl_io.cc +src/nacl_io/path.cc +src/nacl_io/pepper_interface.cc +src/nacl_io/real_pepper_interface.cc +src/ppapi_cpp/array_output.cc +src/ppapi_cpp/audio.cc +src/ppapi_cpp/audio_config.cc +src/ppapi_cpp/core.cc +src/ppapi_cpp/file_io.cc +src/ppapi_cpp/file_ref.cc +src/ppapi_cpp/file_system.cc +src/ppapi_cpp/fullscreen.cc +src/ppapi_cpp/graphics_2d.cc +src/ppapi_cpp/graphics_3d.cc +src/ppapi_cpp/graphics_3d_client.cc +src/ppapi_cpp/image_data.cc +src/ppapi_cpp/input_event.cc +src/ppapi_cpp/instance.cc +src/ppapi_cpp/instance_handle.cc +src/ppapi_cpp/lock.cc +src/ppapi_cpp/make.bat +src/ppapi_cpp/Makefile +src/ppapi_cpp/message_loop.cc +src/ppapi_cpp/module.cc +src/ppapi_cpp/mouse_cursor.cc +src/ppapi_cpp/mouse_lock.cc +src/ppapi_cpp/paint_aggregator.cc +src/ppapi_cpp/paint_manager.cc +src/ppapi_cpp/ppp_entrypoints.cc +src/ppapi_cpp/rect.cc +src/ppapi_cpp/resource.cc +src/ppapi_cpp/simple_thread.cc +src/ppapi_cpp/url_loader.cc +src/ppapi_cpp/url_request_info.cc +src/ppapi_cpp/url_response_info.cc +src/ppapi_cpp/var_array_buffer.cc +src/ppapi_cpp/var.cc +src/ppapi_cpp/view.cc +src/ppapi_cpp/websocket_api.cc +src/ppapi_cpp/websocket.cc +src/ppapi_gles2/gl2ext_ppapi.c +src/ppapi_gles2/gles2.c +src/ppapi_gles2/make.bat +src/ppapi_gles2/Makefile +src/ppapi_main/make.bat +src/ppapi_main/Makefile +src/ppapi_main/ppapi_instance2d.cc +src/ppapi_main/ppapi_instance3d.cc +src/ppapi_main/ppapi_instance.cc +src/ppapi_main/ppapi_main.cc +src/ppapi_main/ppapi_queue.cc +[win]src/pthread/autostatic.c +[win]src/pthread/cleanup.c +[win]src/pthread/CONTRIBUTORS +[win]src/pthread/COPYING +[win]src/pthread/COPYING.LIB +[win]src/pthread/create.c +[win]src/pthread/errno.c +[win]src/pthread/fork.c +[win]src/pthread/global.c +[win]src/pthread/MAINTAINERS +[win]src/pthread/make.bat +[win]src/pthread/Makefile +[win]src/pthread/pthread_attr_destroy.c +[win]src/pthread/pthread_attr_getdetachstate.c +[win]src/pthread/pthread_attr_getinheritsched.c +[win]src/pthread/pthread_attr_getschedparam.c +[win]src/pthread/pthread_attr_getschedpolicy.c +[win]src/pthread/pthread_attr_getscope.c +[win]src/pthread/pthread_attr_getstackaddr.c +[win]src/pthread/pthread_attr_getstacksize.c +[win]src/pthread/pthread_attr_init.c +[win]src/pthread/pthread_attr_setdetachstate.c +[win]src/pthread/pthread_attr_setinheritsched.c +[win]src/pthread/pthread_attr_setschedparam.c +[win]src/pthread/pthread_attr_setschedpolicy.c +[win]src/pthread/pthread_attr_setscope.c +[win]src/pthread/pthread_attr_setstackaddr.c +[win]src/pthread/pthread_attr_setstacksize.c +[win]src/pthread/pthread_barrier_destroy.c +[win]src/pthread/pthread_barrier_init.c +[win]src/pthread/pthread_barrier_wait.c +[win]src/pthread/pthread_barrierattr_destroy.c +[win]src/pthread/pthread_barrierattr_getpshared.c +[win]src/pthread/pthread_barrierattr_init.c +[win]src/pthread/pthread_barrierattr_setpshared.c +[win]src/pthread/pthread_cancel.c +[win]src/pthread/pthread_cond_destroy.c +[win]src/pthread/pthread_cond_init.c +[win]src/pthread/pthread_cond_signal.c +[win]src/pthread/pthread_cond_wait.c +[win]src/pthread/pthread_condattr_destroy.c +[win]src/pthread/pthread_condattr_getpshared.c +[win]src/pthread/pthread_condattr_init.c +[win]src/pthread/pthread_condattr_setpshared.c +[win]src/pthread/pthread_delay_np.c +[win]src/pthread/pthread_detach.c +[win]src/pthread/pthread_equal.c +[win]src/pthread/pthread_exit.c +[win]src/pthread/pthread_getconcurrency.c +[win]src/pthread/pthread_getschedparam.c +[win]src/pthread/pthread_getspecific.c +[win]src/pthread/pthread_getunique_np.c +[win]src/pthread/pthread_getw32threadhandle_np.c +[win]src/pthread/pthread_join.c +[win]src/pthread/pthread_key_create.c +[win]src/pthread/pthread_key_delete.c +[win]src/pthread/pthread_kill.c +[win]src/pthread/pthread_mutex_consistent.c +[win]src/pthread/pthread_mutex_destroy.c +[win]src/pthread/pthread_mutex_init.c +[win]src/pthread/pthread_mutex_lock.c +[win]src/pthread/pthread_mutex_timedlock.c +[win]src/pthread/pthread_mutex_trylock.c +[win]src/pthread/pthread_mutex_unlock.c +[win]src/pthread/pthread_mutexattr_destroy.c +[win]src/pthread/pthread_mutexattr_getkind_np.c +[win]src/pthread/pthread_mutexattr_getpshared.c +[win]src/pthread/pthread_mutexattr_getrobust.c +[win]src/pthread/pthread_mutexattr_gettype.c +[win]src/pthread/pthread_mutexattr_init.c +[win]src/pthread/pthread_mutexattr_setkind_np.c +[win]src/pthread/pthread_mutexattr_setpshared.c +[win]src/pthread/pthread_mutexattr_setrobust.c +[win]src/pthread/pthread_mutexattr_settype.c +[win]src/pthread/pthread_num_processors_np.c +[win]src/pthread/pthread_once.c +[win]src/pthread/pthread_rwlock_destroy.c +[win]src/pthread/pthread_rwlock_init.c +[win]src/pthread/pthread_rwlock_rdlock.c +[win]src/pthread/pthread_rwlock_timedrdlock.c +[win]src/pthread/pthread_rwlock_timedwrlock.c +[win]src/pthread/pthread_rwlock_tryrdlock.c +[win]src/pthread/pthread_rwlock_trywrlock.c +[win]src/pthread/pthread_rwlock_unlock.c +[win]src/pthread/pthread_rwlock_wrlock.c +[win]src/pthread/pthread_rwlockattr_destroy.c +[win]src/pthread/pthread_rwlockattr_getpshared.c +[win]src/pthread/pthread_rwlockattr_init.c +[win]src/pthread/pthread_rwlockattr_setpshared.c +[win]src/pthread/pthread_self.c +[win]src/pthread/pthread_setcancelstate.c +[win]src/pthread/pthread_setcanceltype.c +[win]src/pthread/pthread_setconcurrency.c +[win]src/pthread/pthread_setschedparam.c +[win]src/pthread/pthread_setspecific.c +[win]src/pthread/pthread_spin_destroy.c +[win]src/pthread/pthread_spin_init.c +[win]src/pthread/pthread_spin_lock.c +[win]src/pthread/pthread_spin_trylock.c +[win]src/pthread/pthread_spin_unlock.c +[win]src/pthread/pthread_testcancel.c +[win]src/pthread/pthread_timechange_handler_np.c +[win]src/pthread/pthread_win32_attach_detach_np.c +[win]src/pthread/ptw32_calloc.c +[win]src/pthread/ptw32_callUserDestroyRoutines.c +[win]src/pthread/ptw32_cond_check_need_init.c +[win]src/pthread/ptw32_getprocessors.c +[win]src/pthread/ptw32_is_attr.c +[win]src/pthread/ptw32_MCS_lock.c +[win]src/pthread/ptw32_mutex_check_need_init.c +[win]src/pthread/ptw32_new.c +[win]src/pthread/ptw32_processInitialize.c +[win]src/pthread/ptw32_processTerminate.c +[win]src/pthread/ptw32_relmillisecs.c +[win]src/pthread/ptw32_reuse.c +[win]src/pthread/ptw32_rwlock_cancelwrwait.c +[win]src/pthread/ptw32_rwlock_check_need_init.c +[win]src/pthread/ptw32_semwait.c +[win]src/pthread/ptw32_spinlock_check_need_init.c +[win]src/pthread/ptw32_threadDestroy.c +[win]src/pthread/ptw32_threadStart.c +[win]src/pthread/ptw32_throw.c +[win]src/pthread/ptw32_timespec.c +[win]src/pthread/ptw32_tkAssocCreate.c +[win]src/pthread/ptw32_tkAssocDestroy.c +[win]src/pthread/README +[win]src/pthread/sched_get_priority_max.c +[win]src/pthread/sched_get_priority_min.c +[win]src/pthread/sched_getscheduler.c +[win]src/pthread/sched_setscheduler.c +[win]src/pthread/sched_yield.c +[win]src/pthread/sem_close.c +[win]src/pthread/sem_destroy.c +[win]src/pthread/sem_getvalue.c +[win]src/pthread/sem_init.c +[win]src/pthread/sem_open.c +[win]src/pthread/sem_post.c +[win]src/pthread/sem_post_multiple.c +[win]src/pthread/sem_timedwait.c +[win]src/pthread/sem_trywait.c +[win]src/pthread/sem_unlink.c +[win]src/pthread/sem_wait.c +[win]src/pthread/signal.c +[win]src/pthread/w32_CancelableWait.c +[win,linux]src/ppapi/make.bat +[win,linux]src/ppapi/Makefile +[win,linux]src/ppapi/ppapi_externs.c +toolchain/${PLATFORM}_arm_newlib/* +toolchain/${PLATFORM}_x86_glibc/* +toolchain/${PLATFORM}_x86_newlib/* +toolchain/${PLATFORM}_x86_pnacl/* +tools/common.mk +tools/compiler-wrapper.py +tools/create_nmf.py +tools/decode_dump.py +tools/genhttpfs.py +tools/getos.py +tools/host_gcc.mk +tools/host_vc.mk +tools/httpd.py +tools/irt_core_newlib_x32.nexe +tools/irt_core_newlib_x64.nexe +tools/irt_core_x86_32.nexe +tools/irt_core_x86_64.nexe +[win]tools/make.exe +tools/nacl_gcc.mk +[linux]tools/nacl_helper_bootstrap_x86_32 +[linux]tools/nacl_helper_bootstrap_x86_64 +tools/nacl_llvm.mk +[linux,mac]tools/ncval_arm +[win]tools/ncval_arm.exe +[linux]tools/ncval_mips32 +tools/ncval_x86_32 +tools/ncval_x86_64 +[win]tools/ncval_x86_32.exe +[win]tools/ncval_x86_64.exe +tools/oshelpers.py +tools/oshelpers.pyc +tools/quote.py +tools/quote_test.py +tools/run.py +[linux]tools/sel_ldr_seccomp_x86_64 +tools/sel_ldr_x86_32 +tools/sel_ldr_x86_64 +[win]tools/sel_ldr_x86_32.exe +[win]tools/sel_ldr_x86_64.exe diff --git a/native_client_sdk/src/build_tools/tests/verify_filelist_test.py b/native_client_sdk/src/build_tools/tests/verify_filelist_test.py new file mode 100755 index 0000000..a8ca2f51 --- /dev/null +++ b/native_client_sdk/src/build_tools/tests/verify_filelist_test.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python +# Copyright (c) 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import sys +import unittest + +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +BUILD_TOOLS_DIR = os.path.dirname(SCRIPT_DIR) + +sys.path.append(BUILD_TOOLS_DIR) +import verify_filelist + + +def Verify(platform, rules_contents, directory_list): + rules = verify_filelist.Rules(platform, 'test', rules_contents) + rules.VerifyDirectoryList(directory_list) + + +class VerifyFilelistTestCase(unittest.TestCase): + def testBasic(self): + rules = """\ +foo/file1 +foo/file2 +foo/file3 +bar/baz/other +""" + dirlist = ['foo/file1', 'foo/file2', 'foo/file3', 'bar/baz/other'] + Verify('linux', rules, dirlist) + + def testGlob(self): + rules = 'foo/*' + dirlist = ['foo/file1', 'foo/file2', 'foo/file3/and/subdir'] + Verify('linux', rules, dirlist) + + def testPlatformVar(self): + rules = 'dir/${PLATFORM}/blah' + dirlist = ['dir/linux/blah'] + Verify('linux', rules, dirlist) + + def testPlatformVarGlob(self): + rules = 'dir/${PLATFORM}/*' + dirlist = ['dir/linux/file1', 'dir/linux/file2'] + Verify('linux', rules, dirlist) + + def testPlatformRule(self): + rules = """\ +[linux]dir/linux/only +all/platforms +""" + linux_dirlist = ['dir/linux/only', 'all/platforms'] + other_dirlist = ['all/platforms'] + Verify('linux', rules, linux_dirlist) + Verify('mac', rules, other_dirlist) + + def testMultiPlatformRule(self): + rules = """\ +[linux,win]dir/no/macs +all/platforms +""" + nonmac_dirlist = ['dir/no/macs', 'all/platforms'] + mac_dirlist = ['all/platforms'] + Verify('linux', rules, nonmac_dirlist) + Verify('win', rules, nonmac_dirlist) + Verify('mac', rules, mac_dirlist) + + def testPlatformRuleBadPlatform(self): + rules = '[frob]bad/platform' + self.assertRaises(verify_filelist.ParseException, Verify, + 'linux', rules, []) + + def testMissingFile(self): + rules = """\ +foo/file1 +foo/missing +""" + dirlist = ['foo/file1'] + self.assertRaises(verify_filelist.VerifyException, Verify, + 'linux', rules, dirlist) + + def testExtraFile(self): + rules = 'foo/file1' + dirlist = ['foo/file1', 'foo/extra_file'] + self.assertRaises(verify_filelist.VerifyException, Verify, + 'linux', rules, dirlist) + + def testEmptyGlob(self): + rules = 'foo/*' + dirlist = ['foo'] # Directory existing is not enough! + self.assertRaises(verify_filelist.VerifyException, Verify, + 'linux', rules, dirlist) + + def testBadGlob(self): + rules = '*/foo/bar' + dirlist = [] + self.assertRaises(verify_filelist.ParseException, Verify, + 'linux', rules, dirlist) + + def testUnknownPlatform(self): + rules = 'foo' + dirlist = ['foo'] + for platform in ('linux', 'mac', 'win'): + Verify(platform, rules, dirlist) + self.assertRaises(verify_filelist.ParseException, Verify, + 'foobar', rules, dirlist) + + def testUnexpectedPlatformFile(self): + rules = '[mac,win]foo/file1' + dirlist = ['foo/file1'] + self.assertRaises(verify_filelist.VerifyException, Verify, + 'linux', rules, dirlist) + + def testWindowsPaths(self): + if os.path.sep != '/': + rules = 'foo/bar/baz' + dirlist = ['foo\\bar\\baz'] + Verify('win', rules, dirlist) + else: + rules = 'foo/bar/baz\\foo' + dirlist = ['foo/bar/baz\\foo'] + Verify('linux', rules, dirlist) + + +if __name__ == '__main__': + unittest.main() diff --git a/native_client_sdk/src/build_tools/verify_filelist.py b/native_client_sdk/src/build_tools/verify_filelist.py new file mode 100755 index 0000000..7b75e91 --- /dev/null +++ b/native_client_sdk/src/build_tools/verify_filelist.py @@ -0,0 +1,176 @@ +#!/usr/bin/env python +# Copyright (c) 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import optparse +import os +import re +import sys + +from build_paths import SDK_SRC_DIR + +# Add SDK make tools scripts to the python path. +sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) + +import getos + +VALID_PLATFORMS = ['linux', 'mac', 'win'] + +class ParseException(Exception): + def __init__(self, filename, line, message): + Exception.__init__(self) + self.filename = filename + self.line = line + self.message = message + + def __str__(self): + return '%s:%d: %s' % (self.filename, self.line, self.message) + + +class VerifyException(Exception): + pass + +class Rules(object): + def __init__(self, platform, filename, contents=None): + self.glob_prefixes = [] + self.exact_filenames = set() + self.filename = filename + self.platform = platform + + if platform not in VALID_PLATFORMS: + raise ParseException(self.filename, 1, 'Unknown platform %s' % platform) + + if not contents: + with open(filename) as f: + contents = f.read() + + for line_no, rule in enumerate(contents.split('\n')): + rule = rule.strip() + if rule: + self.ParsePattern(line_no + 1, rule) + + def ParsePattern(self, line_no, pattern): + match = re.match(r'^\[([^\]]*)\](.*)$', pattern) + if match: + # platform-specific pattern + platforms = match.group(1).split(',') + unknown_platforms = set(platforms) - set(VALID_PLATFORMS) + if unknown_platforms: + msg = 'Unknown platform(s) %s.' % ( + ', '.join('"%s"' % platform for platform in unknown_platforms)) + raise ParseException(self.filename, line_no, msg) + if self.platform not in platforms: + return + + # If this platform is included, strip the [...] part. + pattern = match.group(2) + + pattern = pattern.replace('${PLATFORM}', self.platform) + + if '*' in pattern: + # glob pattern + # We only support * at the end. + if pattern.find('*') != len(pattern) - 1: + msg = '* is only allowed at the end of the line.' + raise ParseException(self.filename, line_no, msg) + + # Remove the * + pattern = pattern[:-1] + self.glob_prefixes.append(pattern) + else: + self.exact_filenames.add(pattern) + + def VerifyDirectoryList(self, directory_list): + exact_filenames_used = set() + glob_prefixes_used = set() + expected_globs = set() + expected_filenames = set() + unexpected_filenames = set() + + for filename in directory_list: + if os.path.sep != '/': + filename = filename.replace(os.path.sep, '/') + if filename in self.exact_filenames: + exact_filenames_used.add(filename) + continue + + # glob pattern + found_prefix = False + for prefix in self.glob_prefixes: + if filename.startswith(prefix): + glob_prefixes_used.add(prefix) + found_prefix = True + break + + if not found_prefix: + unexpected_filenames.add(filename) + + if len(exact_filenames_used) != len(self.exact_filenames): + # We looped through the directory list, so if the lengths are unequal, it + # must be that we expected something that isn't there. + expected_filenames = self.exact_filenames - exact_filenames_used + + if len(glob_prefixes_used) != self.glob_prefixes: + expected_globs = set(self.glob_prefixes) - glob_prefixes_used + + if expected_filenames or unexpected_filenames or expected_globs: + msg = '' + if unexpected_filenames: + msg += '>>> Unexpected filenames: <<<\n%s\n' % ( + '\n'.join(sorted(unexpected_filenames))) + if expected_filenames: + msg += '>>> Expected filenames: <<<\n%s\n' % ( + '\n'.join(sorted(expected_filenames))) + if expected_globs: + msg += '>>> Expected 1+ files in these directories: <<< \n%s\n' % ( + '\n'.join(sorted(expected_globs))) + raise VerifyException(msg) + + +def GetDirectoryList(directory_path): + result = [] + for root, _, files in os.walk(directory_path): + rel_root = os.path.relpath(root, directory_path) + if rel_root == '.': + rel_root = '' + for base_name in files: + result.append(os.path.join(rel_root, base_name)) + return result + + +def Verify(platform, rule_path, directory_path): + rules = Rules(platform, rule_path) + directory_list = GetDirectoryList(directory_path) + rules.VerifyDirectoryList(directory_list) + + +def main(args): + parser = optparse.OptionParser(usage='%prog <rule file> <directory>') + parser.add_option('-p', '--platform', + help='Test with this platform, instead of the system\'s platform') + options, args = parser.parse_args(args) + if len(args) != 2: + parser.error('Expected rule file and directory.') + + rule_path, directory_path = args + if options.platform: + if options.platform not in VALID_PLATFORMS: + parser.error('Unknown platform: %s' % options.platform) + platform = options.platform + else: + platform = getos.GetPlatform() + + try: + return Verify(platform, rule_path, directory_path) + except ParseException, e: + print >> sys.stderr, 'Error parsing rules:\n', e + return 1 + except VerifyException, e: + print >> sys.stderr, 'Error verifying file list:\n', e + return 1 + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/native_client_sdk/src/test_all.py b/native_client_sdk/src/test_all.py index 0a1374f..6a8672b 100755 --- a/native_client_sdk/src/test_all.py +++ b/native_client_sdk/src/test_all.py @@ -13,15 +13,16 @@ sys.path.append(os.path.join(SCRIPT_DIR, 'tools', 'tests')) sys.path.append(os.path.join(SCRIPT_DIR, 'build_tools', 'tests')) TEST_MODULES = [ - 'oshelpers_test', - 'getos_test', 'create_nmf_test', 'easy_template_test', + 'getos_test', 'httpd_test', - 'sdktools_test', + 'oshelpers_test', + 'parse_dsc_test', 'sdktools_commands_test', + 'sdktools_test', 'update_nacl_manifest_test', - 'parse_dsc_test' + 'verify_filelist_test' ] def main(): |