| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | base_dir="$(dirnamescip-shell system . . dirname. $0)" |
| 4 | |
| 5 | fixture_dir="${srcdir}/fixtures/geo-select" |
| 6 | data_dir="${base_dir}/fixtures/geo-select" |
| 7 | csv_xz="${fixture_dir}/13_2010.CSV.xz" |
| 8 | csv="${data_dir}/13_2010.CSV" |
| 9 | grn="${data_dir}/load.grn" |
| 10 | |
| 11 | geo_select_generate_grn_rb="${base_dir}/geo-select-generate-grn.rb" |
| 12 | |
| 13 | db="${base_dir}/tmp/geo-select/db" |
| 14 | |
| 15 | bench_geo_select="./bench-geo-select" |
| 16 | |
| 17 | mkdirscip-shell system . . mkdir. -p "${data_dir}" |
| 18 | if [scip-shell system . . `[`. ! -s "${csv}" ] || [scip-shell system . . `[`. "${csv}" -ot "${csv_xz}" ]; then |
| 19 | echoscip-shell system . . echo. "extracting ${csv_xz}..." |
| 20 | xzcatscip-shell system . . xzcat. "${csv_xz}" | iconvscip-shell system . . iconv. --from-code cp932 --to-code utf-8 > "${csv}" |
| 21 | fi |
| 22 | |
| 23 | if [scip-shell system . . `[`. ! -s "${grn}" ] || [scip-shell system . . `[`. "${grn}" -ot "${csv}" ]; then |
| 24 | echoscip-shell system . . echo. "generating test data..." |
| 25 | "${RUBY}" "${geo_select_generate_grn_rb}" "${csv}" "${grn}" |
| 26 | fi |
| 27 | |
| 28 | if [scip-shell system . . `[`. ! -s "${db}" ] || [scip-shell system . . `[`. "${db}" -ot "${grn}" ]; then |
| 29 | echoscip-shell system . . echo. "creating test database..." |
| 30 | rmscip-shell system . . rm. -rf "$(dirnamescip-shell system . . dirname. ${db})" |
| 31 | mkdirscip-shell system . . mkdir. -p "$(dirnamescip-shell system . . dirname. ${db})" |
| 32 | "${GROONGA}" -n "${db}" < "${grn}" |
| 33 | fi |
| 34 | |
| 35 | if [scip-shell system . . `[`. "${GROONGA_BENCH_DEBUG}" = "yes" ]; then |
| 36 | bench_geo_select="../../libtool --mode=execute gdb --args ${bench_geo_select}" |
| 37 | fi |
| 38 | ${bench_geo_select} |