okumin commented on code in PR #45: URL: https://github.com/apache/hive-site/pull/45#discussion_r2017960111
########## content/docs/latest/hivedeveloperfaq_27823747.md: ########## @@ -298,163 +250,7 @@ mvn test -Dtest.excludes.additional='**/Test*CliDriver.java' ### How do I run the clientpositive/clientnegative unit tests? -All of the below require that you have previously run `ant package`. - -To run clientpositive tests - -``` -cd itests/qtest -mvn test -Dtest=TestCliDriver -``` - -To run a single clientnegative test alter1.q - -``` -cd itests/qtest -mvn test -Dtest=TestNegativeCliDriver -Dqfile=alter1.q -``` - -To run all of the clientpositive tests that match a regex, for example the partition_wise_fileformat tests - -``` -cd itests/qtest -mvn test -Dtest=TestCliDriver -Dqfile_regex=partition_wise_fileformat.* - -# Alternatively, you can specify comma separated list with "-Dqfile" argument -mvn test -Dtest=TestMiniLlapLocalCliDriver -Dqfile='vectorization_0.q,vectorization_17.q,vectorization_8.q' -``` - -To run a single contrib test alter1.q and overwrite the result file - -``` -cd itests/qtest -mvn test -Dtest=TestContribCliDriver -Dqfile=alter1.q -Dtest.output.overwrite=true -``` - -### How do I run with Postgre/MySQL/Oracle? - -To run test test with a specified DB it is possible by adding "-Dtest.metastore.db" parameter like in the following commands: - -``` -mvn test -Pitests -pl itests/qtest -Dtest=TestCliDriver -Dqfile=partition_params_postgres.q -Dtest.metastore.db=postgres - -mvn test -Pitests -pl itests/qtest -Dtest=TestCliDriver -Dqfile=partition_params_postgres.q -Dtest.metastore.db=mssql -mvn test -Pitests -pl itests/qtest -Dtest=TestCliDriver -Dqfile=partition_params_postgres.q -Dtest.metastore.db=mysql -mvn test -Pitests -pl itests/qtest -Dtest=TestCliDriver -Dqfile=partition_params_postgres.q -Dtest.metastore.db=oracle -Ditest.jdbc.jars=/path/to/your/god/damn/oracle/jdbc/driver/ojdbc6.jar -``` - -Without specifying -Dqfile it will run all .q files . - -### How do I remote debug a qtest? - -``` -cd itests/qtest -mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" test -Dtest=TestCliDriver -Dqfile=<test>.q -``` - -### How do I modify the init script when testing? - -The option to skip the init script or supply a custom init script was added in Hive 2.0 (see [HIVE-11538](https://issues.apache.org/jira/browse/HIVE-11538)). - -To skip initialization: - -``` -mvn test -Dtest=TestCliDriver -Phadoop-2 -Dqfile=test_to_run.q -DinitScript= -``` - -To supply a custom script: - -``` -mvn test -Dtest=TestCliDriver -Phadoop-2 -Dtest.output.overwrite=true -Dqfile=test_to_run.q -DinitScript=custom_script.sql -``` - -### How do I update the output of a CliDriver testcase? - -``` -cd itests/qtest -mvn test -Dtest=TestCliDriver -Dqfile=alter1.q -Dtest.output.overwrite=true - -``` - - - -### How do I update the results of many test cases? - -Assume that you have a file like below which you'd like to re-generate output files for. Such a file could be created by copying the output from the precommit tests. - -``` -head -2 /tmp/failed-TestCliDriver-file-tests -org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_allcolref_in_udf -org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_annotate_stats_join -``` - -You can re-generate all those output files in batches of 20 with the command below - -``` -egrep 'TestCliDriver' /tmp/failed-TestCliDriver-file-tests | perl -pe 's@.*testCliDriver_@@g' | awk '{print $1 ".q"}' | xargs -n 30 | perl -pe 's@ @,@g' | xargs -I{} mvn test -Dtest=TestCliDriver -Dtest.output.overwrite=true -Dqfile={} -``` - -To do the same from the output of a precommit result, with multiple drivers, you can do - -``` -import re -from itertools import groupby -s = """ -org.apache.hadoop.hive.cli.TestBeeLineDriver.testCliDriver[drop_with_concurrency] (batchId=231) -org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[comments] (batchId=35) -org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver[vector_if_expr] (batchId=141) -""" -PAT = re.compile("org.apache.hadoop.hive.cli.([^\.]*).*\[([^\]]*).*") -l = [PAT.match(x.strip()) for x in s.split("\n") if x.strip()] -for driver,q in groupby(sorted([a.groups() for a in l if a]), key=lambda a:a[0]): - print """mvn clean test -Dtest=%s '-Dqfile=%s' -Dtest.output.overwrite=true""" % (driver, ",".join(["%s.q" % a[1] for a in q])) - Review Comment: Do we want to keep this? If yes, I'll copy it to the new page. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org