nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: serverless-heaven/serverless-webpack
Pull request #767 (2021-04-06 19:42:07)

Allow custom webpack config files to export as an ES6 module (interop default)
## What did you implement:

Resolves the problem described in [this comment](https://github.com/serverless-heaven/serverless-webpack/issues/404#issuecomment-395390852)

Webpack config must be exported using `module.export` syntax which particularly is an annoyance for Typescript environments that enforce `export` syntax.

## How did you implement it:

Check for `.default` in the imported config and fallback if not present.

## How can we verify it:

1. Create a custom webpack file that exports the config using `export default ...` syntax.

## Todos:

- [x] Write tests
- [x] ~Write documentation~ (n/a)
- [x] Fix linting errors
- [x] Make sure code coverage hasn't dropped
- [x] ~Provide verification config / commands / resources~ (n/a)
- [x] Enable "Allow edits from maintainers" for this PR
- [x] Update the messages below

***Is this ready for review?:*** YES
***Is it a breaking change?:*** NO


j0k3r: Looks good to me, could rebase against the master so the PR will be mergable? Thanks!

Patch:
diff --git a/lib/validate.js b/lib/validate.js
index 8209ec8..cae04ed 100644
--- a/lib/validate.js
+++ b/lib/validate.js
@@ -131,7 +131,8 @@ module.exports = {
         );
       }
       try {
-        this.webpackConfig = require(webpackConfigFilePath);
+        const webpackConfig = require(webpackConfigFilePath);
+        this.webpackConfig = webpackConfig.default || webpackConfig;
       } catch (err) {
         this.serverless.cli.log(`Could not load webpack config '${webpackConfigFilePath}'`);
         return BbPromise.reject(err);


Test patch:
diff --git a/tests/validate.test.js b/tests/validate.test.js
index ee4210b..839a44c 100644
--- a/tests/validate.test.js
+++ b/tests/validate.test.js
@@ -271,6 +271,30 @@ describe('validate', () => {
         });
     });
 
+    it('should interop default when webpack config is exported as an ES6 module', () => {
+      const testConfig = 'testconfig';
+      const testServicePath = 'testpath';
+      const requiredPath = path.join(testServicePath, testConfig);
+      module.serverless.config.servicePath = testServicePath;
+      module.serverless.service.custom.webpack = testConfig;
+      serverless.utils.fileExistsSync = sinon.stub().returns(true);
+      const loadedConfig = {
+        default: {
+          entry: 'testentry'
+        }
+      };
+      mockery.registerMock(requiredPath, loadedConfig);
+      return expect(module.validate())
+        .to.fulfilled.then(() => {
+          expect(serverless.utils.fileExistsSync).to.have.been.calledWith(requiredPath);
+          expect(module.webpackConfig).to.eql(loadedConfig.default);
+          return null;
+        })
+        .finally(() => {
+          mockery.deregisterMock(requiredPath);
+        });
+    });
+
     it('should catch errors while loading a async webpack config from file if `custom.webpack` is a string', () => {
       const testConfig = 'testconfig';
       const testServicePath = 'testpath';
Repository: cilium/ebpf
Pull request #1423 (2024-04-09 12:08:43)

perf: fix TestPerfReaderWakeupEvents
The WakeupEvents limit is per ring, one per CPU. And when we execute BPF_PROG_RUN multiple times, we sometimes execute on different CPUs. This means that samples don't all go into a single ring.

Fix this by forcing the producer to run on a single CPU.

Co-developed-by: Dylan Reimerink <dylan@isovalent.com>

lmb: I'll go ahead and merge this since it makes CI pretty flaky.

Patch:
diff --git a/internal/unix/types_linux.go b/internal/unix/types_linux.go
index 2f22b12..025774f 100644
--- a/internal/unix/types_linux.go
+++ b/internal/unix/types_linux.go
@@ -100,6 +100,7 @@ type PerfEventMmapPage = linux.PerfEventMmapPage
 type EpollEvent = linux.EpollEvent
 type PerfEventAttr = linux.PerfEventAttr
 type Utsname = linux.Utsname
+type CPUSet = linux.CPUSet
 
 func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
 	return linux.Syscall(trap, a1, a2, a3)
@@ -204,3 +205,11 @@ func Fstat(fd int, stat *Stat_t) error {
 func SetsockoptInt(fd, level, opt, value int) error {
 	return linux.SetsockoptInt(fd, level, opt, value)
 }
+
+func SchedSetaffinity(pid int, set *CPUSet) error {
+	return linux.SchedSetaffinity(pid, set)
+}
+
+func SchedGetaffinity(pid int, set *CPUSet) error {
+	return linux.SchedGetaffinity(pid, set)
+}
diff --git a/internal/unix/types_other.go b/internal/unix/types_other.go
index e5bad04..8070371 100644
--- a/internal/unix/types_other.go
+++ b/internal/unix/types_other.go
@@ -296,3 +296,15 @@ func Fstat(fd int, stat *Stat_t) error {
 func SetsockoptInt(fd, level, opt, value int) error {
 	return errNonLinux
 }
+
+type CPUSet struct{}
+
+func (*CPUSet) Set(int) {}
+
+func SchedSetaffinity(pid int, set *CPUSet) error {
+	return errNonLinux
+}
+
+func SchedGetaffinity(pid int, set *CPUSet) error {
+	return errNonLinux
+}


Test patch:
diff --git a/internal/testutils/cpu.go b/internal/testutils/cpu.go
new file mode 100644
index 0000000..6ce55ea
--- /dev/null
+++ b/internal/testutils/cpu.go
@@ -0,0 +1,32 @@
+package testutils
+
+import (
+	"runtime"
+	"testing"
+
+	"github.com/cilium/ebpf/internal/unix"
+
+	"github.com/go-quicktest/qt"
+)
+
+// LockOSThreadToSingleCPU force the current goroutine to run on a single CPU.
+func LockOSThreadToSingleCPU(tb testing.TB) {
+	tb.Helper()
+
+	runtime.LockOSThread()
+	tb.Cleanup(runtime.UnlockOSThread)
+
+	var old unix.CPUSet
+	err := unix.SchedGetaffinity(0, &old)
+	qt.Assert(tb, qt.IsNil(err))
+
+	// Schedule test to run on only CPU 0
+	var first unix.CPUSet
+	first.Set(0)
+	err = unix.SchedSetaffinity(0, &first)
+	qt.Assert(tb, qt.IsNil(err))
+
+	tb.Cleanup(func() {
+		_ = unix.SchedSetaffinity(0, &old)
+	})
+}
diff --git a/perf/reader_test.go b/perf/reader_test.go
index c2c67da..bb2988a 100644
--- a/perf/reader_test.go
+++ b/perf/reader_test.go
@@ -490,6 +490,8 @@ func TestPause(t *testing.T) {
 }
 
 func TestPerfReaderWakeupEvents(t *testing.T) {
+	testutils.LockOSThreadToSingleCPU(t)
+
 	events := perfEventArray(t)
 
 	numEvents := 2