Skip to content

Commit

Permalink
[yugabyte#16092] YSQL: Integrate HyperLogLog extension tests with Yug…
Browse files Browse the repository at this point in the history
…abyte

Summary:
= Changes =
* Included HLL in `third-party-extensions/Makefile`
* Updated `build_postgres.py` to remove `-std=c11` flag. This flag caused some issues compiling the extension, because this extension contains some C++ code. We don't need to set the flag explicitly because Postgres uses the c99 standard and modern compilers use a default value for -std higher than c99.
* Create a new regression test `TestPgRegressThirdPartyExtensionsHll` that runs the HLL tests in their directory.

Test Plan:
```
ybd --java-test org.yb.pgsql.TestPgRegressThirdPartyExtensionsHll
```

Reviewers: yql, ssong

Reviewed By: ssong

Subscribers: jason, mbautin, ssong, amartsinchyk

Differential Revision: https://phabricator.dev.yugabyte.com/D23122
  • Loading branch information
timothy-e authored and premkumr committed Apr 7, 2023
1 parent 83f3b44 commit 103003e
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 57 deletions.
16 changes: 10 additions & 6 deletions java/yb-pgsql/src/test/java/org/yb/pgsql/PgRegressBuilder.java
Expand Up @@ -12,12 +12,6 @@
//
package org.yb.pgsql;

import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yb.client.TestUtils;
import org.yb.util.SystemUtil;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
Expand All @@ -30,6 +24,12 @@
import java.util.Map;
import java.util.TreeMap;

import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yb.client.TestUtils;
import org.yb.util.SystemUtil;

/**
* Build a ProcessBuilder for pg_regress. Also, set up the output directory.
*/
Expand Down Expand Up @@ -99,6 +99,10 @@ public PgRegressBuilder setDirs(File inputDir, File outputDir) throws RuntimeExc
// TODO(dmitry): Workaround for #1721, remove after fix.
try {
for (File f : (new File(outputDir, "sql")).listFiles()) {
if (f.isDirectory()) {
LOG.info("Skipping " + f.getAbsolutePath() + " because it is a directory");
continue;
}
if (!f.setWritable(true)) {
throw new IOException("Couldn't set write permissions for " + f.getAbsolutePath());
}
Expand Down
@@ -0,0 +1,36 @@
// Copyright (c) YugaByte, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations
// under the License.
//
package org.yb.pgsql;

import java.io.File;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.yb.client.TestUtils;
import org.yb.util.YBTestRunnerNonTsanOnly;

@RunWith(value=YBTestRunnerNonTsanOnly.class)
public class TestPgRegressThirdPartyExtensionsHll extends BasePgSQLTest {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
}

@Test
public void schedule() throws Exception {
File regress_schedule = new File(
TestUtils.getBuildRootDir(),
"postgres_build/third-party-extensions/postgresql-hll");
runPgRegressTest(regress_schedule, "yb_schedule");
}
}
1 change: 0 additions & 1 deletion python/yb/build_postgres.py
Expand Up @@ -354,7 +354,6 @@ def set_env_vars(self, step: str) -> None:
'-Wimplicit-function-declaration',
'-Wno-error=unused-function',
'-DHAVE__BUILTIN_CONSTANT_P=1',
'-std=c11',
'-Werror=implicit-function-declaration',
'-Werror=int-conversion',
]
Expand Down
1 change: 1 addition & 0 deletions python/yb/yb_dist_tests.py
Expand Up @@ -324,6 +324,7 @@ def set_global_conf_from_dict(global_conf_dict: Dict[str, str]) -> GlobalTestCon
f'{POSTGRES_BUILD_SUBDIR}/contrib',
f'{POSTGRES_BUILD_SUBDIR}/src/test/regress',
f'{POSTGRES_BUILD_SUBDIR}/src/test/isolation',
f'{POSTGRES_BUILD_SUBDIR}/third-party-extensions',

# Used by TestYsqlUpgrade.
f'{POSTGRES_BUILD_SUBDIR}/src/include/catalog/pg_yb_migration.dat',
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/third-party-extensions/Makefile
@@ -1,4 +1,4 @@
DIRS = pg_hint_plan orafce hypopg
DIRS = pg_hint_plan orafce hypopg postgresql-hll
BUILDDIRS = $(DIRS:%=build-%)
INSTALLDIRS = $(DIRS:%=install-%)
CLEANDIRS = $(DIRS:%=clean-%)
Expand Down

0 comments on commit 103003e

Please sign in to comment.