[GSOC] Data model unit testing

Christian Stimming stimming at tuhh.de
Fri Apr 1 03:12:15 EDT 2011


Zitat von John Ralls <jralls at ceridwen.us>:
>> I estimate the effort in the following way:
>> (AVG_of_branching * number_of_functions *  
>> time_to_test_one_branch_in_minutes)/(minutes_in_hour *  
>> number_of_working_days).
>> Avg of branching in function is something that i get by dividing  
>> code complexity number (3729) by number of functions, (...)
>
> Like I said, you're the only one at this point who knows how fast  
> you can code. But your calculations are a bit, um, overly precise.

I agree with John on the "overly precise" bit. However, I don't think  
this is a problem at this point in time at all.

For your project we can simply confirm that the goal of "full unittest  
coverage of all of libqof" is too ambitious for GSoC. Doing the  
complexity estimations is one out of several useful ways to tell up  
front whether the task can or cannot be done, and it is also a valid  
part of such a GSoC project. Thanks for the numbers :-)

I agree with John that you should pick a useful subset of libqof, and  
this way, the project will surely fit inside GSoC again.

As for how to find the "useful subset": I've created a list of  
libqof's symbols which are used from the rest of gnucash (attached)  
with usage count. This list of used symbols has 346 entries, whereas  
the list of libqof's exported symbols contains 524 entries. This is  
already a strong indication that libqof might contains 524-352=172  
functions which are unused throughout gnucash. Following my remarks in  
my last message I'd say almost all of those 176 unused functions  
should be removed anyway, which means your project size might already  
reduce into useful ranges.

Note: I've done this for *symbols*. A symbol corresponds to an  
exported function. The libqof code might provide more functions to the  
rest of gnucash which are still used but are not a symbol. For  
example, all macros and all enums are provided to the rest of gnucash  
but are not symbols. Similar for inline functions even though I don't  
know whether we actually use those. The details for my research is  
shown below.

For now, I'd propose you should go ahead in writing up your  
application, and we can just confirm we will find a useful subset of  
libqof to be covered that will be doable within GSoC.

Regards,

Christian


# Create list of symbols exported from libqof in file "exportedsymbols"
nm -A src/libqof/qof/.libs/libgnc-qof.so  | grep ' T ' > exportedsymbols

# Find all non-libqof binaries of gnucash
L=`find . -name '*.so' | grep -v libgnc-qof`
L="$L src/bin/.libs/gnucash"

# For each other binary, lookup the imported (unresolved) symbols, grep those
# that are from libqof, then sort the resulting list and count by occurrence
for A in $L ; do   nm $A | grep ' U ' |   sed 's/^.* \([^ ]*\)$/\1/' |  
grep -wFf- exportedsymbols |   cut -d: -f2 ; done | sort | uniq -c |  
sort -nr > all-qof-usage

