Add symlink force for unittest test_static_save_load (#29137)

* add symlink force for unittest

* open unittest
musl/disable_test_yolov3_temporarily
Chen Weihang 5 years ago committed by GitHub
parent 9cc0e72619
commit c39da29db7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -348,7 +348,6 @@ list(REMOVE_ITEM TEST_OPS test_imperative_static_runner_while)
# disable this unittest temporarily
list(REMOVE_ITEM TEST_OPS test_imperative_data_loader_exception)
list(REMOVE_ITEM TEST_OPS test_sampling_id_op)
list(REMOVE_ITEM TEST_OPS test_static_save_load)
if (APPLE OR WIN32)
list(REMOVE_ITEM TEST_OPS test_dataset)
@ -669,7 +668,7 @@ set_tests_properties(test_nearest_interp_v2_op PROPERTIES TIMEOUT 120)
set_tests_properties(test_trilinear_interp_op PROPERTIES TIMEOUT 120)
set_tests_properties(test_bicubic_interp_v2_op PROPERTIES TIMEOUT 120)
set_tests_properties(test_gather_op PROPERTIES TIMEOUT 120)
#set_tests_properties(test_static_save_load PROPERTIES TIMEOUT 120)
set_tests_properties(test_static_save_load PROPERTIES TIMEOUT 120)
set_tests_properties(test_imperative_selected_rows_to_lod_tensor PROPERTIES TIMEOUT 120)
set_tests_properties(test_index_select_op PROPERTIES TIMEOUT 120)
set_tests_properties(test_parallel_ssa_graph_inference_feed_partial_data PROPERTIES TIMEOUT 120)

@ -28,6 +28,7 @@ import numpy as np
import six
import pickle
import os
import errno
class SimpleLSTMRNN(fluid.Layer):
@ -1159,11 +1160,20 @@ class TestProgramStateOldSave(unittest.TestCase):
self.check_in_static(main_program, base_map)
# case 2: load with no need file
def symlink_force(target, link_name):
try:
os.symlink(target, link_name)
except OSError as e:
if e.errno == errno.EEXIST:
os.remove(link_name)
os.symlink(target, link_name)
else:
raise e
orig_filepath = './test_program_1/fc_0.w_0'
symlink_filepath = './test_program_1/link_fc_0.w_0'
if os.path.exists(symlink_filepath):
os.remove(symlink_filepath)
os.symlink(orig_filepath, symlink_filepath)
# create a needless link file for coverage
symlink_force(orig_filepath, symlink_filepath)
program_state = fluid.load_program_state("test_program_1")
fluid.set_program_state(main_program, program_state)
self.check_in_static(main_program, base_map)

Loading…
Cancel
Save