Permalink
Please sign in to comment.
Browse files
Enhance various test harnesses to prepare for release .
- Preparing to publish a log of test/osh2oil.sh
- Add osh-to-bash ratio in elapsed time table in the osh-parser
benchmark.
- Improve the unit test harness.
- 'all' now runs all the tests and stops at the first failure. No
logging.
- 'run-for-release' does the logging. Still need to check for
failure.
- Start of HTML table
- Factor out common.R so I can use it for test harnesses too.
Other:
- Delete shell function to reproduce non-deterministic CPython bug. It
was copied to ~/git/scratch.- Loading branch information...
Showing
with
197 additions
and 128 deletions.
- +55 −0 benchmarks/common.R
- +7 −48 benchmarks/report.R
- +7 −2 scripts/release.sh
- +1 −1 test/gold.sh
- +21 −1 test/osh2oil.sh
- +106 −76 test/unit.sh
| @@ -0,0 +1,55 @@ | ||
| #!/usr/bin/Rscript | ||
| # | ||
| # common.R - Shared R functions. | ||
| Log = function(fmt, ...) { | ||
| cat(sprintf(fmt, ...)) | ||
| cat('\n') | ||
| } | ||
| # Same precision for all columns. | ||
| SamePrecision = function(precision = 1) { | ||
| return(function(column_name) { | ||
| precision | ||
| }) | ||
| } | ||
| # Precision by column. | ||
| ColumnPrecision = function(precision_map, default = 1) { | ||
| return(function(column_name) { | ||
| p = precision_map[[column_name]] | ||
| if (is.null(p)) { | ||
| default | ||
| } else { | ||
| p | ||
| } | ||
| }) | ||
| } | ||
| # Write a CSV file along with a schema. | ||
| # | ||
| # precision: list(column name -> integer precision) | ||
| writeCsv = function(table, prefix, precision_func = NULL) { | ||
| data_out_path = paste0(prefix, '.csv') | ||
| write.csv(table, data_out_path, row.names = F) | ||
| getFieldType = function(field_name) { typeof(table[[field_name]]) } | ||
| if (is.null(precision_func)) { | ||
| precision_func = function(column_name) { 1 } | ||
| } | ||
| types_list = lapply(names(table), getFieldType) | ||
| precision_list = lapply(names(table), precision_func) | ||
| print(precision_list) | ||
| schema = data_frame( | ||
| column_name = names(table), | ||
| type = as.character(types_list), | ||
| precision = as.character(precision_list) | ||
| ) | ||
| schema_out_path = paste0(prefix, '.schema.csv') | ||
| write.csv(schema, schema_out_path, row.names = F) | ||
| } | ||
Oops, something went wrong.
0 comments on commit
588c9fb