-------------- next part --------------
     20  qof_log_prettify
     17  qof_log_indent
     17  qof_log_dedent
     17  qof_log_check
     15  safe_strcmp
     13  qof_instance_get_type
     10  qof_entity_get_guid
     10  gnc_numeric_zero_p
      9  qof_query_run
      9  qof_query_destroy
      9  gnc_numeric_neg
      8  qof_query_set_book
      8  qof_query_create_for
      8  qof_instance_get_slots
      8  kvp_value_get_guid
      8  guid_null
      8  gnc_numeric_add
      8  gnc_numeric_abs
      7  qof_book_get_slots
      7  qof_book_get_collection
      7  gnc_numeric_sub
      7  gnc_numeric_convert
      6  string_to_guid
      6  qof_session_get_book
      6  qof_query_set_sort_order
      6  qof_query_copy
      6  qof_print_date
      6  qof_instance_get_guid
      6  qof_instance_get_book
      6  qof_collection_lookup_entity
      6  kvp_value_new_guid
      6  kvp_value_get_string
      6  kvp_frame_get_slot_path
      6  guid_to_string
      6  gnc_numeric_to_double
      6  gnc_numeric_negative_p
      6  gnc_numeric_mul
      6  gnc_numeric_equal
      6  gnc_numeric_check
      6  double_to_gnc_numeric
      5  timespecFromTime_t
      5  string_to_gnc_numeric
      5  qof_strftime
      5  qof_query_set_sort_increasing
      5  qof_query_merge
      5  qof_query_add_term
      5  qof_event_suspend
      5  qof_event_resume
      5  kvp_value_delete
      5  guid_to_string_buff
      5  guid_equal
      5  gnc_timet_get_today_end
      5  gnc_print_date
      5  gnc_numeric_to_string
      5  gnc_numeric_positive_p
      5  gnc_numeric_compare
      4  qof_query_string_predicate
      4  qof_query_set_max_results
      4  qof_query_get_books
      4  qof_query_date_predicate
      4  qof_query_build_param_list
      4  qof_query_add_guid_match
      4  qof_query_add_boolean_match
      4  qof_instance_set_guid
      4  qof_instance_get_dirty
      4  qof_event_register_handler
      4  qof_collection_foreach
      4  qof_book_mark_saved
      4  qof_backend_set_error
      4  kvp_value_new_string
      4  kvp_value_new_numeric
      4  kvp_value_new_gint64
      4  kvp_value_get_numeric
      4  kvp_value_get_gint64
      4  kvp_value_get_frame
      4  kvp_frame_set_slot_path
      4  kvp_frame_set_slot_nc
      4  kvp_frame_new
      4  guid_malloc
      4  guid_free
      4  gnc_timet_get_today_start
      4  gnc_numeric_div
      4  gnc_dmy2timespec
      3  timespecToTime_t
      3  timespec_equal
      3  timespecCanonicalDayTime
      3  qof_session_save
      3  qof_session_load
      3  qof_session_get_url
      3  qof_session_destroy
      3  qof_scan_date
      3  qof_query_purge_terms
      3  qof_query_guid_predicate
      3  qof_query_get_search_for
      3  qof_query_create
      3  qof_print_date_dmy_buff
      3  qof_object_foreach
      3  qof_log_set_level
      3  qof_instance_set_slots
      3  qof_instance_get_destroying
      3  qof_instance_get_collection
      3  qof_event_unregister_handler
      3  qof_collection_count
      3  qof_book_new
      3  qof_book_get_data
      3  qof_book_get_backend
      3  kvp_value_new_timespec
      3  kvp_value_new_glist_nc
      3  kvp_value_new_gdate
      3  kvp_value_new_double
      3  kvp_value_get_type
      3  kvp_value_get_timespec
      3  kvp_value_get_glist
      3  kvp_value_get_gdate
      3  kvp_value_get_double
      3  kvp_frame_set_string
      3  kvp_frame_get_string
      3  kvp_frame_get_gint64
      3  kvp_frame_for_each_slot
      3  gnc_tm_get_today_start
      3  gnc_timet_get_day_end
      3  gnc_timespec_to_iso8601_buff
      3  gnc_numeric_error
      3  gnc_num_dbg_to_string
      3  gnc_iso8601_to_timespec_gmt
      2  xaccDateUtilGetStampNow
      2  timespec_cmp
      2  qof_util_string_cache_remove
      2  qof_util_string_cache_insert
      2  qof_session_new
      2  qof_session_get_error
      2  qof_session_begin
      2  qof_query_term_is_inverted
      2  qof_query_term_get_pred_data
      2  qof_query_term_get_param_path
      2  qof_query_search_for
      2  qof_query_numeric_predicate
      2  qof_query_merge_in_place
      2  qof_query_invert
      2  qof_query_int64_predicate
      2  qof_query_has_terms
      2  qof_query_get_terms
      2  qof_query_double_predicate
      2  qof_query_core_to_string
      2  qof_query_char_predicate
      2  qof_query_boolean_predicate
      2  qof_print_gdate
      2  qof_object_register_backend
      2  qof_object_get_type_label
      2  qof_object_foreach_backend
      2  qof_log_set_default
      2  qof_instance_set_dirty
      2  qof_instance_mark_clean
      2  qof_instance_guid_compare
      2  qof_instance_get_infant
      2  qof_instance_get_display_name
      2  qof_instance_get_dirty_flag
      2  qof_event_gen
      2  qof_date_format_get_string
      2  qof_commit_edit
      2  qof_class_get_parameter_getter
      2  qof_class_get_parameter
      2  qof_book_shutting_down
      2  qof_book_set_data_fin
      2  qof_book_not_saved
      2  qof_book_kvp_changed
      2  qof_book_get_type
      2  qof_begin_edit
      2  qof_backend_get_registered_access_method_list
      2  qof_backend_get_error
      2  null_strcmp
      2  kvp_value_new_frame
      2  kvp_frame_to_string
      2  kvp_frame_set_value_nc
      2  kvp_frame_set_slot
      2  kvp_frame_set_guid
      2  kvp_frame_set_frame_nc
      2  kvp_frame_get_slot
      2  kvp_frame_get_guid
      2  kvp_frame_get_frame_slash
      2  kvp_frame_delete
      2  guid_new_return
      2  guid_compare
      2  gnc_strisnum
      2  gnc_numeric_to_decimal
      2  gnc_numeric_same
      2  gnc_numeric_reduce
      2  gnc_numeric_errorCode_to_string
      2  gnc_dow_abbrev
      2  gnc_date_string_to_dateformat
      2  dateSeparator
      1  timespec_to_gdate
      1  timespec_now
      1  timespec_get_type
      1  timespec_diff
      1  timespec_abs
      1  qof_string_number_compare_func
      1  qof_set_alt_dirty_mode
      1  qof_session_swap_data
      1  qof_session_save_in_progress
      1  qof_session_safe_save
      1  qof_session_process_events
      1  qof_session_pop_error
      1  qof_session_get_error_message
      1  qof_session_export
      1  qof_session_events_pending
      1  qof_session_ensure_all_data_loaded
      1  qof_session_call_close_hooks
      1  qof_session_add_book
      1  qof_query_sort_get_sort_options
      1  qof_query_sort_get_param_path
      1  qof_query_sort_get_increasing
      1  qof_query_shutdown
      1  qof_query_set_sort_options
      1  qof_query_run_subquery
      1  qof_query_print
      1  qof_query_num_terms
      1  qof_query_last_run
      1  qof_query_kvp_predicate_path
      1  qof_query_kvp_predicate
      1  qof_query_int32_predicate
      1  qof_query_init
      1  qof_query_has_term_type
      1  qof_query_get_term_type
      1  qof_query_get_sorts
      1  qof_query_get_max_results
      1  qof_query_equal
      1  qof_query_date_predicate_get_date
      1  qof_query_core_predicate_free
      1  qof_query_core_predicate_copy
      1  qof_query_collect_predicate
      1  qof_query_clear
      1  qof_query_choice_predicate
      1  qof_query_add_guid_list_match
      1  qof_print_date_buff
      1  qof_object_register
      1  qof_object_printable
      1  qof_object_lookup_backend
      1  qof_object_foreach_sorted
      1  qof_log_shutdown
      1  qof_log_parse_log_config
      1  qof_log_level_from_string
      1  qof_log_init_filename_special
      1  qof_log_init_filename
      1  qof_log_init
      1  qof_load_backend_library
      1  qof_instance_version_cmp
      1  qof_instance_set_idata
      1  qof_instance_set_destroying
      1  qof_instance_set_book
      1  qof_instance_reset_editlevel
      1  qof_instance_lookup_twin
      1  qof_instance_init_data
      1  qof_instance_increase_editlevel
      1  qof_instance_get_referring_object_list_from_collection
      1  qof_instance_get_referring_object_list
      1  qof_instance_get_editlevel
      1  qof_instance_gemini
      1  qof_instance_decrease_editlevel
      1  qof_instance_copy_version_check
      1  qof_instance_copy_version
      1  qof_instance_copy_guid
      1  qof_instance_copy_book
      1  qof_instance_books_equal
      1  qof_init
      1  qof_get_alt_dirty_mode
      1  qof_date_text_format_get_string
      1  qof_date_format_set
      1  qof_date_format_get
      1  qof_date_completion_set
      1  qof_commit_edit_part2
      1  qof_collection_set_data
      1  qof_collection_new
      1  qof_collection_mark_dirty
      1  qof_collection_mark_clean
      1  qof_collection_is_dirty
      1  qof_collection_insert_entity
      1  qof_collection_get_type
      1  qof_collection_get_data
      1  qof_collection_add_entity
      1  qof_close
      1  qof_class_register
      1  qof_class_get_parameter_setter
      1  qof_choice_create
      1  qof_choice_add_class
      1  qof_book_use_trading_accounts
      1  qof_book_set_string_option
      1  qof_book_set_dirty_cb
      1  qof_book_set_data
      1  qof_book_set_backend
      1  qof_book_mark_readonly
      1  qof_book_mark_dirty
      1  qof_book_mark_closed
      1  qof_book_is_readonly
      1  qof_book_increment_and_format_counter
      1  qof_book_get_string_option
      1  qof_book_get_dirty_time
      1  qof_book_destroy
      1  qof_book_commit_edit
      1  qof_book_begin_edit
      1  qof_backend_set_message
      1  qof_backend_register_provider
      1  qof_backend_init
      1  qof_backend_destroy
      1  kvp_value_new_glist
      1  kvp_value_new_frame_nc
      1  kvp_value_new_binary_nc
      1  kvp_value_get_binary
      1  kvp_glist_delete
      1  kvp_frame_set_value
      1  kvp_frame_set_timespec
      1  kvp_frame_set_slot_path_gslist
      1  kvp_frame_set_numeric
      1  kvp_frame_set_gint64
      1  kvp_frame_set_frame
      1  kvp_frame_replace_value_nc
      1  kvp_frame_is_empty
      1  kvp_frame_get_value
      1  kvp_frame_get_slot_path_gslist
      1  kvp_frame_get_numeric
      1  kvp_frame_get_hash
      1  kvp_frame_get_frame
      1  kvp_frame_copy
      1  kvp_frame_compare
      1  guid_new
      1  guid_hash_to_guint
      1  guid_hash_table_new
      1  guid_g_hash_table_equal
      1  gnc_timezone
      1  gnc_timet_get_day_start
      1  gnc_timespec_last_mday
      1  gnc_timespec2dmy
      1  gnc_numeric_sub_with_error
      1  gnc_numeric_mul_with_error
      1  gnc_numeric_get_type
      1  gnc_numeric_eq
      1  gnc_numeric_div_with_error
      1  gnc_numeric_add_with_error
      1  gnc_kvp_bag_remove_frame
      1  gnc_kvp_bag_merge
      1  gnc_kvp_bag_find_by_guid
      1  gnc_kvp_bag_add
      1  gnc_dmy2timespec_end
      1  gnc_date_string_to_monthformat
      1  gnc_date_my_last_mday
      1  gnc_date_monthformat_to_string
      1  gnc_date_dateformat_to_string
      1  g_hash_table_kv_pair_free_gfunc
      1  g_hash_table_key_value_pairs
      1  g_hash_table_foreach_sorted
      1  gdate_to_timespec
      1  binary_to_string


More information about the gnucash-devel mailing list