← Back to team overview

drizzle-discuss team mailing list archive

Code that needs testing

 

So... I started looking through bits for testing that needed doing.

Some things are easy to add tests for (and adding a breakpoint at the
appropriate line of code to find out if you're doing it right). e.g.
ranges of valid/invalid values, conversion from one type to another.

Some things are harder to create tests for (e.g. each point testing
for session->killed will require fault injection).

Sorry the notes are rather technical and directed at source code.
There is a bunch of stuff that could be dead code, but would require
some grepping and tracing through to ensure that's the case (perhaps
it's a sign of good untested code :)

Brian has a higher level list that encompases some of this that Lee or
Brian will be posting soon (e.g. nicely formatted).

But if anyone wants some low hanging fruit tasks... perhasp give some
of this a go.

certainly examine the bits here with the lcov output to compare and
contrast).

one of the best ones is going to be creating a CREATE TABLE with an
ENUM with 99999 possible values :)

BLOBs
- random testing
- limits
- cross platform
- pack_key
- is_equal

DATE
- #ifdef NOTDEFINED (should go?)
- Field_date::store(double)
- store_time::DRIZZLE_TIME* error conditions
- including warnings

DATETIME
- ::store(double)
- storing invalid time. (assert?)
- val_real() ?

DECIMAL
- overflow (store(my_decimal))
- ::store(char* from) E_DEC_OVERFLOW
- E_DEC_BAD_NUM (only tested *once*)
- ::store(double)
- ::store(int64) - error conditions
- ::store(time)
- val-int
- cmp
- do_save_field_metadata?
- pack_length_from_metadata?
- compatible_field_size?
- is_equal
- ::unpack() where param_data != 0

DOUBLE
- ::store(char*) with ER_WARN_DATA_OUT_OF_RANGE
- val_int
- cmp()
- do_save_field_metadtaa

ENUM
- key_type()
- store_type() (needs refactoring)
- ::store(char*) (from LOAD DATA INFILE). error conditions
        - especially "more than 99999 enums"
- general limits around number of items in enum
- ::store(double)
- ::store(int64) with invalid numbers
- ::val_int (needs cleanup)
- generally needs to be cleaned up to 4byte numbers only.
- do_save_field_metadata
- ::val_str and some error conditions
- ::sort_string

BIGINT
- error conditions in ::store(char*)
- ::store(double) and error conditions
- ::val_real()

LONG
- error conditions in ::store(double)

NULL
- sql_type? 
- is this used? where? why?

Field_num
- error conditions in check_int
- some error conditions in get_int
- is_equal

REAL
- pack
- unpack
- truncate (error conds)

Field_str
- report_if_important_data error conds
- ::val_decimal()
- ::store(double) error conds
- compare_str_field_flags
- is_equal
- check_string_copy_error various conditions
- max_data_length


Field:timestamp
- ::Filed_timestamp()
- get_auto_set_type
- probably an indication that auto set timestamp columns not tested
well
- TIMESTAMP_OLD_FIELD (dead?)
- ::store(char*) with invalid timestamp
- ::store(double)
- ::store(int64) with invalid timestamp
- ::get_date with... well... anything.
- ::get_time(DRIZZLE_TIME*)
- ::get_timestamp

field_varstring
- val_decimal()
- ::data_length()
- pack_key
- unpack_key
- pack_key_from_key_image
- pack_cmp
- get_key_image
- is_equal

drizzled/
- AlterInfo methods (should just go)

- Cached_item_int::cmp()
- Cached_item_decimal()

calendar.cc

CreateField
- CreateField::init_for_tmp_table (because that whole code path is
utter cock)
- CreateField::init for decimals, doubles that are too big
        - and M > D
        - and too big precision
- CreateField::init for BLOB with default value
- possibly ER_WRONG_FIELD_SPEC at end of CreateField::init

Cursor
- clone() (should probably die a horrible death. called *SEVEN* times
only)
- ::change_table_ptr (not called much)
- ha_data() (remove?)
- ::ha_open() error conditions
- rnd_pos_by_record() - is unused
- ::read_first_row (why does tihs exist?) onl 626 times and comment on
InnoDB
- and read first row through pkey only called once
- auto_increment_increment and auto_increment_offset (as looked at in
compute_next_insert_id)
- prev_insert_id (unused?)
- reserving autoinc failure modes
- especially error on ::store() in update_auto_increment()
- ::get_auto_increment
- ::drop_table(char*) which calls close().... probably that horrible
heap thing for temp tables?
- ::ha_bulk_update_row()
- ha_discard_or_import_tablespace (only called *once*)
- errors ending transaction
- ::index_next_same() with ptrdiff, key_cmp_if_same
- ::multi_range_read_info_const with killed session
- in fact, *all* session->killed usage
- ::compare_key2()
        - Insane Clown Posse comes back to haunt us
- ::log_row_for_replication with different SQLCOM_ statements
and failure modes

db.cc
- invalid charset in proto
- errors creating db, storing things etc.
- mysql_alter_db

drizzled.cc
- segfaulting and backtrace and demangling
- Parameters:
        - C
        - L
        - V
        - W
        - T
- skip stack trace
- skip symlinks
- bind address
- tx isolation
- option_error reporter
- my_load_path with drizzle_home

- xid
- tztime
- temporal.cc



Session
- set_session_proc_info
- get_session_proc_info
        -      253            1906 :   if (variables.max_join_size ==
HA_POS_ERROR)
- push_internal_handler
- session_alloc
- session_strmake
- ::awake()
- ::checkUser
- executeStatement() packet==0 and stuff
- endTransaction() - COMMIT
- list_include
- add_changed_table
- changed_table_dup
- select_to_file
- create_file!!!!?????
- select_dump ??
- maxmin finder cmp_real and cmp_str
- set_status_var_init()
- session_killed()
- session_non_transactional_update
- mark_transaction_to_rollback
-  Session::disconnect() for unauthenticated
- closing temporary tables in *some* codepaths.... *possibly* okay
- mark_used_tables_as_free_for_reuse
- Session::rm_temporary_table
        - and with a path, an error condition!


-- 
Stewart Smith